commit
8ac4643fd7
@ -131,6 +131,8 @@ def get_pricing_rule_for_item(args):
|
||||
|
||||
if not (args.item_group and args.brand):
|
||||
args.item_group, args.brand = frappe.db.get_value("Item", args.item_code, ["item_group", "brand"])
|
||||
if not args.item_group:
|
||||
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))
|
||||
|
||||
if args.customer and not (args.customer_group and args.territory):
|
||||
args.customer_group, args.territory = frappe.db.get_value("Customer", args.customer,
|
||||
@ -188,12 +190,15 @@ def get_pricing_rules(args):
|
||||
conditions += """ and %(transaction_date)s between ifnull(valid_from, '2000-01-01')
|
||||
and ifnull(valid_upto, '2500-12-31')"""
|
||||
|
||||
item_group_condition = _get_tree_conditions("Item Group", False)
|
||||
if item_group_condition: item_group_condition = " or " + item_group_condition
|
||||
|
||||
return frappe.db.sql("""select * from `tabPricing Rule`
|
||||
where (item_code=%(item_code)s or {item_group_condition} or brand=%(brand)s)
|
||||
where (item_code=%(item_code)s {item_group_condition} or brand=%(brand)s)
|
||||
and docstatus < 2 and ifnull(disable, 0) = 0
|
||||
and ifnull({transaction_type}, 0) = 1 {conditions}
|
||||
order by priority desc, name desc""".format(
|
||||
item_group_condition=_get_tree_conditions("Item Group", False),
|
||||
item_group_condition=item_group_condition,
|
||||
transaction_type=args.transaction_type, conditions=conditions), args, as_dict=1)
|
||||
|
||||
def filter_pricing_rules(args, pricing_rules):
|
||||
|
@ -262,7 +262,7 @@ class SalesInvoice(SellingController):
|
||||
"""Validate Fixed Asset and whether Income Account Entered Exists"""
|
||||
for d in self.get('entries'):
|
||||
item = frappe.db.sql("""select name,is_asset_item,is_sales_item from `tabItem`
|
||||
where name = %s and (ifnull(end_of_life,'')='' or end_of_life > now())""", d.item_code)
|
||||
where name = %s""", d.item_code)
|
||||
acc = frappe.db.sql("""select account_type from `tabAccount`
|
||||
where name = %s and docstatus != 2""", d.income_account)
|
||||
if item and item[0][1] == 'Yes' and acc and acc[0][0] != 'Fixed Asset':
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from frappe.utils.nestedset import NestedSet
|
||||
|
||||
|
@ -169,13 +169,9 @@ cur_frm.fields_dict.item_supplier_details.grid.get_field("supplier").get_query =
|
||||
}
|
||||
|
||||
cur_frm.cscript.copy_from_item_group = function(doc) {
|
||||
frappe.model.with_doc("Item Group", doc.item_group, function(name, r) {
|
||||
$.each((r.docs[0].item_website_specifications || []), function(i, d) {
|
||||
var n = frappe.model.add_child(doc, "Item Website Specification", "item_website_specifications");
|
||||
n.label = d.label;
|
||||
n.description = d.description;
|
||||
});
|
||||
cur_frm.refresh();
|
||||
return cur_frm.call({
|
||||
doc: doc,
|
||||
method: "copy_specification_from_item_group"
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -270,6 +270,15 @@ class Item(WebsiteGenerator):
|
||||
frappe.db.get_value("Stock Settings", None, "allow_negative_stock"))
|
||||
frappe.db.auto_commit_on_many_writes = 0
|
||||
|
||||
def copy_specification_from_item_group(self):
|
||||
self.set("item_website_specifications", [])
|
||||
if self.item_group:
|
||||
for label, desc in frappe.db.get_values("Item Website Specification",
|
||||
{"parent": self.item_group}, ["label", "description"]):
|
||||
row = self.append("item_website_specifications")
|
||||
row.label = label
|
||||
row.description = desc
|
||||
|
||||
def validate_end_of_life(item_code, end_of_life=None, verbose=1):
|
||||
if not end_of_life:
|
||||
end_of_life = frappe.db.get_value("Item", item_code, "end_of_life")
|
||||
|
@ -213,11 +213,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
if(!r.exc) {
|
||||
var jv_name = frappe.model.make_new_doc_and_get_name('Journal Voucher');
|
||||
var jv = locals["Journal Voucher"][jv_name];
|
||||
$.extend(jv, r.message[0]);
|
||||
$.each(r.message.slice(1), function(i, jvd) {
|
||||
var child = frappe.model.add_child(jv, "Journal Voucher Detail", "entries");
|
||||
$.extend(child, jvd);
|
||||
});
|
||||
$.extend(jv, r.message);
|
||||
loaddoc("Journal Voucher", jv_name);
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,8 @@ class MaintenanceSchedule(TransactionBase):
|
||||
child.idx = count
|
||||
count = count + 1
|
||||
child.sales_person = d.sales_person
|
||||
child.save(1)
|
||||
|
||||
self.on_update()
|
||||
self.save()
|
||||
|
||||
def on_submit(self):
|
||||
if not self.get('maintenance_schedule_detail'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user