Merge pull request #31982 from FHenry/dev_enhance_upgrade_process
fix: upgrade process to version-14 when currency opportunity was not set
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
index 1c19c1d..cf5fbe1 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
@@ -2,7 +2,7 @@
// For license information, please see license.txt
frappe.ui.form.on("Journal Entry Template", {
- setup: function(frm) {
+ refresh: function(frm) {
frappe.model.set_default_values(frm.doc);
frm.set_query("account" ,"accounts", function(){
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index d5f7ee4..994b677 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -43,6 +43,7 @@
"currency",
"write_off_account",
"write_off_cost_center",
+ "write_off_limit",
"account_for_change_amount",
"disable_rounded_total",
"column_break_23",
@@ -361,6 +362,14 @@
"label": "Validate Stock on Save"
},
{
+ "default": "1",
+ "description": "Auto write off precision loss while consolidation",
+ "fieldname": "write_off_limit",
+ "fieldtype": "Currency",
+ "label": "Write Off Limit",
+ "reqd": 1
+ },
+ {
"default": "0",
"description": "If enabled, the consolidated invoices will have rounded total disabled",
"fieldname": "disable_rounded_total",
@@ -393,7 +402,7 @@
"link_fieldname": "pos_profile"
}
],
- "modified": "2022-07-21 11:16:46.911173",
+ "modified": "2022-08-10 12:57:06.241439",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js
index 21205c3..615804e 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.js
+++ b/erpnext/accounts/report/gross_profit/gross_profit.js
@@ -4,7 +4,7 @@
frappe.query_reports["Gross Profit"] = {
"filters": [
{
- "fieldname":"company",
+ "fieldname": "company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
@@ -12,32 +12,44 @@
"reqd": 1
},
{
- "fieldname":"from_date",
+ "fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_start_date"),
"reqd": 1
},
{
- "fieldname":"to_date",
+ "fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_end_date"),
"reqd": 1
},
{
- "fieldname":"sales_invoice",
+ "fieldname": "sales_invoice",
"label": __("Sales Invoice"),
"fieldtype": "Link",
"options": "Sales Invoice"
},
{
- "fieldname":"group_by",
+ "fieldname": "group_by",
"label": __("Group By"),
"fieldtype": "Select",
"options": "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject\nMonthly\nPayment Term",
"default": "Invoice"
},
+ {
+ "fieldname": "item_group",
+ "label": __("Item Group"),
+ "fieldtype": "Link",
+ "options": "Item Group"
+ },
+ {
+ "fieldname": "sales_person",
+ "label": __("Sales Person"),
+ "fieldtype": "Link",
+ "options": "Sales Person"
+ },
],
"tree": true,
"name_field": "parent",
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 54af225..f0106be 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -7,6 +7,7 @@
from frappe.utils import cint, flt, formatdate
from erpnext.controllers.queries import get_match_cond
+from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition
from erpnext.stock.utils import get_incoming_rate
@@ -676,6 +677,17 @@
if self.filters.to_date:
conditions += " and posting_date <= %(to_date)s"
+ if self.filters.item_group:
+ conditions += " and {0}".format(get_item_group_condition(self.filters.item_group))
+
+ if self.filters.sales_person:
+ conditions += """
+ and exists(select 1
+ from `tabSales Team` st
+ where st.parent = `tabSales Invoice`.name
+ and st.sales_person = %(sales_person)s)
+ """
+
if self.filters.group_by == "Sales Person":
sales_person_cols = ", sales.sales_person, sales.allocated_amount, sales.incentives"
sales_team_table = "left join `tabSales Team` sales on sales.parent = `tabSales Invoice`.name"
@@ -723,6 +735,7 @@
from
`tabSales Invoice` inner join `tabSales Invoice Item`
on `tabSales Invoice Item`.parent = `tabSales Invoice`.name
+ join `tabItem` item on item.name = `tabSales Invoice Item`.item_code
{sales_team_table}
{payment_term_table}
where
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 9dbcdb0..cbcccce 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -773,6 +773,18 @@
if (
self.doc.doctype == "Sales Invoice"
and self.doc.get("is_pos")
+ and self.doc.get("pos_profile")
+ and self.doc.get("is_consolidated")
+ ):
+ write_off_limit = flt(
+ frappe.db.get_value("POS Profile", self.doc.pos_profile, "write_off_limit")
+ )
+ if write_off_limit and abs(self.doc.outstanding_amount) <= write_off_limit:
+ self.doc.write_off_outstanding_amount_automatically = 1
+
+ if (
+ self.doc.doctype == "Sales Invoice"
+ and self.doc.get("is_pos")
and self.doc.get("is_return")
and not self.doc.get("is_consolidated")
):
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 29b001f..7e1476d 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -562,7 +562,7 @@
let selected_attributes = {};
me.multiple_variant_dialog.$wrapper.find('.form-column').each((i, col) => {
if(i===0) return;
- let attribute_name = $(col).find('label').html().trim();
+ let attribute_name = $(col).find('.control-label').html().trim();
selected_attributes[attribute_name] = [];
let checked_opts = $(col).find('.checkbox input');
checked_opts.each((i, opt) => {
diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json
index 83177b3..8c6f6d8 100644
--- a/erpnext/stock/doctype/item_price/item_price.json
+++ b/erpnext/stock/doctype/item_price/item_price.json
@@ -48,41 +48,31 @@
"oldfieldtype": "Select",
"options": "Item",
"reqd": 1,
- "search_index": 1,
- "show_days": 1,
- "show_seconds": 1
+ "search_index": 1
},
{
"fieldname": "uom",
"fieldtype": "Link",
"label": "UOM",
- "options": "UOM",
- "show_days": 1,
- "show_seconds": 1
+ "options": "UOM"
},
{
"default": "0",
"description": "Quantity that must be bought or sold per UOM",
"fieldname": "packing_unit",
"fieldtype": "Int",
- "label": "Packing Unit",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Packing Unit"
},
{
"fieldname": "column_break_17",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fetch_from": "item_code.brand",
@@ -90,36 +80,29 @@
"fieldtype": "Read Only",
"in_list_view": 1,
"label": "Brand",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "item_description",
"fieldtype": "Text",
"label": "Item Description",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "price_list_details",
"fieldtype": "Section Break",
"label": "Price List",
- "options": "fa fa-tags",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-tags"
},
{
"fieldname": "price_list",
"fieldtype": "Link",
"in_global_search": 1,
+ "in_list_view": 1,
"in_standard_filter": 1,
"label": "Price List",
"options": "Price List",
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"bold": 1,
@@ -127,49 +110,37 @@
"fieldname": "customer",
"fieldtype": "Link",
"label": "Customer",
- "options": "Customer",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Customer"
},
{
"depends_on": "eval:doc.buying == 1",
"fieldname": "supplier",
"fieldtype": "Link",
"label": "Supplier",
- "options": "Supplier",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Supplier"
},
{
"fieldname": "column_break_3",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "buying",
"fieldtype": "Check",
"label": "Buying",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"default": "0",
"fieldname": "selling",
"fieldtype": "Check",
"label": "Selling",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "item_details",
"fieldtype": "Section Break",
- "options": "fa fa-tag",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-tag"
},
{
"bold": 1,
@@ -177,15 +148,11 @@
"fieldtype": "Link",
"label": "Currency",
"options": "Currency",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "col_br_1",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "price_list_rate",
@@ -197,80 +164,61 @@
"oldfieldname": "ref_rate",
"oldfieldtype": "Currency",
"options": "currency",
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"fieldname": "section_break_15",
- "fieldtype": "Section Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Section Break"
},
{
"default": "Today",
"fieldname": "valid_from",
"fieldtype": "Date",
- "label": "Valid From",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Valid From"
},
{
"default": "0",
"fieldname": "lead_time_days",
"fieldtype": "Int",
- "label": "Lead Time in days",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Lead Time in days"
},
{
"fieldname": "column_break_18",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "valid_upto",
"fieldtype": "Date",
- "label": "Valid Upto",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Valid Upto"
},
{
"fieldname": "section_break_24",
- "fieldtype": "Section Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Section Break"
},
{
"fieldname": "note",
"fieldtype": "Text",
- "label": "Note",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Note"
},
{
"fieldname": "reference",
"fieldtype": "Data",
"in_list_view": 1,
- "label": "Reference",
- "show_days": 1,
- "show_seconds": 1
+ "in_standard_filter": 1,
+ "label": "Reference"
},
{
"fieldname": "batch_no",
"fieldtype": "Link",
"label": "Batch No",
- "options": "Batch",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Batch"
}
],
"icon": "fa fa-flag",
"idx": 1,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2020-12-08 18:12:15.395772",
+ "modified": "2022-09-02 16:33:55.612992",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Price",
@@ -307,6 +255,7 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "ASC",
+ "states": [],
"title_field": "item_name",
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_price/item_price_list.js b/erpnext/stock/doctype/item_price/item_price_list.js
new file mode 100644
index 0000000..4815839
--- /dev/null
+++ b/erpnext/stock/doctype/item_price/item_price_list.js
@@ -0,0 +1,3 @@
+frappe.listview_settings['Item Price'] = {
+ hide_name_column: true,
+};