diff --git a/netforce_clinic/migrations/conv_bal.py b/netforce_clinic/migrations/conv_bal.py index fd67a2f..3311db6 100644 --- a/netforce_clinic/migrations/conv_bal.py +++ b/netforce_clinic/migrations/conv_bal.py @@ -9,9 +9,6 @@ class Migration(migration.Migration): def migrate(self): set_active_user(1) set_active_company(1) - #for mv in get_model("account.move").search_browse([['number','ilike', 'OPEN']]): - #mv.to_draft() - #mv.delete() # delete old account payable dom=[ diff --git a/netforce_clinic/models/conv_bal.py b/netforce_clinic/models/conv_bal.py index 11a6fe2..730b6f2 100644 --- a/netforce_clinic/models/conv_bal.py +++ b/netforce_clinic/models/conv_bal.py @@ -7,6 +7,10 @@ from netforce.utils import get_file_path class ConvBal(Model): _inherit="conv.bal" + _fields={ + 'track_id': fields.Many2One("account.track.categ","Track-1"), + 'department_id': fields.Many2One("clinic.department","Department"), + } def create_sale_invoices(self,ids,context={}): obj=self.browse(ids)[0] @@ -99,6 +103,17 @@ class ConvBal(Model): "account_id": acc_id, "amount_cur": amount_cur, } + department_name=line['Department'] + track_name=line['Track-1'] + if department_name: + for department in get_model("clinic.department").search_browse([['name','=',department_name]]): + vals['department_id']=department.id + branch=department.branch_id + track=branch.track_id + vals['track_id']=track.id + elif track_name: + for track_id in get_model("account.track.categ").search([['name','=',track_name]]): + vals['track_id']=track_id get_model("conv.sale.invoice").create(vals) return { "next": {