fix: set warehouse from defalut_warehouse_for_sales_return in sales return

This commit is contained in:
Sahil Khan
2019-02-26 14:50:20 +05:30
parent 539c77c591
commit 88bd0674ed
2 changed files with 2959 additions and 2919 deletions

View File

@@ -200,11 +200,14 @@ def get_already_returned_items(doc):
def make_return_doc(doctype, source_name, target_doc=None):
from frappe.model.mapper import get_mapped_doc
company = frappe.db.get_value("Delivery Note", source_name, "company")
default_warehouse_for_sales_return = frappe.db.get_value("Company", company, "default_warehouse_for_sales_return")
def set_missing_values(source, target):
doc = frappe.get_doc(target)
doc.is_return = 1
doc.return_against = source.name
doc.ignore_pricing_rule = 1
doc.set_warehouse = ""
if doctype == "Sales Invoice":
doc.is_pos = source.is_pos
@@ -268,12 +271,16 @@ def make_return_doc(doctype, source_name, target_doc=None):
target_doc.so_detail = source_doc.so_detail
target_doc.si_detail = source_doc.si_detail
target_doc.expense_account = source_doc.expense_account
if default_warehouse_for_sales_return:
target_doc.warehouse = default_warehouse_for_sales_return
elif doctype == "Sales Invoice":
target_doc.sales_order = source_doc.sales_order
target_doc.delivery_note = source_doc.delivery_note
target_doc.so_detail = source_doc.so_detail
target_doc.dn_detail = source_doc.dn_detail
target_doc.expense_account = source_doc.expense_account
if default_warehouse_for_sales_return:
target_doc.warehouse = default_warehouse_for_sales_return
def update_terms(source_doc, target_doc, source_parent):
target_doc.payment_amount = -source_doc.payment_amount

File diff suppressed because it is too large Load Diff