diff --git a/netforce_clinic/layouts/clinic_dialyzer_form.xml b/netforce_clinic/layouts/clinic_dialyzer_form.xml index 07e5849..e91680b 100644 --- a/netforce_clinic/layouts/clinic_dialyzer_form.xml +++ b/netforce_clinic/layouts/clinic_dialyzer_form.xml @@ -16,7 +16,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml index 810ae6a..26d6fde 100644 --- a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml @@ -1,5 +1,6 @@ + @@ -7,6 +8,11 @@ + + + กรณีในช่อง product ไม่มีให้เลือก ให้ระบุที่ชอ่ง New Product แทน + + diff --git a/netforce_clinic/layouts/clinic_visit_list.xml b/netforce_clinic/layouts/clinic_visit_list.xml index a10b8f5..c587760 100644 --- a/netforce_clinic/layouts/clinic_visit_list.xml +++ b/netforce_clinic/layouts/clinic_visit_list.xml @@ -5,10 +5,11 @@ - + + - + diff --git a/netforce_clinic/models/dialyzer.py b/netforce_clinic/models/dialyzer.py index 518776a..41a12b4 100644 --- a/netforce_clinic/models/dialyzer.py +++ b/netforce_clinic/models/dialyzer.py @@ -75,8 +75,8 @@ class Dialyzer(Model): product_id=prod.id found=True break - if not product_id: - raise Exception("No Product with category 'Dialyzer'") + #if not product_id: + #raise Exception("No Product with category 'Dialyzer'") return product_id def _get_product_name(self,context={}): @@ -126,7 +126,6 @@ class Dialyzer(Model): if not ship_address_id: patient.simple_address() - #XXX st=get_model("clinic.setting").browse(1) stock_journal=st.stock_journal_id @@ -170,7 +169,7 @@ class Dialyzer(Model): raise Exception("Warehouse not found") wh_loc_id=res[0] - if prod.type=='stock': + if prod and prod.type=='stock': line_vals={ "product_id": prod.id, "qty": 1, @@ -191,7 +190,7 @@ class Dialyzer(Model): number=obj.number.replace("/","") if not number: department=obj.department_id - context['branch_id']=department.branch_id.id + context['branch_id']=department.branch_id.id number=self._get_number(context=context) obj.write({ "number": number, diff --git a/netforce_clinic/models/hd_case_popup_dlz.py b/netforce_clinic/models/hd_case_popup_dlz.py index a4e9a41..bf30af3 100644 --- a/netforce_clinic/models/hd_case_popup_dlz.py +++ b/netforce_clinic/models/hd_case_popup_dlz.py @@ -6,7 +6,8 @@ class HDCasePopupDlz(Model): _fields={ "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"), - 'product_id': fields.Many2One("product", "Product",required=True), + 'product_id': fields.Many2One("product", "Product",required=False), + 'new_product': fields.Char("New Product"), "dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"), "max_use_time": fields.Integer("Max Use Time"), "exp_date": fields.Date("Expiry Date"), @@ -59,8 +60,34 @@ class HDCasePopupDlz(Model): context['is_wiz']=True context['pop_id']=obj.id context['drop_old']=obj.drop_old + if obj.new_product: + name=obj.new_product + uom_id=None + for r_id in get_model("uom").search([['name','=','Unit']]): + uom_id=r_id + if not uom_id: + raise Exception("Missing UoM !") + categ_id=None + for r_id in get_model("product.categ").search([['code','=','DLZ']]): + categ_id=r_id + if not categ_id: + raise Exception("Missing Product category code DLZ!") + new_prod_id=get_model("product").create({ + 'type': 'stock', + 'code': name.upper(), + 'name': name, + 'description': name, + "uom_id": uom_id, + 'categ_id': categ_id, + 'can_sell': True, + 'can_purchase': True, + }) + obj.write({ + 'product_id': new_prod_id, + }) + if not obj.product_id: + raise Exception("Missing product!") res=hd_case.new_dialyzer(context=context) - print('res ', res) return res def onchange_product(self,context={}): diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py index 7f4570b..7b1b866 100644 --- a/netforce_clinic/models/visit.py +++ b/netforce_clinic/models/visit.py @@ -26,9 +26,12 @@ class Visit(Model): for obj in self.browse(ids): cycle=obj.cycle_id color=cycle.color + patient=obj.patient_id res[obj.id]={ 'cycle_color': color, 'sequence': '%s-%s'%(obj.time_start[0:10],cycle.sequence), #date-sequence + 'patient_name': patient_id.name, + 'patient_type_id': patient_id.type_id.id, } return res @@ -54,6 +57,8 @@ class Visit(Model): 'note': fields.Text('Note'), 'branch_id': fields.Many2One("clinic.branch","Branch"), 'manual': fields.Boolean("Manual Tempolary Visit"), + "patient_name": fields.Char("Patient Name", function="_get_all", store=True, search=True), + "patient_type_id": fields.Char("Patient Type", function="_get_all", store=True, search=True), } def _get_number(self,context={}): diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 5dd8b32..48df652 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,7 +1,10 @@ -redesign print payment & invoice from hdcase - - print payment - - direct payment - - invoice payment +========================================== +keep log: + patient_name, patient_type, walkin, location -migration: - match invoice less than 2015-06-30 to hdcase +=========================================== + +patient: + 1.new + 2. dispose + 3. move
+ กรณีในช่อง product ไม่มีให้เลือก ให้ระบุที่ชอ่ง New Product แทน +