set product account

conv_bal
watcha.h 2015-02-03 13:40:48 +07:00
parent ea17617007
commit 664ba814c5
4 changed files with 20 additions and 3 deletions

View File

@ -26,7 +26,8 @@
<field name="account_products" nolabel="1">
<list>
<field name="patient_type_id"/>
<field name="product_id"/>
<field name="categ_id"/>
<field name="product_id" domain='[["categ_id","=",categ_id]]'/>
<field name="ar_debit_id"/>
<field name="ar_credit_id"/>
</list>

View File

@ -17,8 +17,8 @@
<field name="product_id" domain='[["categ_id.id","=",product_categ_id],["code","like",type_code]]' onchange="onchange_product"/>
<field name="description"/>
<!--<field name="account_id"/>-->
<field name="ar_credit_id"/>
<field name="ar_debit_id"/>
<!--<field name="ar_credit_id"/>-->
<!--<field name="ar_debit_id"/>-->
<field name="reimbursable"/>
<field name="uom_id"/>
<field name="price" onchange="onchange_setting_line"/>

View File

@ -131,5 +131,18 @@ class ClinicSetting(Model):
payment.to_draft()
print("to draft payment ", payment.id)
print("Done")
def get_account_prod(self,ptype_id=None,prod_id=None,context={}):
res={}
for ac_prod in get_model("clinic.setting.account.product").browse([]):
prod=ac_prod.product_id
ptype=ac_prod.patient_type_id
if ptype_id==ptype.id and prod_id==prod.id:
res.update({
'ar_credit_id': ac_prod.ar_credit_id.id,
'ar_debit_id': ac_prod.ar_debit_id.id,
})
break
return res
ClinicSetting.register()

View File

@ -9,6 +9,7 @@ class SettingAccountProduct(Model):
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting",required=True,on_delete="cascade"),
"patient_type_id": fields.Many2One("clinic.patient.type","Patient Type"),
'categ_id': fields.Many2One("product.categ","Category"),
"product_id": fields.Many2One("product","Product"),
"ar_credit_id": fields.Many2One("account.account","AR Credit",multi_company=True),
"ar_debit_id": fields.Many2One("account.account","AR Debit",multi_company=True),
@ -19,4 +20,6 @@ class SettingAccountProduct(Model):
"company_id": lambda *a: get_active_company(),
}
_order="patient_type_id"
SettingAccountProduct.register()