From 688a46ab8802b082a66f7500914d5023a4068b9d Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 22 Apr 2015 23:43:00 +0700 Subject: [PATCH] prepare department location --- netforce_clinic/layouts/clinic_department_form.xml | 4 ---- netforce_clinic/layouts/clinic_prod_form.xml | 10 ++++++++++ netforce_clinic/models/__init__.py | 1 + netforce_clinic/models/department.py | 2 ++ netforce_clinic/models/department_product.py | 12 ++++++++++++ netforce_clinic/models/hd_case.py | 2 +- netforce_clinic/models/product.py | 1 + 7 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 netforce_clinic/models/department_product.py diff --git a/netforce_clinic/layouts/clinic_department_form.xml b/netforce_clinic/layouts/clinic_department_form.xml index 8326513..266c870 100644 --- a/netforce_clinic/layouts/clinic_department_form.xml +++ b/netforce_clinic/layouts/clinic_department_form.xml @@ -11,8 +11,4 @@ - - - - diff --git a/netforce_clinic/layouts/clinic_prod_form.xml b/netforce_clinic/layouts/clinic_prod_form.xml index ed2a5e8..b507674 100644 --- a/netforce_clinic/layouts/clinic_prod_form.xml +++ b/netforce_clinic/layouts/clinic_prod_form.xml @@ -2,4 +2,14 @@ + + + + + +
+ + +
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index cdbc078..114069a 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -131,3 +131,4 @@ from . import report_shop from . import account_tax_component from . import report_thai_wht_certif from . import num2word +from . import department_product diff --git a/netforce_clinic/models/department.py b/netforce_clinic/models/department.py index bf51647..c223c93 100644 --- a/netforce_clinic/models/department.py +++ b/netforce_clinic/models/department.py @@ -14,8 +14,10 @@ class Department(Model): 'branch_id': fields.Many2One("clinic.branch","Branch"), "pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True), 'patients': fields.One2Many("clinic.patient","department_id","Patients"), + 'products': fields.One2Many("clinic.department.product","product_id","Products"), 'staffs': fields.One2Many("clinic.staff","department_id","Staffs"), 'active': fields.Boolean("Active"), + 'product_wharehouse': fields.Boolean("Get Location From Product Warehouse"), } def _get_branch(self,context={}): diff --git a/netforce_clinic/models/department_product.py b/netforce_clinic/models/department_product.py new file mode 100644 index 0000000..34c6d1c --- /dev/null +++ b/netforce_clinic/models/department_product.py @@ -0,0 +1,12 @@ +from netforce.model import Model, fields + +class DepartmentProduct(Model): + _name="clinic.department.product" + _string="Department Product" + + _fields={ + "product_id": fields.Many2One("product","Product"), + "department_id": fields.Many2One("clinic.department","Department"), + } + +DepartmentProduct.register() diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 45b12dd..2c25ca8 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -797,7 +797,7 @@ class HDCase(Model): "location_from_id": wh_loc_id, "location_to_id": cust_loc_id, } - #XXX whare house in profile product + #XXX wharehouse in profile product if prod.location_id: line_vals['location_from_id']=prod.location_id.id pick_vals["lines"].append(("create",line_vals)) diff --git a/netforce_clinic/models/product.py b/netforce_clinic/models/product.py index b8a29a5..a1c38ab 100644 --- a/netforce_clinic/models/product.py +++ b/netforce_clinic/models/product.py @@ -4,6 +4,7 @@ class Product(Model): _inherit="product" _fields={ 'patient_types': fields.Many2Many("clinic.patient.type","Patient Types"), + 'departments': fields.One2Many('clinic.department.product','product_id','Departments'), } Product.register()