[enhance] make PO from SO if supplier is specified
This commit is contained in:
parent
a4efbf0db7
commit
5e0b0b4b97
@ -668,7 +668,7 @@ def make_delivery_note(source_name, target_doc=None):
|
|||||||
"so_detail": "so_detail"
|
"so_detail": "so_detail"
|
||||||
},
|
},
|
||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: doc.is_drop_ship!=1
|
"condition": lambda doc: (doc.is_drop_ship!=1 and not doc.supplier)
|
||||||
},
|
},
|
||||||
"Sales Taxes and Charges": {
|
"Sales Taxes and Charges": {
|
||||||
"doctype": "Sales Taxes and Charges",
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
|||||||
@ -683,7 +683,8 @@
|
|||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 1,
|
||||||
|
"collapsible_depends_on": "eval:doc.is_drop_ship==1",
|
||||||
"fieldname": "drop_ship",
|
"fieldname": "drop_ship",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -1370,8 +1371,8 @@
|
|||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2015-10-19 03:04:52.093181",
|
"modified": "2015-10-20 15:54:03.318846",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "saurabh6790@gmail.com",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice Item",
|
"name": "Sales Invoice Item",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
|
|||||||
@ -221,7 +221,7 @@ class StatusUpdater(Document):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if self.doctype=="Delivery Note":
|
if self.doctype=="Delivery Note":
|
||||||
args["drop_ship_cond"] = " and is_drop_ship!=1 "
|
args["drop_ship_cond"] = " and is_drop_ship!=1 and supplier = '' "
|
||||||
|
|
||||||
for name in unique_transactions:
|
for name in unique_transactions:
|
||||||
if not name:
|
if not name:
|
||||||
|
|||||||
@ -31,6 +31,7 @@ class SalesOrder(SellingController):
|
|||||||
self.validate_uom_is_integer("stock_uom", "qty")
|
self.validate_uom_is_integer("stock_uom", "qty")
|
||||||
self.validate_for_items()
|
self.validate_for_items()
|
||||||
self.validate_warehouse()
|
self.validate_warehouse()
|
||||||
|
self.validate_drop_ship()
|
||||||
|
|
||||||
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
||||||
make_packing_list(self)
|
make_packing_list(self)
|
||||||
@ -147,6 +148,11 @@ class SalesOrder(SellingController):
|
|||||||
doc.set_status(update=True)
|
doc.set_status(update=True)
|
||||||
doc.update_opportunity()
|
doc.update_opportunity()
|
||||||
|
|
||||||
|
def validate_drop_ship(self):
|
||||||
|
for d in self.get('items'):
|
||||||
|
if d.is_drop_ship and not d.supplier:
|
||||||
|
frappe.throw(_("#{0} Set Supplier for item {1}").format(d.idx, d.item_code))
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
super(SalesOrder, self).on_submit()
|
super(SalesOrder, self).on_submit()
|
||||||
|
|
||||||
@ -252,6 +258,9 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def before_update_after_submit(self):
|
||||||
|
self.validate_drop_ship()
|
||||||
|
|
||||||
def get_list_context(context=None):
|
def get_list_context(context=None):
|
||||||
from erpnext.controllers.website_list_for_contact import get_list_context
|
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||||
@ -350,7 +359,7 @@ def make_delivery_note(source_name, target_doc=None):
|
|||||||
"parent": "against_sales_order",
|
"parent": "against_sales_order",
|
||||||
},
|
},
|
||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: doc.delivered_qty < doc.qty and doc.is_drop_ship!=1
|
"condition": lambda doc: doc.delivered_qty < doc.qty and (doc.is_drop_ship!=1 and not doc.supplier)
|
||||||
},
|
},
|
||||||
"Sales Taxes and Charges": {
|
"Sales Taxes and Charges": {
|
||||||
"doctype": "Sales Taxes and Charges",
|
"doctype": "Sales Taxes and Charges",
|
||||||
@ -378,6 +387,7 @@ def make_sales_invoice(source_name, target_doc=None):
|
|||||||
target.run_method("calculate_taxes_and_totals")
|
target.run_method("calculate_taxes_and_totals")
|
||||||
|
|
||||||
def update_item(source, target, source_parent):
|
def update_item(source, target, source_parent):
|
||||||
|
target.supplier = source.supplier
|
||||||
target.amount = flt(source.amount) - flt(source.billed_amt)
|
target.amount = flt(source.amount) - flt(source.billed_amt)
|
||||||
target.base_amount = target.amount * flt(source_parent.conversion_rate)
|
target.base_amount = target.amount * flt(source_parent.conversion_rate)
|
||||||
target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty
|
target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty
|
||||||
@ -538,7 +548,7 @@ def make_drop_shipment(source_name, for_supplier, target_doc=None):
|
|||||||
["delivery_date", "schedule_date"]
|
["delivery_date", "schedule_date"]
|
||||||
],
|
],
|
||||||
"postprocess": update_item,
|
"postprocess": update_item,
|
||||||
"condition": lambda doc: doc.ordered_qty < doc.qty and doc.is_drop_ship==1 and doc.supplier == for_supplier
|
"condition": lambda doc: doc.ordered_qty < doc.qty and doc.supplier == for_supplier or (doc.is_drop_ship==1 and doc.supplier == for_supplier)
|
||||||
},
|
},
|
||||||
"Sales Taxes and Charges": {
|
"Sales Taxes and Charges": {
|
||||||
"doctype": "Purchase Taxes and Charges",
|
"doctype": "Purchase Taxes and Charges",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user