Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
877125c135
@ -107,7 +107,7 @@ class DocType:
|
||||
_(" does not belong to the company") + ": " + self.doc.company)
|
||||
|
||||
def check_negative_balance(account, adv_adj=False):
|
||||
if not adv_adj:
|
||||
if not adv_adj and account:
|
||||
account_details = webnotes.conn.get_value("Account", account,
|
||||
["allow_negative_balance", "debit_or_credit"], as_dict=True)
|
||||
if not account_details["allow_negative_balance"]:
|
||||
|
40
patches/october_2013/p01_fix_serial_no_status.py
Normal file
40
patches/october_2013/p01_fix_serial_no_status.py
Normal file
@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
|
||||
def execute():
|
||||
serial_nos = webnotes.conn.sql("""select name, item_code, status from `tabSerial No`
|
||||
where status!='Not in Use'""", as_dict=1)
|
||||
for sr in serial_nos:
|
||||
last_sle = webnotes.conn.sql("""select voucher_type, voucher_no, actual_qty
|
||||
from `tabStock Ledger Entry` where serial_no like %s and item_code=%s
|
||||
order by name desc limit 1""",
|
||||
("%%%s%%" % sr.name, sr.item_code), as_dict=1)
|
||||
|
||||
if flt(last_sle[0].actual_qty) > 0:
|
||||
if last_sle[0].voucher_type == "Stock Entry" and webnotes.conn.get_value("Stock Entry",
|
||||
last_sle[0].voucher_no, "purpose") == "Sales Return":
|
||||
status = "Sales Returned"
|
||||
else:
|
||||
status = "Available"
|
||||
else:
|
||||
if last_sle[0].voucher_type == "Stock Entry":
|
||||
purpose = webnotes.conn.get_value("Stock Entry", last_sle[0].voucher_no, "purpose")
|
||||
if purpose == "Purchase Return":
|
||||
status = "Purchase Returned"
|
||||
else:
|
||||
status = "Not Available"
|
||||
else:
|
||||
status = "Delivered"
|
||||
if sr.status != status:
|
||||
webnotes.conn.sql("""update `tabSerial No` set status=%s where name=%s""",
|
||||
(status, sr.name))
|
||||
|
||||
webnotes.conn.sql("""update `tabSerial No` set warehouse=''
|
||||
where status in ('Delivered', 'Purchase Returned')""")
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ def get_item_details(args):
|
||||
out.update(apply_pos_settings(pos_settings, out))
|
||||
|
||||
if args.doctype in ("Sales Invoice", "Delivery Note"):
|
||||
if item_bean.doc.has_serial_no and not args.serial_no:
|
||||
if item_bean.doc.has_serial_no == "Yes" and not args.serial_no:
|
||||
out.serial_no = _get_serial_nos_by_fifo(args, item_bean)
|
||||
|
||||
return out
|
||||
|
@ -166,7 +166,7 @@ class DocType(DocListController):
|
||||
serial_nos.append(self.make_serial_no(make_autoname(item_det.serial_no_series)))
|
||||
self.doc.serial_no = "\n".join(serial_nos)
|
||||
else:
|
||||
webnotes.throw(_("Serial Number Required for Serialized Item" + ": " + self.doc.item),
|
||||
webnotes.throw(_("Serial Number Required for Serialized Item" + ": " + self.doc.item_code),
|
||||
SerialNoRequiredError)
|
||||
|
||||
def make_serial_no(self, serial_no):
|
||||
|
Loading…
x
Reference in New Issue
Block a user