clinic/netforce_clinic/models/account_payment.py

36 lines
984 B
Python

from netforce.model import Model, fields, get_model
class AccountPayment(Model):
_inherit="account.payment"
def run_report(self,ids,context={}):
obj=self.browse(ids)[0]
hd_case_id=obj.related_id.id
hd_case=get_model("clinic.hd.case").browse(hd_case_id)
# TODO
# set payment_id on hd case
# send to action print form payment
hd_case.write({
'payment_id': obj.id,
})
return {
'next': {
'name': 'report_clinic_payment_form',
'refer_id': hd_case_id,
'payment_id': obj.id,
},
}
def import_payment(self,ids,context={}):
if not ids:
raise Exception("Please save payment before import")
print("xx ", ids)
return {
'next': {
'name': 'clinic_import_uc',
'refer_id': ids[0], #XXX
}
}
AccountPayment.register()