Merge branch 'hotfix'

This commit is contained in:
Saurabh 2018-01-02 12:09:25 +05:30
commit e9b37abfca
9 changed files with 42 additions and 9 deletions

View File

@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
from frappe.utils import getdate from frappe.utils import getdate
__version__ = '10.0.4' __version__ = '10.0.5'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -63,7 +63,11 @@ class POSProfile(Document):
if len(default_mode_of_payment) > 1: if len(default_mode_of_payment) > 1:
frappe.throw(_("Multiple default mode of payment is not allowed")) frappe.throw(_("Multiple default mode of payment is not allowed"))
def validate_customer_territory_group(self): def validate_customer_territory_group(self):
if not frappe.db.get_single_value('POS Settings', 'use_pos_in_offline_mode'):
return
if not self.territory: if not self.territory:
frappe.throw(_("Territory is Required in POS Profile"), title="Mandatory Field") frappe.throw(_("Territory is Required in POS Profile"), title="Mandatory Field")
@ -103,7 +107,7 @@ def get_item_groups(pos_profile):
if pos_profile.get('item_groups'): if pos_profile.get('item_groups'):
# Get items based on the item groups defined in the POS profile # Get items based on the item groups defined in the POS profile
for data in pos_profile.get('item_groups'): for data in pos_profile.get('item_groups'):
item_groups.extend(["'%s'"%d.name for d in get_child_nodes('Item Group', data.item_group)]) item_groups.extend(["'%s'" % frappe.db.escape(d.name) for d in get_child_nodes('Item Group', data.item_group)])
return list(set(item_groups)) return list(set(item_groups))

View File

@ -66,12 +66,12 @@ def get_mode_of_payments(filters):
invoice_list = get_invoices(filters) invoice_list = get_invoices(filters)
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list]) invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
if invoice_list: if invoice_list:
inv_mop = frappe.db.sql("""select a.owner,a.posting_date,b.mode_of_payment inv_mop = frappe.db.sql("""select a.owner,a.posting_date, ifnull(b.mode_of_payment, '')
from `tabSales Invoice` a, `tabSales Invoice Payment` b from `tabSales Invoice` a, `tabSales Invoice Payment` b
where a.name = b.parent where a.name = b.parent
and a.name in ({invoice_list_names}) and a.name in ({invoice_list_names})
union union
select a.owner,a.posting_date,b.mode_of_payment select a.owner,a.posting_date, ifnull(b.mode_of_payment, '')
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
where a.name = c.reference_name where a.name = c.reference_name
and b.name = c.parent and b.name = c.parent

View File

@ -252,6 +252,9 @@ def add_ac(args=None):
if not ac.parent_account: if not ac.parent_account:
ac.parent_account = args.get("parent") ac.parent_account = args.get("parent")
if ac.is_root:
ac.parent_account=''
ac.old_parent = "" ac.old_parent = ""
ac.freeze_account = "No" ac.freeze_account = "No"
if cint(ac.get("is_root")): if cint(ac.get("is_root")):

View File

@ -25,7 +25,7 @@ erpnext.crop.update_item_rate_uom = function(frm, cdt, cdn) {
let material_list = ['materials_required', 'produce', 'byproducts']; let material_list = ['materials_required', 'produce', 'byproducts'];
material_list.forEach((material) => { material_list.forEach((material) => {
frm.doc[material].forEach((item, index) => { frm.doc[material].forEach((item, index) => {
if (item.name == cdn){ if (item.name == cdn && item.item_code){
frappe.call({ frappe.call({
method:'erpnext.agriculture.doctype.crop.crop.get_item_details', method:'erpnext.agriculture.doctype.crop.crop.get_item_details',
args: { args: {

View File

@ -431,7 +431,7 @@ class BuyingController(StockController):
d.schedule_date = self.schedule_date d.schedule_date = self.schedule_date
if d.schedule_date and getdate(d.schedule_date) < getdate(self.transaction_date): if d.schedule_date and getdate(d.schedule_date) < getdate(self.transaction_date):
frappe.throw(_("Expected Date cannot be before Transaction Date")) frappe.throw(_("Row #{0}: Reqd by Date cannot be before Transaction Date").format(d.idx))
else: else:
frappe.throw(_("Please enter Schedule Date")) frappe.throw(_("Please enter Reqd by Date"))

View File

@ -591,7 +591,7 @@ def validate_bom_no(item, bom_no):
frappe.throw(_("BOM {0} does not belong to Item {1}").format(bom_no, item)) frappe.throw(_("BOM {0} does not belong to Item {1}").format(bom_no, item))
@frappe.whitelist() @frappe.whitelist()
def get_children(doctype, parent=None, is_tree=False): def get_children(doctype, parent=None, is_root=False, **filters):
if not parent: if not parent:
frappe.msgprint(_('Please select a BOM')) frappe.msgprint(_('Please select a BOM'))
return return

View File

@ -521,6 +521,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if(r.message) { if(r.message) {
me.frm.set_value("due_date", r.message); me.frm.set_value("due_date", r.message);
frappe.ui.form.trigger(me.frm.doc.doctype, "currency"); frappe.ui.form.trigger(me.frm.doc.doctype, "currency");
me.recalculate_terms();
} }
} }
}) })
@ -530,6 +531,29 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
} }
}, },
recalculate_terms: function() {
const doc = this.frm.doc;
if (doc.payment_terms_template) {
this.payment_terms_template();
} else if (doc.payment_schedule) {
const me = this;
doc.payment_schedule.forEach(
function(term) {
if (term.payment_term) {
me.payment_term(doc, term.doctype, term.name);
} else {
frappe.model.set_value(
term.doctype, term.name, 'due_date',
doc.posting_date || doc.transaction_date
);
}
}
);
}
},
get_company_currency: function() { get_company_currency: function() {
return erpnext.get_currency(this.frm.doc.company); return erpnext.get_currency(this.frm.doc.company);
}, },

View File

@ -7,6 +7,8 @@ def update_itemised_tax_data(doc):
itemised_tax = get_itemised_tax(doc.taxes) itemised_tax = get_itemised_tax(doc.taxes)
for row in doc.items: for row in doc.items:
tax_rate = 0.0
if itemised_tax.get(row.item_code):
tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()]) tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()])
row.tax_rate = flt(tax_rate, row.precision("tax_rate")) row.tax_rate = flt(tax_rate, row.precision("tax_rate"))