# -*- coding -*-
from odoo import models, fields, api
import odoo.addons.decimal_precision as dp


class Payment(models.Model):

    _name = 'car.payment'
    _description = 'Contract\'s payment'
    _inherit = ['mail.thread', 'mail.activity.mixin']
    # _inherit = 'mail.thread'
    
    contract_id = fields.Many2one(comodel_name='car.contract', string='Contract')
    company_id = fields.Many2one(comodel_name='res.company', string='Company', related='contract_id.company_id', store=True)
    collect_amount = fields.Monetary(string='Collect Amount', digits=dp.get_precision('Account'),
                currency_field='currency_id', track_visibility='always')
    collect_at = fields.Date(default=fields.Date.today())
    currency_id = fields.Many2one(comodel_name='res.currency', string='Currency', related='contract_id.currency_id', store=True)
    name = fields.Char(string='Reference', size=200)
    image = fields.Binary("Photo", attachment=True, related='contract_id.image', readonly=True)


