xxxxx
parent
7549200b84
commit
8ab5d37bea
|
@ -50,7 +50,7 @@ class HDcase(Model):
|
|||
'visit_id': fields.Many2One("clinic.visit", "Visit"),
|
||||
'total_time': fields.Integer("Total Time(Hrs)",function="get_hrs"),
|
||||
"fee_type": fields.Selection([("mg","Medical Government"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("others","Others")],"Fee Type"),
|
||||
'fee_partner_id': fields.Many2One("partner","Fee Contact"),
|
||||
'fee_partner_id': fields.Many2One("partner","Contact Fee"),
|
||||
'paid': fields.Boolean("Paid"),
|
||||
"time_start": fields.DateTime("Time start",required=True,search=True),
|
||||
"time_stop": fields.DateTime("Time stop",required=True,search=True),
|
||||
|
@ -159,6 +159,7 @@ class HDcase(Model):
|
|||
def make_invoices(self,ids,context={}):
|
||||
setting=get_model("settings").browse(1)
|
||||
currency_id=setting.currency_id.id
|
||||
#
|
||||
account_receivable_id=setting.account_receivable_id.id
|
||||
company_id=get_active_company()
|
||||
uom=get_model("uom").search_browse([['name','ilike','%Unit%']])
|
||||
|
@ -188,6 +189,9 @@ class HDcase(Model):
|
|||
raise Exception("No contact for patient %s"%obj.patient_id.name)
|
||||
vals["partner_id"]=partner.id
|
||||
for line in obj.lines:
|
||||
account_id=line.product_id.sale_account_id.id or account_receivable_id
|
||||
if not account_id:
|
||||
raise Exception("%s not found account recievable %s"%partner.name)
|
||||
line={
|
||||
"product_id": line.product_id.id,
|
||||
"description": line.description,
|
||||
|
@ -195,7 +199,7 @@ class HDcase(Model):
|
|||
"uom_id": line.uom_id.id,
|
||||
"unit_price": line.price,
|
||||
"amount": line.amount,
|
||||
'account_id': line.product_id.sale_account_id.id or account_receivable_id,
|
||||
'account_id': account_id,
|
||||
}
|
||||
vals['lines'].append(('create',line))
|
||||
inv_id=get_model("account.invoice").create(vals,context)
|
||||
|
@ -215,8 +219,13 @@ class HDcase(Model):
|
|||
"company_id": company_id,
|
||||
}
|
||||
vals["partner_id"]=obj.fee_partner_id.id
|
||||
if obj.fee_partner_id.account_payable_id:
|
||||
account_receivable_id=obj.fee_partner_id.account_payable_id.id
|
||||
# XXX
|
||||
#if obj.fee_partner_id.account_payable_id:
|
||||
#account_receivable_id=obj.fee_partner_id.account_payable_id.id
|
||||
if obj.fee_partner_id.account_receivable_id:
|
||||
account_id=obj.fee_partner_id.account_receivable_id.id or account_receivable_id
|
||||
if not account_receivable_id:
|
||||
raise Exception("%s not found account recievable %s"%obj.fee_partner_id.name)
|
||||
line={
|
||||
"product_id": None,
|
||||
"description": "Fee",
|
||||
|
@ -224,7 +233,7 @@ class HDcase(Model):
|
|||
"uom_id": uom[0].id,
|
||||
"unit_price": obj.fee,
|
||||
"amount": obj.fee,
|
||||
'account_id': account_receivable_id,
|
||||
'account_id': account_id,
|
||||
}
|
||||
vals['lines'].append(('create',line))
|
||||
inv_id=get_model("account.invoice").create(vals,context)
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
from netforce.model import Model, fields
|
||||
|
||||
class Payment(Model):
|
||||
_name="clinic.payment"
|
||||
_string="Payment"
|
||||
_fields={
|
||||
'doc_date': fields.Date("Doc Date"),
|
||||
'name': fields.Char("Name"),
|
||||
'hn': fields.Char("HN"),
|
||||
'amount': fields.Float("Amount"),
|
||||
'je_id': fields.Many2One("clinic.je","Journal Entry"),
|
||||
}
|
||||
|
||||
Payment.register()
|
|
@ -1,9 +1,14 @@
|
|||
|
||||
===== todo
|
||||
Account Receivable -> invoice
|
||||
find account id
|
||||
1. partner
|
||||
2. product line
|
||||
3. settings
|
||||
Account Payable -> payment
|
||||
|
||||
|
||||
|
||||
!!! import
|
||||
set account payable
|
||||
|
||||
issue:
|
||||
date of visit is not copy after click from calendar
|
||||
|
|
Loading…
Reference in New Issue