clinic/netforce_clinic/models/invoice_payment_line.py

29 lines
916 B
Python

from netforce.model import Model, fields
class InvoicePaymentLine(Model):
_name="clinic.invoice.payment.line"
_string="Invoice Payment Line"
def _get_all(self,ids,context={}):
res={}
for obj in self.browse(ids):
fee=obj.fee or 0
epo=obj.epo or 0
srv=obj.srv or 0
amount=fee+epo+srv
res[obj.id]={
'amount': amount,
}
return res
_fields={
'invoice_payment_id': fields.Many2One("clinic.invoice.payment","Invcoie Payment",required=True,on_delete="cascade"),
'matching_id': fields.Many2One("clinic.matching.payment","Payment Matching"),
'fee': fields.Float("Fee"),
'srv': fields.Float("Service"),
'epo': fields.Float("EPO"),
'amount': fields.Float("Amount", function="_get_all", function_multi=True),
}
InvoicePaymentLine.register()