conv_bal
watcha.h 2015-01-29 10:12:17 +07:00
parent 89b7542ea3
commit 522aeb5ad5
6 changed files with 24 additions and 21 deletions

View File

@ -12,11 +12,13 @@
<field name="products" nolabel="1">
<list>
<field name="patient_type_id" onchange="onchange_ptype"/>
<field name="type_code" invisible="1"/>
<field name="type_code" invisible="1" readonly="1"/>
<field name="product_categ_id"/>
<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="account_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

@ -389,6 +389,8 @@ class HDCase(Model):
for line in obj.lines:
if line.state!='draft':
continue
if line.amount < 1:
continue #XXX
prod=line.product_id
# 1.find in line
account_id=line.account_id.id
@ -397,7 +399,8 @@ class HDCase(Model):
for sline in cst.products:
stype=sline.patient_type_id
if stype.id==obj.patient_type_id.id and prod.id==sline.product_id.id:
account_id=sline.account_id.id
#account_id=sline.account_id.id
account_id=sline.ar_credit_id.id
break
# 3.find in product(tab accounting)
if not account_id:
@ -432,10 +435,6 @@ class HDCase(Model):
partner=ptype.contact_id
if not partner:
raise Exception("No contact for patient type %s"%obj.ptype.name)
account_mdc_id=partner.account_mdc_id.id
account_fee_id=partner.account_fee_id.id
account_service_id=partner.account_service_id.id
print('>>>> ', partner.id, account_service_id, account_mdc_id, account_fee_id, ' <<<')
vals={
"type": "out",
"inv_type": "invoice",
@ -539,6 +538,8 @@ class HDCase(Model):
if line.state!='draft':
continue
if line.qty < 1:
continue
prod=line.product_id
if prod.type != 'stock':
continue
@ -558,7 +559,7 @@ class HDCase(Model):
line_vals={
"product_id": prod.id,
"qty": 1,
"qty": line.qty,
"uom_id": prod.uom_id.id,
"location_from_id": wh_loc_id,
"location_to_id": cust_loc_id,
@ -983,7 +984,8 @@ class HDCase(Model):
price=st_prod.price
qty=st_prod.qty
amt=st_prod.amount
account_id=st_prod.account_id.id
#account_id=st_prod.account_id.id
account_id=st_prod.ar_credit_id.id
if not account_id:
account_id=prod.sale_account_id.id
if not account_id:

View File

@ -49,7 +49,6 @@ class HDCasePayment(Model):
vals={
'state': 'paid',
}
#hd_case.update_usetime()
else:
vals={
'state': 'waiting_payment',
@ -75,7 +74,6 @@ class HDCasePayment(Model):
hd_case.make_invoices(context=context)
hd_case.post_invoices()
hd_case.create_cycle_item()
#hd_case.update_usetime()
hd_case.do_expense()
return {
'next': {

View File

@ -106,6 +106,7 @@ class ClinicSetting(Model):
for prod in obj.products:
prod.write({
'type_code': prod.patient_type_id.code,
'ar_credit_id': prod.account_id.id,
})
print("Done! ")

View File

@ -19,6 +19,8 @@ class SettingProduct(Model):
'qty': fields.Integer("Qty"),
'amount': fields.Float("Amount"),
"account_id": fields.Many2One("account.account","Account",multi_company=True),
"ar_credit_id": fields.Many2One("account.account","AR Credit",multi_company=True),
"ar_debit_id": fields.Many2One("account.account","AR Debit",multi_company=True),
'company_id': fields.Many2One("company","Company"),
}

View File

@ -1,14 +1,4 @@
todo:
- filter product by
1. company
2. category
3. code
- cycle item
- copy nurse only in the list
- problem after confirm visit
- accounting
- invoice line -> account -> credit
- debit from hd case setting
@ -16,6 +6,14 @@ todo:
- credit <= product -> tab -> accounting -> sale -> sale account
- debit <= 1. contact -> tab accounting -> account receiaveble , 2. finacial setting -> account receiable
- sale medicine
- filter product by
1. company -> ok
2. category -> ok
3. code -> ok
- cycle item
- copy nurse only in the list -> ok
- problem after confirm visit -> ok
- import hd case ***
- add script