Merge branch 'develop' of https://github.com/frappe/erpnext into sla_fix
This commit is contained in:
commit
7910215968
@ -1,5 +1,5 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="https://github.com/frappe/design/blob/master/logos/erpnext-logo.svg" height="128">
|
<img src="https://raw.githubusercontent.com/frappe/erpnext/develop/erpnext/public/images/erp-icon.svg" height="128">
|
||||||
<h2>ERPNext</h2>
|
<h2>ERPNext</h2>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<p>ERP made simple</p>
|
<p>ERP made simple</p>
|
||||||
|
|||||||
@ -501,12 +501,15 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
def so_dn_required(self):
|
def so_dn_required(self):
|
||||||
"""check in manage account if sales order / delivery note required or not."""
|
"""check in manage account if sales order / delivery note required or not."""
|
||||||
|
if self.is_return:
|
||||||
|
return
|
||||||
dic = {'Sales Order':['so_required', 'is_pos'],'Delivery Note':['dn_required', 'update_stock']}
|
dic = {'Sales Order':['so_required', 'is_pos'],'Delivery Note':['dn_required', 'update_stock']}
|
||||||
for i in dic:
|
for i in dic:
|
||||||
if frappe.db.get_single_value('Selling Settings', dic[i][0]) == 'Yes':
|
if frappe.db.get_single_value('Selling Settings', dic[i][0]) == 'Yes':
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
if (d.item_code and frappe.get_cached_value('Item', d.item_code, 'is_stock_item') == 1
|
is_stock_item = frappe.get_cached_value('Item', d.item_code, 'is_stock_item')
|
||||||
and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1])):
|
if d.item_code and is_stock_item == 1\
|
||||||
|
and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1]):
|
||||||
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
|
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ def get_columns():
|
|||||||
"width": 150
|
"width": 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "item_name",
|
"fieldname": "item",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Item",
|
"options": "Item",
|
||||||
"label": "Item",
|
"label": "Item",
|
||||||
@ -82,12 +82,12 @@ def get_data(filters):
|
|||||||
row = {
|
row = {
|
||||||
"territory": territory.name,
|
"territory": territory.name,
|
||||||
"item_group": item.item_group,
|
"item_group": item.item_group,
|
||||||
"item": item.name,
|
"item": item.item_code,
|
||||||
"item_name": item.item_name
|
"item_name": item.item_name
|
||||||
}
|
}
|
||||||
|
|
||||||
if sales_invoice_data.get((territory.name,item.name)):
|
if sales_invoice_data.get((territory.name,item.item_code)):
|
||||||
item_obj = sales_invoice_data[(territory.name,item.name)]
|
item_obj = sales_invoice_data[(territory.name,item.item_code)]
|
||||||
if item_obj.days_since_last_order > cint(filters['days']):
|
if item_obj.days_since_last_order > cint(filters['days']):
|
||||||
row.update({
|
row.update({
|
||||||
"territory": item_obj.territory,
|
"territory": item_obj.territory,
|
||||||
@ -111,15 +111,15 @@ def get_sales_details(filters):
|
|||||||
date_field = "s.transaction_date" if filters["based_on"] == "Sales Order" else "s.posting_date"
|
date_field = "s.transaction_date" if filters["based_on"] == "Sales Order" else "s.posting_date"
|
||||||
|
|
||||||
sales_data = frappe.db.sql("""
|
sales_data = frappe.db.sql("""
|
||||||
select s.territory, s.customer, si.item_group, si.item_name, si.qty, {date_field} as last_order_date,
|
select s.territory, s.customer, si.item_group, si.item_code, si.qty, {date_field} as last_order_date,
|
||||||
DATEDIFF(CURDATE(), {date_field}) as days_since_last_order
|
DATEDIFF(CURDATE(), {date_field}) as days_since_last_order
|
||||||
from `tab{doctype}` s, `tab{doctype} Item` si
|
from `tab{doctype}` s, `tab{doctype} Item` si
|
||||||
where s.name = si.parent and s.docstatus = 1
|
where s.name = si.parent and s.docstatus = 1
|
||||||
group by si.name order by days_since_last_order """ #nosec
|
order by days_since_last_order """ #nosec
|
||||||
.format(date_field = date_field, doctype = filters['based_on']), as_dict=1)
|
.format(date_field = date_field, doctype = filters['based_on']), as_dict=1)
|
||||||
|
|
||||||
for d in sales_data:
|
for d in sales_data:
|
||||||
item_details_map.setdefault((d.territory,d.item_name), d)
|
item_details_map.setdefault((d.territory,d.item_code), d)
|
||||||
|
|
||||||
return item_details_map
|
return item_details_map
|
||||||
|
|
||||||
@ -149,6 +149,6 @@ def get_items(filters):
|
|||||||
"name": filters["item"]
|
"name": filters["item"]
|
||||||
})
|
})
|
||||||
|
|
||||||
items = frappe.get_all("Item", fields=["name", "item_group", "item_name"], filters=filters_dict, order_by="name")
|
items = frappe.get_all("Item", fields=["name", "item_group", "item_name", "item_code"], filters=filters_dict, order_by="name")
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|||||||
@ -375,10 +375,18 @@ $.extend(erpnext.item, {
|
|||||||
show_modal_for_manufacturers: function(frm) {
|
show_modal_for_manufacturers: function(frm) {
|
||||||
var dialog = new frappe.ui.Dialog({
|
var dialog = new frappe.ui.Dialog({
|
||||||
fields: [
|
fields: [
|
||||||
{fieldtype:'Link', options:'Manufacturer',
|
{
|
||||||
reqd:1, label:'Manufacturer'},
|
fieldtype: 'Link',
|
||||||
{fieldtype:'Data', label:'Manufacturer Part Number',
|
fieldname: 'manufacturer',
|
||||||
fieldname: 'manufacturer_part_no'},
|
options: 'Manufacturer',
|
||||||
|
label: 'Manufacturer',
|
||||||
|
reqd: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldtype: 'Data',
|
||||||
|
label: 'Manufacturer Part Number',
|
||||||
|
fieldname: 'manufacturer_part_no'
|
||||||
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user