pop import payment

conv_bal
watcha.h@almacom.co.th 2014-12-22 01:00:54 +07:00
parent 75e28cbe9f
commit e7de1c88a5
13 changed files with 87 additions and 5 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Import Payment</field>
<field name="view_cls">form_popup</field>
<field name="model">clinic.import.uc</field>
<field name="target">_popup</field>
</action>

View File

@ -6,5 +6,6 @@
<field name="account_mdc_id" attrs='{"required":[["type","=","org"]]}'/>
<field name="account_service_id" attrs='{"required":[["type","=","org"]]}'/>
<field name="account_payment_id" attrs='{"required":[["type","=","org"]]}'/>
<field name="account_income_id" attrs='{"required":[["type","=","org"]]}'/>
</field>
</inherit>

View File

@ -120,7 +120,6 @@
<button string="Discard" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
<button string="Claim Expense" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible":[["req_fee","=",1]]}'/>
<button string="Pay" type="success" icon="ok" method="pay" states="completed" attrs='{"invisible":[["req_fee","=",0]]}'/>
</foot>
<related>
<field name="invoices" click_action="view_invoice">

View File

@ -0,0 +1,5 @@
<inherit model="account.payment" inherit="payment_form">
<item string="Copy" position="after">
<item string="Import Payment (UC)" method="import_payment"/>
</item>
</inherit>

View File

@ -0,0 +1,8 @@
<form model="clinic.import.uc">
<field name="payment_id" invisible="1"/>
<field name="file" span="6"/>
<field name="type_id" span="6"/>
<foot>
<button string="Import" type="primary" icon="arrow-right" method="do_import"/>
</foot>
</form>

View File

@ -4,9 +4,9 @@
<item string="Labor Cost" action="clinic_labor_cost"/>
<item string="Labor Cost Items" action="clinic_labor_cost_item"/>
<item string="Labor Cost Entries" action="clinic_labor_cost_entry"/>
<item string="Import Payment" action="import_clinic_payment"/>
<item string="Matching Invoice" action="clinic_report_payment_matching"/>
<item string="HD Case Expense" action="clinic_hd_case_expense"/>
<!--<item string="Import Payment" action="import_clinic_payment"/>-->
<item string="Matching Invoices" action="clinic_report_payment_matching"/>
<item string="HD Case Expenses" action="clinic_hd_case_expense"/>
<divider/>
<header string="REPORTS"/>
<item string="Staff Fee Summary" action="clinic_report_staff_fee_sum"/>

View File

@ -74,6 +74,7 @@
</tab>
<tab string="Importing">
<field name="patient_type_id"/>
<field name="imp_patient_type_id"/>
</tab>
<tab string="Dialyzer">
<field name="stock_journal_id"/>

View File

@ -82,3 +82,4 @@ from . import labor_cost_entry
from . import labor_cost_entry_line
from . import sickbed
from . import product_categ
from . import import_uc

View File

@ -21,4 +21,15 @@ class AccountPayment(Model):
},
}
def import_payment(self,ids,context={}):
if not ids:
raise Exception("Please save payment before import")
print("xx ", ids)
return {
'next': {
'name': 'clinic_import_uc',
'refer_id': ids[0], #XXX
}
}
AccountPayment.register()

View File

@ -0,0 +1,41 @@
from netforce.model import Model, fields, get_model
class ImportUC(Model):
_name="clinic.import.uc"
_transient=True
_fields={
"payment_id": fields.Many2One("account.payment","Payment",required=True,on_delete="cascade"),
"file": fields.File("File", required=True),
'type_id': fields.Many2One("clinic.patient.type","Type", required=True),
}
def _get_payment_id(self,context={}):
payment_id=context.get("refer_id")
if not payment_id:
return None
return int(payment_id)
def _get_type(self,context={}):
st=get_model("clinic.setting").browse(1)
return st.imp_patient_type_id.id
_defaults={
'payment_id': _get_payment_id,
'type_id': _get_type,
}
def do_import(self,ids,context):
obj=self.browse(ids)[0]
return {
'next': {
'name': 'payment',
'mode': 'form',
'active_id': obj.payment_id.id,
},
'flash': 'Import successfully',
}
ImportUC.register()

View File

@ -8,6 +8,7 @@ class Partner(Model):
"account_fee_id": fields.Many2One("account.account","Account Receiveable Fee",multi_company=True),
"account_service_id": fields.Many2One("account.account","Account Receiveable Service",multi_company=True),
"account_payment_id": fields.Many2One("account.account","Account Payment",multi_company=True),
"account_income_id": fields.Many2One("account.account","Account Income",multi_company=True),
}
Partner.register()

View File

@ -164,6 +164,10 @@ class ReportPaymentMatching(Model):
'invno': invno,
'state': 'match',
})
for inv in exp.invoices:
inv.write({
'ref': invno,
})
match_qty+=1
else:
unmatch_qty+=1
@ -193,6 +197,10 @@ class ReportPaymentMatching(Model):
'invno': invno,
'state': 'match',
})
for inv in exp.invoices:
inv.write({
'ref': invno,
})
match_qty+=1
else:
unmatch_qty+=1

View File

@ -6,7 +6,6 @@ class ClinicSetting(Model):
_name="clinic.setting"
_string="Setting"
_fields={
"var_k": fields.Float("K"),
'file': fields.File("File"),
@ -19,6 +18,7 @@ class ClinicSetting(Model):
'waiting_approval': fields.Boolean("Waiting Approval"), # HD Case
'real_time': fields.Boolean("Real Time"), # HD Case
'patient_type_id': fields.Many2One("clinic.patient.type","Default Type"), # Import payment
'imp_patient_type_id': fields.Many2One("clinic.patient.type","Import UC Type"), # Import payment
'find_dlz': fields.Boolean("Find Dialyzer After Confirm Visit"), # Visit
'stock_journal_id': fields.Many2One("stock.journal","Default Journal"),
'auto_gen': fields.Boolean("Auto Gen") # HD Case