Merge branch 'develop' of https://github.com/frappe/erpnext into sla_fix

This commit is contained in:
Himanshu Warekar 2019-05-19 13:48:27 +05:30
commit 7910215968
4 changed files with 39 additions and 28 deletions

View File

@ -1,5 +1,5 @@
<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>
<p align="center">
<p>ERP made simple</p>

View File

@ -501,12 +501,15 @@ class SalesInvoice(SellingController):
def so_dn_required(self):
"""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']}
for i in dic:
if frappe.db.get_single_value('Selling Settings', dic[i][0]) == 'Yes':
for d in self.get('items'):
if (d.item_code and frappe.get_cached_value('Item', d.item_code, 'is_stock_item') == 1
and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1])):
is_stock_item = frappe.get_cached_value('Item', d.item_code, 'is_stock_item')
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)

View File

@ -28,7 +28,7 @@ def get_columns():
"width": 150
},
{
"fieldname": "item_name",
"fieldname": "item",
"fieldtype": "Link",
"options": "Item",
"label": "Item",
@ -82,12 +82,12 @@ def get_data(filters):
row = {
"territory": territory.name,
"item_group": item.item_group,
"item": item.name,
"item": item.item_code,
"item_name": item.item_name
}
if sales_invoice_data.get((territory.name,item.name)):
item_obj = sales_invoice_data[(territory.name,item.name)]
if sales_invoice_data.get((territory.name,item.item_code)):
item_obj = sales_invoice_data[(territory.name,item.item_code)]
if item_obj.days_since_last_order > cint(filters['days']):
row.update({
"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"
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
from `tab{doctype}` s, `tab{doctype} Item` si
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)
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
@ -149,6 +149,6 @@ def get_items(filters):
"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

View File

@ -375,10 +375,18 @@ $.extend(erpnext.item, {
show_modal_for_manufacturers: function(frm) {
var dialog = new frappe.ui.Dialog({
fields: [
{fieldtype:'Link', options:'Manufacturer',
reqd:1, label:'Manufacturer'},
{fieldtype:'Data', label:'Manufacturer Part Number',
fieldname: 'manufacturer_part_no'},
{
fieldtype: 'Link',
fieldname: 'manufacturer',
options: 'Manufacturer',
label: 'Manufacturer',
reqd: 1,
},
{
fieldtype: 'Data',
label: 'Manufacturer Part Number',
fieldname: 'manufacturer_part_no'
},
]
});
@ -389,7 +397,7 @@ $.extend(erpnext.item, {
// call the server to make the variant
data.template = frm.doc.name;
frappe.call({
method:"erpnext.controllers.item_variant.get_variant",
method: "erpnext.controllers.item_variant.get_variant",
args: data,
callback: function(r) {
var doclist = frappe.model.sync(r.message);
@ -464,7 +472,7 @@ $.extend(erpnext.item, {
me.multiple_variant_dialog.hide();
frappe.call({
method:"erpnext.controllers.item_variant.enqueue_multiple_variant_creation",
method: "erpnext.controllers.item_variant.enqueue_multiple_variant_creation",
args: {
"item": frm.doc.name,
"args": selected_attributes
@ -514,9 +522,9 @@ $.extend(erpnext.item, {
let p = new Promise(resolve => {
if(!d.numeric_values) {
frappe.call({
method:"frappe.client.get_list",
args:{
doctype:"Item Attribute Value",
method: "frappe.client.get_list",
args: {
doctype: "Item Attribute Value",
filters: [
["parent","=", d.attribute]
],
@ -534,9 +542,9 @@ $.extend(erpnext.item, {
});
} else {
frappe.call({
method:"frappe.client.get",
args:{
doctype:"Item Attribute",
method: "frappe.client.get",
args: {
doctype: "Item Attribute",
name: d.attribute
}
}).then((r) => {
@ -599,7 +607,7 @@ $.extend(erpnext.item, {
var args = d.get_values();
if(!args) return;
frappe.call({
method:"erpnext.controllers.item_variant.get_variant",
method: "erpnext.controllers.item_variant.get_variant",
btn: d.get_primary_btn(),
args: {
"template": frm.doc.name,
@ -622,7 +630,7 @@ $.extend(erpnext.item, {
} else {
d.hide();
frappe.call({
method:"erpnext.controllers.item_variant.create_variant",
method: "erpnext.controllers.item_variant.create_variant",
args: {
"item": frm.doc.name,
"args": d.get_values()
@ -660,8 +668,8 @@ $.extend(erpnext.item, {
.on('input', function(e) {
var term = e.target.value;
frappe.call({
method:"erpnext.stock.doctype.item.item.get_item_attribute",
args:{
method: "erpnext.stock.doctype.item.item.get_item_attribute",
args: {
parent: i,
attribute_value: term
},
@ -723,7 +731,7 @@ frappe.ui.form.on("UOM Conversion Detail", {
var row = locals[cdt][cdn];
if (row.uom) {
frappe.call({
method:"erpnext.stock.doctype.item.item.get_uom_conv_factor",
method: "erpnext.stock.doctype.item.item.get_uom_conv_factor",
args: {
"uom": row.uom,
"stock_uom": frm.doc.stock_uom