Merge pull request #5823 from nabinhait/fix_107
Update opening stock on creation if item, only if it is non-serialized and does maintain batch
This commit is contained in:
commit
db4aca3eaf
@ -11,6 +11,7 @@
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@ -305,7 +306,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval:(doc.__islocal&&doc.is_stock_item)",
|
||||
"depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
|
||||
"fieldname": "opening_stock",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
@ -331,7 +332,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval:(doc.__islocal && doc.is_stock_item && doc.opening_stock)",
|
||||
"depends_on": "eval:(doc.__islocal && doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no && doc.opening_stock)",
|
||||
"fieldname": "valuation_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
@ -2307,7 +2308,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"modified": "2016-07-06 17:00:45.561349",
|
||||
"modified": "2016-07-21 18:44:10.230372",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item",
|
||||
|
@ -118,6 +118,9 @@ class Item(WebsiteGenerator):
|
||||
|
||||
def set_opening_stock(self):
|
||||
'''set opening stock'''
|
||||
if not self.is_stock_item or self.has_serial_no or self.has_batch_no:
|
||||
return
|
||||
|
||||
if not self.valuation_rate:
|
||||
frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user