Merge pull request #4435 from saurabh6790/drop-ship-fixes-3
[fixes] recreate print format, shipping address on po for drop ship, …
This commit is contained in:
commit
203d4088fa
@ -64,6 +64,7 @@ class SalesInvoice(SellingController):
|
||||
self.validate_pos()
|
||||
|
||||
if cint(self.update_stock):
|
||||
self.validate_dropship_item()
|
||||
self.validate_item_code()
|
||||
self.validate_warehouse()
|
||||
self.update_current_stock()
|
||||
@ -409,6 +410,12 @@ class SalesInvoice(SellingController):
|
||||
if self.c_form_applicable == 'Yes' and self.c_form_no:
|
||||
msgprint(_("Please remove this Invoice {0} from C-Form {1}")
|
||||
.format(self.name, self.c_form_no), raise_exception = 1)
|
||||
|
||||
def validate_dropship_item(self):
|
||||
for item in self.items:
|
||||
if item.sales_order:
|
||||
if frappe.db.get_value("Sales Order Item", item.so_detail, "delivered_by_supplier"):
|
||||
frappe.throw(_("Could not update stock, invoice contains drop shipping item."))
|
||||
|
||||
def update_current_stock(self):
|
||||
for d in self.get('items'):
|
||||
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"creation": "2015-10-20 16:46:39.382799",
|
||||
"custom_format": 0,
|
||||
"disabled": 0,
|
||||
"doc_type": "Purchase Order",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"font": "Default",
|
||||
"format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"HTML\", \"options\": \"<h1 style=\\\"text-align: center;\\\">Purchase Order</h1><div style=\\\"text-align: center;\\\">{{doc.name}}</div><div style=\\\"text-align: center;\\\"><hr></div>\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"title\"}, {\"print_hide\": 0, \"fieldname\": \"supplier\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_name\"}, {\"print_hide\": 0, \"fieldname\": \"address_display\"}, {\"print_hide\": 0, \"fieldname\": \"contact_display\"}, {\"print_hide\": 0, \"fieldname\": \"contact_mobile\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"transaction_date\"}, {\"print_hide\": 0, \"fieldname\": \"customer\"}, {\"print_hide\": 0, \"fieldname\": \"customer_name\"}, {\"print_hide\": 0, \"fieldname\": \"customer_address_display\"}, {\"print_hide\": 0, \"fieldname\": \"customer_contact_display\"}, {\"print_hide\": 0, \"fieldname\": \"customer_contact_mobile\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"image\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"qty\", \"print_width\": \"60px\"}, {\"print_hide\": 0, \"fieldname\": \"uom\", \"print_width\": \"100px\"}, {\"print_hide\": 0, \"fieldname\": \"discount_percentage\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"pricing_rule\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_quotation\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_quotation_item\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"items\"}, {\"print_hide\": 0, \"fieldname\": \"get_last_purchase_rate\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"total\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"category\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"add_deduct_tax\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"charge_type\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"row_id\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"included_in_print_rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"account_head\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"cost_center\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"tax_amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"taxes\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"grand_total\"}, {\"print_hide\": 0, \"fieldname\": \"in_words\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"terms\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"customer_contact_person\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"recurring_print_format\"}]",
|
||||
"modified": "2015-10-20 17:21:45.810640",
|
||||
"modified_by": "saurabh@erpnext.com",
|
||||
"name": "Drop Shipping",
|
||||
"owner": "Administrator",
|
||||
"print_format_builder": 1,
|
||||
"print_format_type": "Server",
|
||||
"standard": "No"
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -531,8 +531,14 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
||||
default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list")
|
||||
if default_price_list:
|
||||
target.buying_price_list = default_price_list
|
||||
|
||||
if source.shipping_address_name:
|
||||
target.customer_address = source.shipping_address_name
|
||||
target.customer_address_display = source.shipping_address
|
||||
else:
|
||||
target.customer_address = source.customer_address
|
||||
target.customer_address_display = source.address_display
|
||||
|
||||
target.delivered_by_supplier = 1
|
||||
target.run_method("set_missing_values")
|
||||
target.run_method("calculate_taxes_and_totals")
|
||||
|
||||
@ -544,9 +550,7 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
||||
"Sales Order": {
|
||||
"doctype": "Purchase Order",
|
||||
"field_map": {
|
||||
"customer_address": "customer_address",
|
||||
"contact_person": "customer_contact_person",
|
||||
"address_display": "customer_address_display",
|
||||
"contact_display": "customer_contact_display",
|
||||
"contact_mobile": "customer_contact_mobile",
|
||||
"contact_email": "customer_contact_email",
|
||||
|
Loading…
x
Reference in New Issue
Block a user