[fix] Auto serial no fecthed on the invoice even if stock update is disabled issue
This commit is contained in:
parent
ed019123e2
commit
dc981dc546
@ -192,10 +192,12 @@ class AccountsController(TransactionBase):
|
||||
if (item.get(fieldname) is None or fieldname in force_item_fields):
|
||||
item.set(fieldname, value)
|
||||
|
||||
elif fieldname == "cost_center" and not item.get("cost_center"):
|
||||
elif fieldname in ['cost_center', 'conversion_factor'] and not item.get(fieldname):
|
||||
item.set(fieldname, value)
|
||||
|
||||
elif fieldname == "conversion_factor" and not item.get("conversion_factor"):
|
||||
elif fieldname == "serial_no":
|
||||
stock_qty = item.get("stock_qty") * -1 if item.get("stock_qty") < 0 else item.get("stock_qty")
|
||||
if stock_qty != len(item.get('serial_no').split('\n')):
|
||||
item.set(fieldname, value)
|
||||
|
||||
if ret.get("pricing_rule"):
|
||||
|
@ -386,3 +386,4 @@ execute:frappe.delete_doc('DocType', 'Purchase Common')
|
||||
erpnext.patches.v8_0.update_stock_qty_value_in_purchase_invoice
|
||||
erpnext.patches.v8_0.update_supplier_address_in_stock_entry
|
||||
erpnext.patches.v8_0.rename_is_sample_item_to_allow_zero_valuation_rate
|
||||
erpnext.patches.v8_0.set_null_to_serial_nos_for_disabled_sales_invoices
|
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("""
|
||||
update
|
||||
`tabSales Invoice Item`
|
||||
set serial_no = NULL
|
||||
where
|
||||
parent in (select name from `tabSales Invoice` where update_stock = 0 and docstatus = 1)""")
|
@ -260,6 +260,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
customer: me.frm.doc.customer,
|
||||
supplier: me.frm.doc.supplier,
|
||||
currency: me.frm.doc.currency,
|
||||
update_stock: in_list(['Sales Invoice', 'Purchase Invoice'], me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
|
||||
conversion_rate: me.frm.doc.conversion_rate,
|
||||
price_list: me.frm.doc.selling_price_list ||
|
||||
me.frm.doc.buying_price_list,
|
||||
@ -275,7 +276,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
name: me.frm.doc.name,
|
||||
project: item.project || me.frm.doc.project,
|
||||
qty: item.qty,
|
||||
stock_qty: item.stock_qty
|
||||
stock_qty: item.stock_qty,
|
||||
conversion_factor: item.conversion_factor
|
||||
}
|
||||
},
|
||||
|
||||
@ -762,7 +764,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
"ignore_pricing_rule": me.frm.doc.ignore_pricing_rule,
|
||||
"doctype": me.frm.doc.doctype,
|
||||
"name": me.frm.doc.name,
|
||||
"is_return": cint(me.frm.doc.is_return)
|
||||
"is_return": cint(me.frm.doc.is_return),
|
||||
"update_stock": in_list(['Sales Invoice', 'Purchase Invoice'], me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
@ -781,7 +784,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
"parent": d.parent,
|
||||
"pricing_rule": d.pricing_rule,
|
||||
"warehouse": d.warehouse,
|
||||
"serial_no": d.serial_no
|
||||
"serial_no": d.serial_no,
|
||||
"conversion_factor": d.conversion_factor
|
||||
});
|
||||
|
||||
// if doctype is Quotation Item / Sales Order Iten then add Margin Type and rate in item_list
|
||||
|
@ -161,7 +161,7 @@ def get_basic_details(args, item):
|
||||
"min_order_qty": flt(item.min_order_qty) if args.doctype == "Material Request" else "",
|
||||
"conversion_factor": 1.0,
|
||||
"qty": args.qty or 1.0,
|
||||
"stock_qty": 1.0,
|
||||
"stock_qty": args.qty or 1.0,
|
||||
"price_list_rate": 0.0,
|
||||
"base_price_list_rate": 0.0,
|
||||
"rate": 0.0,
|
||||
@ -172,10 +172,18 @@ def get_basic_details(args, item):
|
||||
"net_amount": 0.0,
|
||||
"discount_percentage": 0.0,
|
||||
"supplier": item.default_supplier,
|
||||
"update_stock": args.get("update_stock") if args.get('doctype') in ['Sales Invoice', 'Purchase Invoice'] else 0,
|
||||
"delivered_by_supplier": item.delivered_by_supplier if args.get("doctype") in ["Sales Order", "Sales Invoice"] else 0,
|
||||
"is_fixed_asset": item.is_fixed_asset
|
||||
})
|
||||
|
||||
# calculate conversion factor
|
||||
conversion_factor = args.get("conversion_factor") or get_conversion_factor(item.item_code, args.uom).get("conversion_factor") or 1.0
|
||||
out.update({
|
||||
"conversion_factor": conversion_factor,
|
||||
"stock_qty": out.qty * conversion_factor
|
||||
})
|
||||
|
||||
# if default specified in item is for another company, fetch from company
|
||||
for d in [["Account", "income_account", "default_income_account"],
|
||||
["Account", "expense_account", "default_expense_account"],
|
||||
@ -532,6 +540,9 @@ def get_serial_no(args):
|
||||
args = json.loads(args)
|
||||
args = frappe._dict(args)
|
||||
|
||||
if args.get('doctype') == 'Sales Invoice' and not args.get('update_stock'):
|
||||
return ""
|
||||
|
||||
if args.get('warehouse') and args.get('stock_qty') and args.get('item_code'):
|
||||
|
||||
if frappe.get_value('Item', {'item_code': args.item_code}, "has_serial_no") == 1:
|
||||
|
Loading…
Reference in New Issue
Block a user