Skip to content

Commit

Permalink
fix:Medication - field changes
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad committed Aug 25, 2020
1 parent acbc607 commit 2fbbe56
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
53 changes: 26 additions & 27 deletions erpnext/healthcare/doctype/medication/medication.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"medication_name",
"generic_name",
"medication_class",
"generic_ok",
"is_generic",
"column_break_4",
"status",
"disabled",
"strength",
"strength_uom",
"abbr",
Expand All @@ -22,12 +22,10 @@
"item_code",
"item_group",
"description",
"stock_uom",
"column_break_14",
"disabled",
"is_billable",
"rate",
"maintain_stock",
"opening_stock",
"defaults_section",
"default_dosage_form",
"default_prescription_dosage",
Expand All @@ -52,18 +50,21 @@
{
"fieldname": "national_drug_code",
"fieldtype": "Data",
"label": "National Drug Code"
"label": "National Drug Code",
"no_copy": 1
},
{
"fieldname": "medication_name",
"fieldtype": "Data",
"label": "Medication Name",
"no_copy": 1,
"reqd": 1
},
{
"fieldname": "generic_name",
"fieldtype": "Data",
"label": "Generic Name"
"label": "Generic Name",
"no_copy": 1
},
{
"fieldname": "medication_class",
Expand All @@ -80,6 +81,7 @@
"fieldname": "strength",
"fieldtype": "Float",
"label": "Strength",
"no_copy": 1,
"precision": "2",
"set_only_once": 1
},
Expand All @@ -99,6 +101,7 @@
"fieldname": "item",
"fieldtype": "Link",
"label": "Item",
"no_copy": 1,
"options": "Item",
"read_only": 1
},
Expand Down Expand Up @@ -140,18 +143,6 @@
"label": "Default Interval UOM",
"options": "Hour\nDay"
},
{
"default": "0",
"fieldname": "generic_ok",
"fieldtype": "Check",
"label": "Generic OK"
},
{
"fieldname": "status",
"fieldtype": "Select",
"label": "Status",
"options": "Active\nInactive"
},
{
"fieldname": "reference_url",
"fieldtype": "HTML Editor",
Expand Down Expand Up @@ -220,20 +211,23 @@
"fieldname": "item_code",
"fieldtype": "Data",
"label": "Item Code",
"no_copy": 1,
"reqd": 1
},
{
"fieldname": "item_group",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Item Group",
"no_copy": 1,
"options": "Item Group",
"reqd": 1
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description",
"no_copy": 1,
"reqd": 1
},
{
Expand All @@ -247,12 +241,14 @@
"label": "Disabled"
},
{
"allow_in_quick_entry": 1,
"default": "0",
"fieldname": "is_billable",
"fieldtype": "Check",
"label": "Is Billable"
},
{
"allow_in_quick_entry": 1,
"depends_on": "is_billable",
"fieldname": "rate",
"fieldtype": "Float",
Expand All @@ -275,19 +271,22 @@
"fieldtype": "Section Break"
},
{
"default": "1",
"fieldname": "maintain_stock",
"fieldtype": "Check",
"label": "Maintain Stock"
"fieldname": "stock_uom",
"fieldtype": "Link",
"label": "Stock UOM",
"no_copy": 1,
"options": "UOM",
"reqd": 1
},
{
"fieldname": "opening_stock",
"fieldtype": "Float",
"label": "Opening Stock"
"default": "0",
"fieldname": "is_generic",
"fieldtype": "Check",
"label": "Is Generic"
}
],
"links": [],
"modified": "2020-08-18 12:56:16.022461",
"modified": "2020-08-19 12:37:31.556074",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Medication",
Expand Down
3 changes: 2 additions & 1 deletion erpnext/healthcare/doctype/medication/medication.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def update_item_and_item_price(self):
item_doc.item_name = self.medication_name
item_doc.item_group = self.item_group
item_doc.description = self.description
item_doc.stock_uom = self.stock_uom
item_doc.disabled = 0
item_doc.save(ignore_permissions=True)

Expand All @@ -51,7 +52,7 @@ def create_item_from_medication(doc):
if doc.is_billable and not doc.disabled:
disabled = 0

uom = frappe.db.exists('UOM', 'Unit') or frappe.db.get_single_value('Stock Settings', 'stock_uom')
uom = doc.stock_uom or frappe.db.get_single_value('Stock Settings', 'stock_uom')
item = frappe.get_doc({
'doctype': 'Item',
'item_code': doc.medication_name,
Expand Down

0 comments on commit 2fbbe56

Please sign in to comment.