Browse Source

[fixes] bulk close facility, rename Drop Ship to Delivered By Supplier

develop
Saurabh 9 years ago
parent
commit
2f702dcb32
  1. 8
      erpnext/accounts/doctype/sales_invoice/sales_invoice.js
  2. 2
      erpnext/accounts/doctype/sales_invoice/sales_invoice.py
  3. 14
      erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
  4. 2
      erpnext/buying/doctype/purchase_order/purchase_order.js
  5. 10
      erpnext/buying/doctype/purchase_order/purchase_order.py
  6. 3
      erpnext/buying/doctype/purchase_order/purchase_order_list.js
  7. 10
      erpnext/selling/doctype/sales_order/sales_order.js
  8. 12
      erpnext/selling/doctype/sales_order/sales_order.py
  9. 6
      erpnext/selling/doctype/sales_order/sales_order_list.js
  10. 4
      erpnext/selling/doctype/sales_order/test_sales_order.py
  11. 16
      erpnext/selling/doctype/sales_order_item/sales_order_item.json
  12. 8
      erpnext/stock/doctype/item/item.json
  13. 2
      erpnext/stock/get_item_details.py

8
erpnext/accounts/doctype/sales_invoice/sales_invoice.js

@ -51,10 +51,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
if(doc.docstatus==1 && !doc.is_return) {
var is_drop_ship = false;
var is_delivered_by_supplier = false;
is_drop_ship = cur_frm.doc.items.some(function(item){
return item.is_drop_ship ? true : false;
is_delivered_by_supplier = cur_frm.doc.items.some(function(item){
return item.is_delivered_by_supplier ? true : false;
})
cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'),
@ -68,7 +68,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
return item.delivery_note ? true : false;
});
if(!from_delivery_note && !is_drop_ship) {
if(!from_delivery_note && !is_delivered_by_supplier) {
cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note']).addClass("btn-primary");
}
}

2
erpnext/accounts/doctype/sales_invoice/sales_invoice.py

@ -668,7 +668,7 @@ def make_delivery_note(source_name, target_doc=None):
"so_detail": "so_detail"
},
"postprocess": update_item,
"condition": lambda doc: doc.is_drop_ship!=1
"condition": lambda doc: doc.delivered_by_supplier!=1
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",

14
erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json

@ -684,14 +684,14 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "eval:doc.is_drop_ship==1",
"fieldname": "drop_ship",
"collapsible_depends_on": "eval:doc.delivered_by_supplier==1",
"fieldname": "by_supplier",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Drop Ship",
"label": "Delivered By Sypplier",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -707,18 +707,18 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "is_drop_ship",
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Drop Ship Item",
"label": "Delivered By Supplier",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -1327,7 +1327,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-10-21 19:06:40.313900",
"modified": "2015-10-26 17:22:23.631195",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

2
erpnext/buying/doctype/purchase_order/purchase_order.js

@ -26,7 +26,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.add_custom_button(__('Close'), this.close_purchase_order);
if(doc.is_drop_ship && doc.status!="Delivered"){
if(doc.delivered_by_supplier && doc.status!="Delivered"){
cur_frm.add_custom_button(__('Delivered By Supplier'), this.delivered_by_supplier);
}

10
erpnext/buying/doctype/purchase_order/purchase_order.py

@ -162,7 +162,7 @@ class PurchaseOrder(BuyingController):
clear_doctype_notifications(self)
def on_submit(self):
if self.is_drop_ship == 1:
if self.delivered_by_supplier == 1:
self.update_status_updater()
super(PurchaseOrder, self).on_submit()
@ -179,7 +179,7 @@ class PurchaseOrder(BuyingController):
purchase_controller.update_last_purchase_rate(self, is_submit = 1)
def on_cancel(self):
if self.is_drop_ship == 1:
if self.delivered_by_supplier == 1:
self.update_status_updater()
pc_obj = frappe.get_doc('Purchase Common')
@ -236,9 +236,9 @@ def stop_or_unstop_purchase_orders(names, status):
for name in names:
po = frappe.get_doc("Purchase Order", name)
if po.docstatus == 1:
if status=="Stopped":
if po.status not in ("Stopped", "Cancelled") and (po.per_received < 100 or po.per_billed < 100):
po.update_status("Stopped")
if status in ("Stopped", "Closed"):
if po.status not in ("Stopped", "Cancelled", "Closed") and (po.per_received < 100 or po.per_billed < 100):
po.update_status(status)
else:
if po.status == "Stopped":
po.update_status("Draft")

3
erpnext/buying/doctype/purchase_order/purchase_order_list.js

@ -33,5 +33,8 @@ frappe.listview_settings['Purchase Order'] = {
listview.call_for_selected_items(method, {"status": "Submitted"});
});
listview.page.add_menu_item(__("Set as Closed"), function() {
listview.call_for_selected_items(method, {"status": "Closed"});
});
}
};

10
erpnext/selling/doctype/sales_order/sales_order.js

