Merge pull request #4642 from nabinhait/return_fix1
[fix] Accept return items in any warehouse
This commit is contained in:
commit
5b19aeecb4
@ -96,6 +96,9 @@ def validate_returned_items(doc):
|
|||||||
if s not in ref_serial_nos:
|
if s not in ref_serial_nos:
|
||||||
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
|
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
|
||||||
.format(d.idx, s, doc.doctype, doc.return_against))
|
.format(d.idx, s, doc.doctype, doc.return_against))
|
||||||
|
|
||||||
|
if not d.warehouse:
|
||||||
|
frappe.throw(_("Warehouse is mandatory"))
|
||||||
|
|
||||||
items_returned = True
|
items_returned = True
|
||||||
|
|
||||||
|
@ -218,14 +218,14 @@ class StockController(AccountsController):
|
|||||||
|
|
||||||
return serialized_items
|
return serialized_items
|
||||||
|
|
||||||
def get_incoming_rate_for_sales_return(self, item_code, warehouse, against_document):
|
def get_incoming_rate_for_sales_return(self, item_code, against_document):
|
||||||
incoming_rate = 0.0
|
incoming_rate = 0.0
|
||||||
if against_document and item_code:
|
if against_document and item_code:
|
||||||
incoming_rate = frappe.db.sql("""select abs(stock_value_difference / actual_qty)
|
incoming_rate = frappe.db.sql("""select abs(stock_value_difference / actual_qty)
|
||||||
from `tabStock Ledger Entry`
|
from `tabStock Ledger Entry`
|
||||||
where voucher_type = %s and voucher_no = %s
|
where voucher_type = %s and voucher_no = %s
|
||||||
and item_code = %s and warehouse=%s limit 1""",
|
and item_code = %s limit 1""",
|
||||||
(self.doctype, against_document, item_code, warehouse))
|
(self.doctype, against_document, item_code))
|
||||||
incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0
|
incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0
|
||||||
|
|
||||||
return incoming_rate
|
return incoming_rate
|
||||||
@ -257,8 +257,7 @@ class StockController(AccountsController):
|
|||||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 and flt(d.qty):
|
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 and flt(d.qty):
|
||||||
return_rate = 0
|
return_rate = 0
|
||||||
if cint(self.is_return) and self.return_against and self.docstatus==1:
|
if cint(self.is_return) and self.return_against and self.docstatus==1:
|
||||||
return_rate = self.get_incoming_rate_for_sales_return(d.item_code,
|
return_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against)
|
||||||
d.warehouse, self.return_against)
|
|
||||||
|
|
||||||
# On cancellation or if return entry submission, make stock ledger entry for
|
# On cancellation or if return entry submission, make stock ledger entry for
|
||||||
# target warehouse first, to update serial no values properly
|
# target warehouse first, to update serial no values properly
|
||||||
|
Loading…
Reference in New Issue
Block a user