diff --git a/netforce_clinic/layouts/clinic_shop_form.xml b/netforce_clinic/layouts/clinic_shop_form.xml index 2073fb2..b86336e 100644 --- a/netforce_clinic/layouts/clinic_shop_form.xml +++ b/netforce_clinic/layouts/clinic_shop_form.xml @@ -14,9 +14,9 @@ - - + + diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 82d9d7c..1c33583 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -93,7 +93,7 @@ class Shop(Model): def _get_number(self,context={}): while 1: - seq_id=get_model("sequence").find_sequence(name="Clinic RD Shop") + seq_id=get_model("sequence").find_sequence(type="clinic_rdshop",context=context) num=get_model("sequence").get_next_number(seq_id,context=context) if not num: return None @@ -217,8 +217,9 @@ class Shop(Model): if not st.shop_type_id: raise Exception("Please defind Shop Type on menu Clinic Settings -> RD Shop") if obj.number=="/": + context['branch_id']=obj.branch_id.id obj.write({ - 'number': self._get_number(), + 'number': self._get_number(context=context), }) obj.make_invoices() return { @@ -618,4 +619,9 @@ class Shop(Model): res=obj.pay_credit() return res + def onchange_branch(self,context={}): + data=context['data'] + data['department_id']=None + return data + Shop.register()