diff --git a/netforce_clinic/actions/clinic_import_uc.xml b/netforce_clinic/actions/clinic_import_uc.xml
new file mode 100644
index 0000000..7370f5d
--- /dev/null
+++ b/netforce_clinic/actions/clinic_import_uc.xml
@@ -0,0 +1,6 @@
+
+ Import Payment
+ form_popup
+ clinic.import.uc
+ _popup
+
diff --git a/netforce_clinic/layouts/clinic_contact_form.xml b/netforce_clinic/layouts/clinic_contact_form.xml
index 4036cd6..d03bd6f 100644
--- a/netforce_clinic/layouts/clinic_contact_form.xml
+++ b/netforce_clinic/layouts/clinic_contact_form.xml
@@ -6,5 +6,6 @@
+
diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 1eb3fef..2acd0ac 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -120,7 +120,6 @@
-
diff --git a/netforce_clinic/layouts/clinic_import_payment_form.xml b/netforce_clinic/layouts/clinic_import_payment_form.xml
new file mode 100644
index 0000000..3b0f39d
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_import_payment_form.xml
@@ -0,0 +1,5 @@
+
+ -
+
+
+
diff --git a/netforce_clinic/layouts/clinic_import_uc_form.xml b/netforce_clinic/layouts/clinic_import_uc_form.xml
new file mode 100644
index 0000000..f16fc45
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_import_uc_form.xml
@@ -0,0 +1,8 @@
+
diff --git a/netforce_clinic/layouts/clinic_menu_inherit.xml b/netforce_clinic/layouts/clinic_menu_inherit.xml
index 263dabf..e5b2fae 100644
--- a/netforce_clinic/layouts/clinic_menu_inherit.xml
+++ b/netforce_clinic/layouts/clinic_menu_inherit.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml
index b3d635f..3ee368d 100644
--- a/netforce_clinic/layouts/clinic_setting.xml
+++ b/netforce_clinic/layouts/clinic_setting.xml
@@ -74,6 +74,7 @@
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index f1ac2e1..12a0fbb 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -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
diff --git a/netforce_clinic/models/account_payment.py b/netforce_clinic/models/account_payment.py
index ad53ea9..ef8a4be 100644
--- a/netforce_clinic/models/account_payment.py
+++ b/netforce_clinic/models/account_payment.py
@@ -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()
diff --git a/netforce_clinic/models/import_uc.py b/netforce_clinic/models/import_uc.py
new file mode 100644
index 0000000..ab87ed0
--- /dev/null
+++ b/netforce_clinic/models/import_uc.py
@@ -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()
+
diff --git a/netforce_clinic/models/partner.py b/netforce_clinic/models/partner.py
index df2ad0d..051d516 100644
--- a/netforce_clinic/models/partner.py
+++ b/netforce_clinic/models/partner.py
@@ -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()
diff --git a/netforce_clinic/models/report_payment_matching.py b/netforce_clinic/models/report_payment_matching.py
index 95cd311..499c389 100644
--- a/netforce_clinic/models/report_payment_matching.py
+++ b/netforce_clinic/models/report_payment_matching.py
@@ -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
diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py
index dc57e39..69ef394 100644
--- a/netforce_clinic/models/setting.py
+++ b/netforce_clinic/models/setting.py
@@ -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