fix: Allow zero valuation in stock reconciliation

Stock reconciliation can not be done for customer provided item as they
have zero valuation. This change adds a checkbox in item table to allow
such items.

Related issue: ISS-20-21-10248
This commit is contained in:
Ankush Menat 2021-03-15 19:10:54 +05:30
parent 4ccda9f799
commit 6a534ea82b
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF
2 changed files with 15 additions and 4 deletions

View File

@ -31,6 +31,7 @@ class StockReconciliation(StockController):
self.validate_expense_account()
self.set_total_qty_and_amount()
self.validate_putaway_capacity()
self.validate_customer_provided_item()
if self._action=="submit":
self.make_batches('warehouse')
@ -217,7 +218,7 @@ class StockReconciliation(StockController):
if row.valuation_rate in ("", None):
row.valuation_rate = previous_sle.get("valuation_rate", 0)
if row.qty and not row.valuation_rate:
if row.qty and not row.valuation_rate and not row.allow_zero_valuation_rate:
frappe.throw(_("Valuation Rate required for Item {0} at row {1}").format(row.item_code, row.idx))
if ((previous_sle and row.qty == previous_sle.get("qty_after_transaction")
@ -531,4 +532,4 @@ def get_difference_account(purpose, company):
account = frappe.db.get_value('Account', {'is_group': 0,
'company': company, 'account_type': 'Temporary'}, 'name')
return account
return account

View File

@ -13,6 +13,7 @@
"qty",
"valuation_rate",
"amount",
"allow_zero_valuation_rate",
"serial_no_and_batch_section",
"serial_no",
"column_break_11",
@ -166,10 +167,19 @@
"fieldtype": "Link",
"label": "Batch No",
"options": "Batch"
},
{
"default": "0",
"fieldname": "allow_zero_valuation_rate",
"fieldtype": "Check",
"label": "Allow Zero Valuation Rate",
"print_hide": 1,
"read_only": 1
}
],
"istable": 1,
"modified": "2019-06-14 17:10:53.188305",
"links": [],
"modified": "2021-03-23 11:09:44.407157",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reconciliation Item",
@ -179,4 +189,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
}