reciept
parent
e2bb209c5c
commit
3b5a68260d
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="type">report_odt</field>
|
||||
<field name="model">clinic.hd.case</field>
|
||||
<field name="method">get_report_payment_data</field>
|
||||
<field name="template">payment_form</field>
|
||||
</action>
|
|
@ -119,7 +119,22 @@
|
|||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
<field name="payments" click_action="clinic_view_payment"/>
|
||||
<field name="payments" click_action="clinic_view_payment">
|
||||
<list>
|
||||
<head>
|
||||
<button string="Reciept" method="run_report" type="default" icon="print"/>
|
||||
</head>
|
||||
<field name="number"/>
|
||||
<field name="date"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="type"/>
|
||||
<field name="pay_type"/>
|
||||
<field name="account_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
<field name="pickings" click_action="view_picking"/>
|
||||
<field name="comments"/>
|
||||
</related>
|
||||
|
|
|
@ -38,3 +38,4 @@ from . import import_data_nhso
|
|||
from . import import_data_sc
|
||||
from . import translate
|
||||
from . import payment
|
||||
from . import account_payment
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
from netforce.model import Model, fields, get_model
|
||||
|
||||
class AccountPayment(Model):
|
||||
_inherit="account.payment"
|
||||
|
||||
def run_report(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
hd_case_id=obj.related_id.id
|
||||
hd_case=get_model("clinic.hd.case").browse(hd_case_id)
|
||||
# TODO
|
||||
# set payment_id on hd case
|
||||
# send to action print form payment
|
||||
hd_case.write({
|
||||
'payment_id': obj.id,
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'report_clinic_payment_form',
|
||||
'refer_id': hd_case_id,
|
||||
'payment_id': obj.id,
|
||||
},
|
||||
}
|
||||
|
||||
AccountPayment.register()
|
|
@ -2,7 +2,7 @@ import time
|
|||
|
||||
from datetime import datetime
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.utils import get_data_path
|
||||
from netforce.utils import get_data_path, get_file_path
|
||||
from netforce.access import get_active_user,set_active_user
|
||||
from netforce.access import get_active_company
|
||||
|
||||
|
@ -72,6 +72,7 @@ class HDCase(Model):
|
|||
'pay_amount': fields.Float("Amount",function="get_pay_amount"),
|
||||
'pay_date': fields.Date("Pay Date"),
|
||||
'pay_account_id': fields.Many2One("account.account","Account"),
|
||||
'payment_id': fields.Many2One("account.payment","Payment"), # for print
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
|
@ -580,4 +581,39 @@ class HDCase(Model):
|
|||
'state': 'waiting_payment',
|
||||
})
|
||||
|
||||
def get_report_payment_data(self,context={}):
|
||||
settings=get_model("settings").browse(1)
|
||||
refer_id=context.get("refer_id")
|
||||
payment_id=context.get("payment_id")
|
||||
data={
|
||||
'settings_address_text': settings.default_address_id and settings.default_address_id.get_address_text()[settings.default_address_id.id] or "",
|
||||
'logo': get_file_path(settings.logo) or "",
|
||||
}
|
||||
if refer_id:
|
||||
pass
|
||||
if payment_id:
|
||||
#context['refer_id']=payment_id
|
||||
#data=get_model("account.payment").get_report_data(context=context)
|
||||
payment=get_model("account.payment").browse(int(payment_id))
|
||||
partner_address_id=payment.partner_id.default_address_id
|
||||
data['number']=payment.number
|
||||
data['ref']=payment.related_id.number
|
||||
data['date']=payment.date
|
||||
data['partner_name']=payment.partner_id.name or 0
|
||||
data['partner_address_text']=partner_address_id and partner_address_id.get_address_text()[partner_address_id.id] or "",
|
||||
lines=[]
|
||||
for line in payment.direct_lines:
|
||||
lines.append({
|
||||
'description': line.description or '',
|
||||
'qty': line.qty,
|
||||
'unit_price': line.unit_price or 0.0,
|
||||
'amount': line.amount or 0.0,
|
||||
})
|
||||
data['lines']=lines
|
||||
data['amount_subtotal']=payment.amount_subtotal or 0.0
|
||||
data['amount_tax']=payment.amount_tax or 0.0
|
||||
data['amount_total']=payment.amount_total or 0.0
|
||||
|
||||
return data
|
||||
|
||||
HDCase.register()
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue