feat: additional customer fileds
add customer_group, price list, currency etc. rearrange and group fields disable cusotmer edit after save (temp fix)
This commit is contained in:
parent
17ab1592c7
commit
d4f5a6928f
@ -40,6 +40,7 @@ frappe.ui.form.on('Patient', {
|
||||
frm.add_custom_button(__('Patient Encounter'), function () {
|
||||
create_encounter(frm);
|
||||
}, 'Create');
|
||||
frm.toggle_enable(['customer'], 0); // ToDo, allow change only if no transactions booked or better, add merge option
|
||||
}
|
||||
},
|
||||
onload: function (frm) {
|
||||
|
@ -24,13 +24,20 @@
|
||||
"image",
|
||||
"column_break_14",
|
||||
"status",
|
||||
"inpatient_status",
|
||||
"inpatient_record",
|
||||
"customer",
|
||||
"inpatient_status",
|
||||
"report_preference",
|
||||
"mobile",
|
||||
"email",
|
||||
"phone",
|
||||
"report_preference",
|
||||
"customer_details_section",
|
||||
"customer",
|
||||
"customer_group",
|
||||
"territory",
|
||||
"column_break_24",
|
||||
"default_currency",
|
||||
"default_price_list",
|
||||
"language",
|
||||
"personal_and_social_history",
|
||||
"occupation",
|
||||
"column_break_25",
|
||||
@ -52,9 +59,7 @@
|
||||
"surrounding_factors",
|
||||
"other_risk_factors",
|
||||
"more_info",
|
||||
"patient_details",
|
||||
"ac_sb",
|
||||
"default_currency"
|
||||
"patient_details"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@ -156,6 +161,7 @@
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_preview": 1,
|
||||
"label": "Customer",
|
||||
"options": "Customer"
|
||||
},
|
||||
@ -171,7 +177,8 @@
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Mobile"
|
||||
"label": "Mobile",
|
||||
"options": "Phone"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
@ -186,7 +193,8 @@
|
||||
"fieldname": "phone",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Phone"
|
||||
"label": "Phone",
|
||||
"options": "Phone"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
@ -268,25 +276,25 @@
|
||||
"fieldname": "tobacco_past_use",
|
||||
"fieldtype": "Data",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Tobacco Consumption Habbits (Past)"
|
||||
"label": "Tobacco Consumption (Past)"
|
||||
},
|
||||
{
|
||||
"fieldname": "tobacco_current_use",
|
||||
"fieldtype": "Data",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Tobacco Consumption Habbits (Present)"
|
||||
"label": "Tobacco Consumption (Present)"
|
||||
},
|
||||
{
|
||||
"fieldname": "alcohol_past_use",
|
||||
"fieldtype": "Data",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Alcohol Consumption Habbits (Past)"
|
||||
"label": "Alcohol Consumption (Past)"
|
||||
},
|
||||
{
|
||||
"fieldname": "alcohol_current_use",
|
||||
"fieldtype": "Data",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Alcohol Consumption Habbits (Present)"
|
||||
"label": "Alcohol Consumption (Present)"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_32",
|
||||
@ -320,20 +328,11 @@
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Patient Details"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "ac_sb",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Account Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "default_currency",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Default Currency",
|
||||
"options": "Currency",
|
||||
"print_hide": 1
|
||||
"label": "Billing Currency",
|
||||
"options": "Currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "last_name",
|
||||
@ -351,13 +350,47 @@
|
||||
"fieldname": "middle_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Middle Name (optional)"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "customer_details_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Customer Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "customer_group",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer Group",
|
||||
"options": "Customer Group"
|
||||
},
|
||||
{
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"label": "Territory",
|
||||
"options": "Territory"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_24",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "default_price_list",
|
||||
"fieldtype": "Link",
|
||||
"label": "Default Price List",
|
||||
"options": "Price List"
|
||||
},
|
||||
{
|
||||
"fieldname": "language",
|
||||
"fieldtype": "Link",
|
||||
"label": "Print Language",
|
||||
"options": "Language"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-user",
|
||||
"image_field": "image",
|
||||
"links": [],
|
||||
"max_attachments": 50,
|
||||
"modified": "2020-04-06 12:55:30.807744",
|
||||
"modified": "2020-04-11 14:53:48.767245",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Patient",
|
||||
|
@ -26,6 +26,7 @@ class Patient(Document):
|
||||
frappe.db.set_value('Patient', self.name, 'status', 'Disabled')
|
||||
else:
|
||||
send_registration_sms(self)
|
||||
self.reload() # self.notify_update()
|
||||
|
||||
def set_full_name(self):
|
||||
if self.last_name:
|
||||
@ -86,8 +87,8 @@ class Patient(Document):
|
||||
return {'invoice': sales_invoice.name}
|
||||
|
||||
def create_customer(doc):
|
||||
customer_group = frappe.db.get_single_value('Selling Settings', 'customer_group')
|
||||
territory = frappe.db.get_single_value('Selling Settings', 'territory')
|
||||
customer_group = doc.customer_group or frappe.db.get_single_value('Selling Settings', 'customer_group')
|
||||
territory = doc.territory or frappe.db.get_single_value('Selling Settings', 'territory')
|
||||
if not (customer_group and territory):
|
||||
customer_group = get_root_of('Customer Group')
|
||||
territory = get_root_of('Territory')
|
||||
@ -98,7 +99,10 @@ def create_customer(doc):
|
||||
'customer_name': doc.patient_name,
|
||||
'customer_group': customer_group,
|
||||
'territory' : territory,
|
||||
'customer_type': 'Individual'
|
||||
'customer_type': 'Individual',
|
||||
'default_currency': doc.default_currency,
|
||||
'default_price_ist': doc.default_price_list,
|
||||
'language': doc.language
|
||||
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
|
||||
frappe.db.set_value('Patient', doc.name, 'customer', customer.name)
|
||||
|
Loading…
Reference in New Issue
Block a user