clinic/netforce_clinic/models/matching_payment_popup.py

40 lines
1.0 KiB
Python
Raw Permalink Normal View History

2015-03-04 07:19:53 +00:00
from netforce.model import Model, fields, get_model
class MatchingPaymentPopup(Model):
_name="clinic.matching.payment.popup"
_transient=True
_fields={
"matching_payment_id": fields.Many2One("clinic.matching.payment","Matching Payment",required=True,on_delete="cascade"),
'type': fields.Selection([['all','All'],['match','Match'],['unmatch','Not Match']],'Type'),
}
def _get_id(self,context={}):
refer_id=context.get("refer_id")
if not refer_id:
return None
return int(refer_id)
_defaults={
'matching_payment_id': _get_id,
'type': 'all',
}
def do_select(self,ids,context):
obj=self.browse(ids)[0]
matching=obj.matching_payment_id
matching.write({
'type': obj.type,
})
return {
'next': {
'name': 'clinic_matching_payment',
'mode': 'form',
'active_id': matching.id,
},
}
MatchingPaymentPopup.register()