2015-02-20 13:10:40 +00:00
|
|
|
from netforce.model import Model, fields
|
|
|
|
|
2015-02-21 13:38:21 +00:00
|
|
|
class InvoicePaymentLine(Model):
|
|
|
|
_name="clinic.invoice.payment.line"
|
|
|
|
_string="Invoice Payment Line"
|
2015-02-20 13:10:40 +00:00
|
|
|
|
|
|
|
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={
|
2015-02-21 13:38:21 +00:00
|
|
|
'invoice_payment_id': fields.Many2One("clinic.invoice.payment","Invcoie Payment",required=True,on_delete="cascade"),
|
|
|
|
'matching_id': fields.Many2One("clinic.matching.payment","Payment Matching"),
|
2015-02-20 13:10:40 +00:00
|
|
|
'fee': fields.Float("Fee"),
|
|
|
|
'srv': fields.Float("Service"),
|
|
|
|
'epo': fields.Float("EPO"),
|
|
|
|
'amount': fields.Float("Amount", function="_get_all", function_multi=True),
|
|
|
|
}
|
|
|
|
|
2015-02-21 13:38:21 +00:00
|
|
|
InvoicePaymentLine.register()
|