Skip to content

Commit

Permalink
feat: mandatory and mandatory depends on in inventory dimension
Browse files Browse the repository at this point in the history
(cherry picked from commit 423f2b5)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Jan 31, 2023
1 parent f487eae commit 3aca84c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ frappe.ui.form.on('Inventory Dimension', {
if (frm.doc.__onload && frm.doc.__onload.has_stock_ledger
&& frm.doc.__onload.has_stock_ledger.length) {
let allow_to_edit_fields = ['disabled', 'fetch_from_parent',
'type_of_transaction', 'condition'];
'type_of_transaction', 'condition', 'mandatory_depends_on'];

frm.fields.forEach((field) => {
if (!in_list(allow_to_edit_fields, field.df.fieldname)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"istable",
"applicable_condition_example_section",
"condition",
"conditional_mandatory_section",
"reqd",
"mandatory_depends_on",
"conditional_rule_examples_section",
"html_19"
],
Expand Down Expand Up @@ -153,11 +156,28 @@
"fieldname": "conditional_rule_examples_section",
"fieldtype": "Section Break",
"label": "Conditional Rule Examples"
},
{
"description": "To apply condition on parent field use parent.field_name and to apply condition on child table use doc.field_name. Here field_name could be based on the actual column name of the respective field.",
"fieldname": "mandatory_depends_on",
"fieldtype": "Small Text",
"label": "Mandatory Depends On"
},
{
"fieldname": "conditional_mandatory_section",
"fieldtype": "Section Break",
"label": "Mandatory Section"
},
{
"default": "0",
"fieldname": "reqd",
"fieldtype": "Check",
"label": "Mandatory"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-11-15 15:50:16.767105",
"modified": "2023-01-31 13:44:38.507698",
"modified_by": "Administrator",
"module": "Stock",
"name": "Inventory Dimension",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def add_custom_fields(self):
insert_after="inventory_dimension",
options=self.reference_document,
label=self.dimension_name,
reqd=self.reqd,
mandatory_depends_on=self.mandatory_depends_on,
),
]

Expand All @@ -142,6 +144,8 @@ def add_custom_fields(self):
"Custom Field", {"dt": "Stock Ledger Entry", "fieldname": self.target_fieldname}
) and not field_exists("Stock Ledger Entry", self.target_fieldname):
dimension_field = dimension_fields[1]
dimension_field["mandatory_depends_on"] = ""
dimension_field["reqd"] = 0
dimension_field["fieldname"] = self.target_fieldname
custom_fields["Stock Ledger Entry"] = dimension_field

Expand Down

0 comments on commit 3aca84c

Please sign in to comment.