from netforce.model import Model, fields, get_model from netforce.access import get_active_user class Settings(Model): _inherit="settings" _fields={ "cash_account_id": fields.Many2One("account.account","Cash Account"), "income_account_id": fields.Many2One("account.account","Income Account"), "ap_nurse_id": fields.Many2One("account.account","Account Payment Nurse"), "ap_doctor_id": fields.Many2One("account.account","Account Payment Doctor"), } def get_default_address(self,ids,context={}): branch_id=None if context.get("branch_id"): branch_id=context['branch_id'] else: user_id=get_active_user() user=get_model("base.user").browse(user_id) branch_id=user.branch_id.id vals={} for obj in self.browse(ids): vals[obj.id]=obj.addresses and obj.addresses[0].id or None if branch_id: branch=get_model("clinic.branch").browse(branch_id) vals[obj.id]=branch.addresses and branch.addresses[0].id or None return vals Settings.register()