clinic/netforce_clinic/models/matching_payment_line.py

31 lines
1.0 KiB
Python

from netforce.model import Model, fields, get_model
class MatchingPaymentLine(Model):
_name="clinic.matching.payment.line"
_transient=True
def _get_all(self,ids,context={}):
res={}
for obj in self.browse(ids):
res[obj.id]={
'amount': (obj.fee or 0)+(obj.epo or 0)+(obj.srv or 0),
}
return res
_fields={
'match_id': fields.Many2One("clinic.matching.payment","Match",required=True,on_delete="cascade"),
'invoice_id': fields.Many2One("account.invoice","Invoice (Waiting Payment)"),
"date": fields.Char("Date"),
"hn": fields.Char("HN"),
'pid': fields.Char("PID"),
"name": fields.Char("Name"),
'epo': fields.Float("EPO"),
'srv': fields.Float("Service"),
"fee": fields.Float("Fee"),
'amount': fields.Float("Amount",function="_get_all",function_multi=True),
'state': fields.Selection([['match','Match'],['unmatch','Not Match']],'State'),
}
MatchingPaymentLine.register()