Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 30b021e..b16e299 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
import frappe
from erpnext.hooks import regional_overrides
-__version__ = '9.2.15'
+__version__ = '9.2.16'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index c5e0306..d8995a9 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -253,20 +253,24 @@
},
callback: function(r, rt) {
if(r.message) {
- if(frm.doc.payment_type == "Receive") {
- frm.set_value("paid_from", r.message.party_account);
- frm.set_value("paid_from_account_currency", r.message.party_account_currency);
- frm.set_value("paid_from_account_balance", r.message.account_balance);
- } else if (frm.doc.payment_type == "Pay"){
- frm.set_value("paid_to", r.message.party_account);
- frm.set_value("paid_to_account_currency", r.message.party_account_currency);
- frm.set_value("paid_to_account_balance", r.message.account_balance);
- }
- frm.set_value("party_balance", r.message.party_balance);
- frm.events.get_outstanding_documents(frm);
- frm.events.hide_unhide_fields(frm);
- frm.events.set_dynamic_labels(frm);
- frm.set_party_account_based_on_party = false;
+ frappe.run_serially([
+ () => {
+ if(frm.doc.payment_type == "Receive") {
+ frm.set_value("paid_from", r.message.party_account);
+ frm.set_value("paid_from_account_currency", r.message.party_account_currency);
+ frm.set_value("paid_from_account_balance", r.message.account_balance);
+ } else if (frm.doc.payment_type == "Pay"){
+ frm.set_value("paid_to", r.message.party_account);
+ frm.set_value("paid_to_account_currency", r.message.party_account_currency);
+ frm.set_value("paid_to_account_balance", r.message.account_balance);
+ }
+ },
+ () => frm.set_value("party_balance", r.message.party_balance),
+ () => frm.events.get_outstanding_documents(frm),
+ () => frm.events.hide_unhide_fields(frm),
+ () => frm.events.set_dynamic_labels(frm),
+ () => { frm.set_party_account_based_on_party = false; }
+ ]);
}
}
});
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index cb52627..25aff13 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -24,11 +24,11 @@
frappe.ui.form.on('POS Profile', {
setup: function(frm) {
- frm.set_query("online_print_format", function() {
+ frm.set_query("print_format_for_online", function() {
return {
filters: [
['Print Format', 'doc_type', '=', 'Sales Invoice'],
- ['Print Format', 'print_format_type', '!=', 'Js'],
+ ['Print Format', 'print_format_type', '=', 'Server'],
]
};
});
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index db9969d..83d5103 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -247,7 +247,7 @@
super(SalesInvoice, self).set_missing_values(for_validate)
if pos:
- return {"print_format": pos.get("print_format") }
+ return {"print_format": pos.get("print_format_for_online") }
def update_time_sheet(self, sales_invoice):
for d in self.timesheets:
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index 8fafce6..9d872a4 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -36,8 +36,14 @@
<br>{%= data[i][__("Voucher No")] %}</td>
<td>
{% if(!(filters.customer || filters.supplier)) { %}
- {%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}<br>{%= __("Remarks") %}:
+ {%= data[i][__("Customer")] || data[i][__("Supplier")] %}
+ {% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
+ <br> {%= data[i][__("Customer Name")] %}
+ {% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
+ <br> {%= data[i][__("Supplier Name")] %}
+ {% } %}
{% } %}
+ <br>{%= __("Remarks") %}:
{%= data[i][__("Remarks")] %}
</td>
<td style="text-align: right">
@@ -66,8 +72,13 @@
<td>
{% if(!(filters.customer || filters.supplier)) { %}
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
- <br>{%= __("Remarks") %}:
+ {% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
+ <br> {%= data[i][__("Customer Name")] %}
+ {% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
+ <br> {%= data[i][__("Supplier Name")] %}
+ {% } %}
{% } %}
+ <br>{%= __("Remarks") %}:
{%= data[i][__("Remarks")] %}
</td>
{% } else { %}
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index d301081..e598735 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -171,7 +171,7 @@
for item in self.get("items"):
if self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
item.rm_supp_cost = 0.0
- if item.item_code in self.sub_contracted_items:
+ if item.bom and item.item_code in self.sub_contracted_items:
self.update_raw_materials_supplied(item, raw_material_table)
if [item.item_code, item.name] not in parent_items:
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 34e9a3e..d395493 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -348,8 +348,10 @@
budget.action_if_annual_budget_exceeded = "Warn"
expense_ledger_count = frappe.db.count("Account", {"is_group": "0", "root_type": "Expense"})
- add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count), randomize = { "account": ("Account", {"is_group": "0", "root_type": "Expense"})
- }, unique="account")
+ add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count),
+ randomize = {
+ "account": ("Account", {"is_group": "0", "root_type": "Expense"})
+ }, unique="account")
for d in budget.accounts:
d.budget_amount = random.randint(5, 100) * 10000
@@ -361,6 +363,7 @@
company_abbr = frappe.db.get_value("Company", erpnext.get_default_company(), "abbr")
pos = frappe.new_doc('POS Profile')
pos.user = frappe.db.get_global('demo_accounts_user')
+ pos.pos_profile_name = "Demo POS Profile"
pos.naming_series = 'SINV-'
pos.update_stock = 0
pos.write_off_account = 'Cost of Goods Sold - '+ company_abbr
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 747a3c0..51e6c61 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -103,7 +103,7 @@
def validate_delivery_date(self):
if self.order_type == 'Sales':
if not self.delivery_date:
- self.delivery_date = max([d.delivery_date for d in self.get("items")])
+ self.delivery_date = max([d.delivery_date for d in self.get("items") if d.delivery_date])
if self.delivery_date:
for d in self.get("items"):
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index b167bcd..0a70bb9 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -53,8 +53,6 @@
() => this.setup_pos_profile(),
() => this.make_new_invoice(),
() => {
- frappe.timeout(1);
- this.make_items();
this.bind_events();
frappe.dom.unfreeze();
},
@@ -323,16 +321,20 @@
make_new_invoice() {
return frappe.run_serially([
- () => this.make_sales_invoice_frm(),
() => {
- if (this.cart) {
- this.cart.frm = this.frm;
- this.cart.reset();
- } else {
- this.make_cart();
- }
- this.toggle_editing(true);
- }
+ this.make_sales_invoice_frm()
+ .then(() => this.set_pos_profile_data())
+ .then(() => {
+ if (this.cart) {
+ this.cart.frm = this.frm;
+ this.cart.reset();
+ } else {
+ this.make_items();
+ this.make_cart();
+ }
+ this.toggle_editing(true);
+ })
+ },
]);
}
@@ -359,12 +361,29 @@
if(!frm.doc.company) {
frm.set_value('company', pos_profile.company);
}
- frm.set_value('is_pos', 1);
- frm.meta.default_print_format = 'POS Invoice';
+ frm.doc.is_pos = 1;
return frm;
}
}
+ set_pos_profile_data() {
+ return new Promise(resolve => {
+ return this.frm.call({
+ doc: this.frm.doc,
+ method: "set_missing_values",
+ }).then((r) => {
+ if(!r.exc) {
+ this.frm.script_manager.trigger("update_stock");
+ frappe.model.set_default_values(this.frm.doc);
+ this.frm.cscript.calculate_taxes_and_totals();
+ this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice';
+ }
+
+ resolve();
+ })
+ })
+ }
+
prepare_menu() {
var me = this;
this.page.clear_menu();
@@ -392,9 +411,6 @@
if(this.frm.doc.docstatus !== 1) return;
this.page.set_secondary_action(__("Print"), () => {
- if (this.pos_profile && this.pos_profile.print_format_for_online) {
- this.frm.meta.default_print_format = this.pos_profile.print_format_for_online;
- }
this.frm.print_preview.printit(true);
});
@@ -1264,6 +1280,16 @@
$(this.dialog.body).find('.input-with-feedback').focusin(function() {
me.numpad.reset_value();
me.fieldname = $(this).prop('dataset').fieldname;
+ if (me.frm.doc.outstanding_amount > 0 &&
+ !in_list(['write_off_amount', 'change_amount'], me.fieldname)) {
+ me.frm.doc.payments.forEach((data) => {
+ if (data.mode_of_payment == me.fieldname && !data.amount) {
+ me.dialog.set_value(me.fieldname,
+ me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate);
+ return;
+ }
+ })
+ }
});
}
@@ -1403,4 +1429,4 @@
this.dialog.set_value("paid_amount", this.frm.doc.paid_amount);
this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount);
}
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 539e8a5..9ec5d19 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -96,16 +96,6 @@
return out
- # print(frappe._dict({
- # 'has_serial_no' : out.has_serial_no,
- # 'has_batch_no' : out.has_batch_no
- # }))
-
- # return frappe._dict({
- # 'has_serial_no' : out.has_serial_no,
- # 'has_batch_no' : out.has_batch_no
- # })
-
def process_args(args):
if isinstance(args, basestring):
args = json.loads(args)
@@ -532,8 +522,6 @@
bom = frappe.db.get_value("BOM", {"docstatus": 1, "is_default": 1, "is_active": 1, "item": item_code})
if bom:
return bom
- else:
- frappe.throw(_("No default BOM exists for Item {0}").format(item_code))
def get_valuation_rate(item_code, warehouse=None):
item = frappe.get_doc("Item", item_code)