Merge pull request #4407 from nabinhait/develop

[fix] Mapping allowed for negative quantity
This commit is contained in:
Rushabh Mehta 2015-12-02 12:24:49 +05:30
commit 4a1b9ac793
4 changed files with 6 additions and 7 deletions

View File

@ -8,7 +8,6 @@ from frappe.utils import cstr, flt
from frappe import msgprint, _, throw
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
from frappe.desk.notifications import clear_doctype_notifications
@ -282,7 +281,7 @@ def make_purchase_receipt(source_name, target_doc=None):
"parenttype": "prevdoc_doctype",
},
"postprocess": update_item,
"condition": lambda doc: doc.received_qty < doc.qty and doc.delivered_by_supplier!=1
"condition": lambda doc: abs(doc.received_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1
},
"Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",
@ -318,7 +317,7 @@ def make_purchase_invoice(source_name, target_doc=None):
"parent": "purchase_order",
},
"postprocess": update_item,
"condition": lambda doc: (doc.base_amount==0 or doc.billed_amt < doc.amount)
"condition": lambda doc: (doc.base_amount==0 or abs(doc.billed_amt) < abs(doc.amount))
},
"Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",

View File

@ -384,7 +384,7 @@ def make_delivery_note(source_name, target_doc=None):
"parent": "against_sales_order",
},
"postprocess": update_item,
"condition": lambda doc: doc.delivered_qty < doc.qty and doc.delivered_by_supplier!=1
"condition": lambda doc: abs(doc.delivered_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",
@ -430,7 +430,7 @@ def make_sales_invoice(source_name, target_doc=None):
"parent": "sales_order",
},
"postprocess": update_item,
"condition": lambda doc: doc.qty and (doc.base_amount==0 or doc.billed_amt < doc.amount)
"condition": lambda doc: doc.qty and (doc.base_amount==0 or abs(doc.billed_amt) < abs(doc.amount))
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",

View File

@ -332,7 +332,7 @@ def make_sales_invoice(source_name, target_doc=None):
"serial_no": "serial_no"
},
"postprocess": update_item,
"filter": lambda d: d.qty - invoiced_qty_map.get(d.name, 0)<=0
"filter": lambda d: abs(d.qty) - abs(invoiced_qty_map.get(d.name, 0))<=0
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",

View File

@ -469,7 +469,7 @@ def make_purchase_invoice(source_name, target_doc=None):
"prevdoc_docname": "purchase_order",
},
"postprocess": update_item,
"filter": lambda d: d.qty - invoiced_qty_map.get(d.name, 0)<=0
"filter": lambda d: abs(d.qty) - abs(invoiced_qty_map.get(d.name, 0))<=0
},
"Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",