laksi need to cut stock from another location for some product like eporon
parent
fc5b1a2d9a
commit
173c8e599e
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="string">Department Product</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.department.product</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -0,0 +1,5 @@
|
|||
<form model="clinic.department.product">
|
||||
<field name="product_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="stock_journal_id"/>
|
||||
</form>
|
|
@ -0,0 +1,5 @@
|
|||
<list model="clinic.department.product">
|
||||
<field name="product_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="stock_journal_id"/>
|
||||
</list>
|
|
@ -49,16 +49,12 @@
|
|||
<item string="RD Shop Expense" action="clinic_report_shop"/>
|
||||
<item string="Cycle Item Summary" action="clinic_report_cycle_item"/>
|
||||
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
|
||||
<!--<item string="Medical Detail" action="clinic_report_medical_detail"/>-->
|
||||
<!--<item string="HD Case Summary(PDF)" action="clinic_hd_case_print"/>-->
|
||||
<!--<item string="Medical Summary" action="clinic_report_medical_summary"/>-->
|
||||
<!--<item string="Recent Patient" action="clinic_report_recent_patient"/>-->
|
||||
<!--<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>-->
|
||||
</item>
|
||||
<item string="Settings" perm="clinic_settings">
|
||||
<item string="Titles" action="clinic_name_title" perm="clinic_name_title"/>
|
||||
<item string="Branches" action="clinic_branch" perm="clinic_branch"/>
|
||||
<item string="Departments" action="clinic_department"/>
|
||||
<item string="Department Products" action="clinic_department_product"/>
|
||||
<item string="Hospitals" action="clinic_hospital"/>
|
||||
<item string="Nationalities" action="clinic_nation"/>
|
||||
<item string="Clinic Settings" action="clinic_setting"/>
|
||||
|
|
|
@ -2,14 +2,4 @@
|
|||
<field name="categ_id" position="after">
|
||||
<field name="patient_types"/>
|
||||
</field>
|
||||
<field name="attributes" position="before">
|
||||
<field name="departments">
|
||||
<list>
|
||||
<field name="department_id"/>
|
||||
</list>
|
||||
<form>
|
||||
<field name="department_id"/>
|
||||
</form>
|
||||
</field>
|
||||
</field>
|
||||
</inherit>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<form model="clinic.setting.account.product" show_company="1">
|
||||
<field name="patient_type_id"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="ar_credit_id"/>
|
||||
<field name="ar_debit_id"/>
|
||||
<field name="product_id" domain='[["categ_id","=",categ_id]]'/>
|
||||
<field name="ar_credit_id" domain='[["type","!=","view"]]'/>
|
||||
<field name="ar_debit_id" domain='[["type","!=","view"]]'/>
|
||||
<field name="type"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
</form>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<list model="clinic.setting.account.product" show_company="1">
|
||||
<field name="patient_type_id"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="ar_credit_id"/>
|
||||
<field name="ar_debit_id"/>
|
||||
<field name="type"/>
|
||||
|
|
|
@ -11,6 +11,7 @@ from . import cause_chronic
|
|||
from . import comorbidity
|
||||
from . import department
|
||||
from . import department_profile
|
||||
from . import department_product
|
||||
from . import education
|
||||
from . import graduation
|
||||
from . import morbidity
|
||||
|
@ -131,4 +132,3 @@ from . import report_shop
|
|||
from . import account_tax_component
|
||||
from . import report_thai_wht_certif
|
||||
from . import num2word
|
||||
from . import department_product
|
||||
|
|
|
@ -3,10 +3,20 @@ from netforce.model import Model, fields
|
|||
class DepartmentProduct(Model):
|
||||
_name="clinic.department.product"
|
||||
_string="Department Product"
|
||||
|
||||
_key=['product_id','department_id']
|
||||
_fields={
|
||||
"product_id": fields.Many2One("product","Product"),
|
||||
"department_id": fields.Many2One("clinic.department","Department"),
|
||||
"product_id": fields.Many2One("product","Product", required=True),
|
||||
"department_id": fields.Many2One("clinic.department","Working Department", required=True),
|
||||
"stock_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True),
|
||||
}
|
||||
|
||||
def get_location(self,department_id,product_id,context={}):
|
||||
for obj in self.search_browse([]):
|
||||
if obj.department_id.id==department_id and obj.product_id.id==product_id:
|
||||
return {
|
||||
'wh_loc_id': obj.stock_journal_id.location_from_id.id,
|
||||
'cust_loc_id': obj.stock_journal_id.location_to_id.id,
|
||||
'journal_id': obj.stock_journal_id.id,
|
||||
}
|
||||
|
||||
DepartmentProduct.register()
|
||||
|
|
|
@ -786,15 +786,20 @@ class HDCase(Model):
|
|||
if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids:
|
||||
continue
|
||||
prod_exist_ids.append(prod.id)
|
||||
|
||||
#XXX
|
||||
dpt_prods=get_model('clinic.department.product').get_location(obj.department_id.id,prod.id)
|
||||
if dpt_prods:
|
||||
print("get location from menu department products")
|
||||
wh_loc_id=dpt_prods.get('wh_loc_id')
|
||||
cust_loc_id=dpt_prods.get('cust_loc_id')
|
||||
#pick_vals['journal_id']=dpt_prods.get('journal_id')
|
||||
if not wh_loc_id:
|
||||
wh_loc_id=prod.location_id.id
|
||||
if not wh_loc_id:
|
||||
if wh_loc_id:
|
||||
res=get_model("stock.location").search([["type","=","internal"]])
|
||||
if not res:
|
||||
raise Exception("Warehouse not found")
|
||||
wh_loc_id=res[0]
|
||||
|
||||
line_vals={
|
||||
"product_id": prod.id,
|
||||
"qty": line.qty,
|
||||
|
@ -802,9 +807,6 @@ class HDCase(Model):
|
|||
"location_from_id": wh_loc_id,
|
||||
"location_to_id": cust_loc_id,
|
||||
}
|
||||
#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))
|
||||
if not pick_vals["lines"]:
|
||||
return {
|
||||
|
|
|
@ -68,6 +68,7 @@ class Shop(Model):
|
|||
"payment_lines": fields.One2Many("clinic.shop.payment","shop_id","Payment Lines"),
|
||||
}
|
||||
|
||||
_order="date desc"
|
||||
|
||||
def _get_shop_categs(self,context={}):
|
||||
st=get_model("clinic.setting").browse(1)
|
||||
|
|
Loading…
Reference in New Issue