@ -15,15 +15,15 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
refresh: function(doc, dt, dn) {
this._super();
this.frm.dashboard.reset();
var is_drop_ship = false;
var is_delivered_by_supplier = false;
var is_delivery_note = false;
if(doc.docstatus==1) {
if(doc.status != 'Stopped' && doc.status != 'Closed') {
$.each(cur_frm.doc.items, function(i, item){
if(item.is_drop_ship == 1 || item.supplier){
is_drop_ship = true;
if(item.is_delivered_by_supplier == 1 || item.supplier){
is_delivered_by_supplier = true;
}
else{
is_delivery_note = true;
@ -45,7 +45,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
// stop
if((flt(doc.per_delivered, 2) < 100 && is_delivery_note) || doc.per_billed < 100
|| (flt(doc.per_ordered,2) < 100 && is_drop_ship)){
|| (flt(doc.per_ordered,2) < 100 && is_delivered_by_supplier)){
cur_frm.add_custom_button(__('Stop'), this.stop_sales_order)
}
@ -67,7 +67,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice).addClass("btn-primary");
}
if(flt(doc.per_ordered, 2) < 100 && is_drop_ship)
if(flt(doc.per_ordered, 2) < 100 && is_delivered_by_supplier)
cur_frm.add_custom_button(__('Make Purchase Order'), cur_frm.cscript.make_purchase_order).addClass("btn-primary");
} else {

12
erpnext/selling/doctype/sales_order/sales_order.py

@ -150,7 +150,7 @@ class SalesOrder(SellingController):
def validate_drop_ship(self):
for d in self.get('items'):
if d.is_drop_ship and not d.supplier:
if d.delivered_by_supplier and not d.supplier:
frappe.throw(_("Row #{0}: Set Supplier for item {1}").format(d.idx, d.item_code))
def on_submit(self):
@ -277,9 +277,9 @@ def stop_or_unstop_sales_orders(names, status):
for name in names:
so = frappe.get_doc("Sales Order", name)
if so.docstatus == 1:
if status=="Stop":
if so.status not in ("Stopped", "Cancelled") and (so.per_delivered < 100 or so.per_billed < 100):
so.stop_sales_order()
if status in ("Stopped", "Closed"):
if so.status not in ("Stopped", "Cancelled", "Closed") and (so.per_delivered < 100 or so.per_billed < 100):
so.stop_sales_order(status)
else:
if so.status == "Stopped":
so.unstop_sales_order()
@ -359,7 +359,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.is_drop_ship!=1
"condition": lambda doc: doc.delivered_qty < doc.qty and doc.delivered_by_supplier!=1
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",
@ -507,7 +507,7 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
if default_price_list:
target.buying_price_list = default_price_list
target.is_drop_ship = 1
target.delivered_by_supplier = 1
target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")

6
erpnext/selling/doctype/sales_order/sales_order_list.js

@ -45,12 +45,16 @@ frappe.listview_settings['Sales Order'] = {
var method = "erpnext.selling.doctype.sales_order.sales_order.stop_or_unstop_sales_orders";
listview.page.add_menu_item(__("Set as Stopped"), function() {
listview.call_for_selected_items(method, {"status": "Stop"});
listview.call_for_selected_items(method, {"status": "Stoped"});
});
listview.page.add_menu_item(__("Set as Unstopped"), function() {
listview.call_for_selected_items(method, {"status": "Unstop"});
});
listview.page.add_menu_item(__("Set as Closed"), function() {
listview.call_for_selected_items(method, {"status": "Closed"});
});
}
};

4
erpnext/selling/doctype/sales_order/test_sales_order.py

@ -302,7 +302,7 @@ class TestSalesOrder(unittest.TestCase):
from erpnext.buying.doctype.purchase_order.purchase_order import delivered_by_supplier
po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "is_sales_item": 1,
"is_purchase_item": 1, "is_drop_ship": 1, 'default_supplier': '_Test Supplier'})
"is_purchase_item": 1, "delivered_by_supplier": 1, 'default_supplier': '_Test Supplier'})
dn_item = make_item("_Test Regular Item", {"is_stock_item": 1, "is_sales_item": 1,
"is_purchase_item": 1})
@ -314,7 +314,7 @@ class TestSalesOrder(unittest.TestCase):
"qty": 2,
"rate": 400,
"conversion_factor": 1.0,
"is_drop_ship": 1,
"delivered_by_supplier": 1,
"supplier": '_Test Supplier'
},
{

16
erpnext/selling/doctype/sales_order_item/sales_order_item.json

@ -687,14 +687,14 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "eval:doc.is_drop_ship==1",
"fieldname": "drop_ship",
"collapsible_depends_on": "eval:doc.delivered_by_supplier==1||doc.supplier",
"fieldname": "by_supplier",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Drop Ship",
"label": "Delivered by Supplier",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -707,20 +707,20 @@
"unique": 0
},
{
"allow_on_submit": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "is_drop_ship",
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Drop Ship Item",
"label": "Delivered By Supplier",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -1206,7 +1206,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-10-21 19:25:21.712515",
"modified": "2015-10-26 17:17:04.378067",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",

8
erpnext/stock/doctype/item/item.json

@ -250,13 +250,13 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "is_drop_ship",
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Drop Ship",
"label": "Delivered By Supplier",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -2157,7 +2157,11 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
<<<<<<< ac7a1da680daa876b9f107cec87150cf7a195138
"modified": "2015-10-29 02:25:26.256373",
=======
"modified": "2015-10-26 17:18:54.615802",
>>>>>>> [fixes] bulk close facility, rename Drop Ship to Delivered By Supplier
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

2
erpnext/stock/get_item_details.py

@ -174,7 +174,7 @@ def get_basic_details(args, item):
"net_amount": 0.0,
"discount_percentage": 0.0,
"supplier": item.default_supplier,
"is_drop_ship": item.is_drop_ship,
"delivered_by_supplier": item.delivered_by_supplier,
})
# if default specified in item is for another company, fetch from company

Loading…
Cancel
Save