From 55e1592b709d49b5483f0e4a66d1d3edf7a84a0d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 15 Nov 2022 18:50:51 +0530 Subject: [PATCH 01/38] fix: cast POS query inputs to integers (backport #32975) (#32977) fix: cast POS query inputs to integers (#32975) fix: cast POS query inputs to integers (cherry picked from commit c013db6ea18b7c8f88b645d3a71dd785018da8be) Co-authored-by: Ankush Menat --- erpnext/selling/page/point_of_sale/point_of_sale.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py index 13d5069ea6d..5ddebf96f6c 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.py +++ b/erpnext/selling/page/point_of_sale/point_of_sale.py @@ -6,6 +6,7 @@ import json from typing import Dict, Optional import frappe +from frappe.utils import cint from frappe.utils.nestedset import get_root_of from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability @@ -108,10 +109,10 @@ def get_items(start, page_length, price_list, item_group, pos_profile, search_te item.name asc LIMIT {page_length} offset {start}""".format( - start=start, - page_length=page_length, - lft=lft, - rgt=rgt, + start=cint(start), + page_length=cint(page_length), + lft=cint(lft), + rgt=cint(rgt), condition=condition, bin_join_selection=bin_join_selection, bin_join_condition=bin_join_condition, From b473da8f66110e5dd0260fe1a5c4c205de2dd793 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 16 Nov 2022 16:24:28 +0530 Subject: [PATCH 02/38] ci: fix flake8 URL (cherry picked from commit e81bec5fc95f6469d34c5f848be3fd628d4e320a) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dc3011f050f..73aae33e936 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,8 +16,8 @@ repos: - id: check-merge-conflict - id: check-ast - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 hooks: - id: flake8 additional_dependencies: [ From 6aada762970eef2e6ab2d84582678382305f07e6 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 16 Nov 2022 11:57:17 +0530 Subject: [PATCH 03/38] fix: Opening journal entry templates (cherry picked from commit 33b61aef5acd10cf8d690e7aef342916f7d44e6f) --- .../journal_entry_template.js | 15 --------------- 1 file changed, 15 deletions(-) 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 cf5fbe12afe..88f1c9069c8 100644 --- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js +++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js @@ -45,21 +45,6 @@ frappe.ui.form.on("Journal Entry Template", { frm.trigger("clear_child"); switch(frm.doc.voucher_type){ - case "Opening Entry": - frm.set_value("is_opening", "Yes"); - frappe.call({ - type:"GET", - method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_opening_accounts", - args: { - "company": frm.doc.company - }, - callback: function(r) { - if(r.message) { - add_accounts(frm.doc, r.message); - } - } - }); - break; case "Bank Entry": case "Cash Entry": frappe.call({ From 8323775282d99aeb6d6362fccff703aaaa41a9c9 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 8 Nov 2022 18:17:30 +0530 Subject: [PATCH 04/38] feat: Workstation Type for BOM (cherry picked from commit 105c2728169dbf2d186ba156a1cf4207c9c1411a) --- .../doctype/bom_operation/bom_operation.json | 12 +- .../doctype/job_card/job_card.json | 22 ++- .../doctype/job_card/job_card.py | 23 ++- .../doctype/work_order/work_order.js | 1 - .../doctype/work_order/work_order.py | 15 +- .../work_order_operation.json | 10 +- .../doctype/workstation/workstation.json | 33 +++- .../doctype/workstation_type/__init__.py | 0 .../workstation_type/test_workstation_type.py | 9 ++ .../workstation_type/workstation_type.js | 8 + .../workstation_type/workstation_type.json | 146 ++++++++++++++++++ .../workstation_type/workstation_type.py | 15 ++ 12 files changed, 276 insertions(+), 18 deletions(-) create mode 100644 erpnext/manufacturing/doctype/workstation_type/__init__.py create mode 100644 erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py create mode 100644 erpnext/manufacturing/doctype/workstation_type/workstation_type.js create mode 100644 erpnext/manufacturing/doctype/workstation_type/workstation_type.json create mode 100644 erpnext/manufacturing/doctype/workstation_type/workstation_type.py diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json index b965a435bf1..5a734d8684f 100644 --- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json +++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json @@ -9,6 +9,7 @@ "sequence_id", "operation", "col_break1", + "workstation_type", "workstation", "time_in_mins", "fixed_time", @@ -40,9 +41,9 @@ "reqd": 1 }, { + "depends_on": "eval:!doc.workstation_type", "fieldname": "workstation", "fieldtype": "Link", - "in_list_view": 1, "label": "Workstation", "oldfieldname": "workstation", "oldfieldtype": "Link", @@ -180,13 +181,20 @@ "fieldname": "set_cost_based_on_bom_qty", "fieldtype": "Check", "label": "Set Operating Cost Based On BOM Quantity" + }, + { + "fieldname": "workstation_type", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Workstation Type", + "options": "Workstation Type" } ], "idx": 1, "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2022-04-08 01:18:33.547481", + "modified": "2022-11-04 17:17:16.986941", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Operation", diff --git a/erpnext/manufacturing/doctype/job_card/job_card.json b/erpnext/manufacturing/doctype/job_card/job_card.json index 5a071f1da65..85061113cea 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.json +++ b/erpnext/manufacturing/doctype/job_card/job_card.json @@ -27,11 +27,14 @@ "operation", "operation_row_number", "column_break_18", + "workstation_type", "workstation", "employee", "section_break_21", "sub_operations", "timing_detail", + "expected_start_date", + "expected_end_date", "time_logs", "section_break_13", "total_completed_qty", @@ -416,11 +419,27 @@ "fieldtype": "Link", "label": "Quality Inspection Template", "options": "Quality Inspection Template" + }, + { + "fieldname": "workstation_type", + "fieldtype": "Link", + "label": "Workstation Type", + "options": "Workstation Type" + }, + { + "fieldname": "expected_start_date", + "fieldtype": "Datetime", + "label": "Expected Start Date" + }, + { + "fieldname": "expected_end_date", + "fieldtype": "Datetime", + "label": "Expected End Date" } ], "is_submittable": 1, "links": [], - "modified": "2021-11-24 19:17:40.879235", + "modified": "2022-11-09 15:02:44.490731", "modified_by": "Administrator", "module": "Manufacturing", "name": "Job Card", @@ -475,6 +494,7 @@ ], "sort_field": "modified", "sort_order": "DESC", + "states": [], "title_field": "operation", "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index 17b77285c02..822647526f7 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -2,6 +2,7 @@ # For license information, please see license.txt import datetime import json +from typing import Optional import frappe from frappe import _, bold @@ -26,6 +27,7 @@ from frappe.utils import ( from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import ( get_mins_between_operations, ) +from erpnext.manufacturing.doctype.workstation_type.workstation_type import get_workstations class OverlapError(frappe.ValidationError): @@ -129,7 +131,7 @@ class JobCard(Document): query = ( frappe.qb.from_(jctl) .from_(jc) - .select(jc.name.as_("name"), jctl.to_time) + .select(jc.name.as_("name"), jctl.to_time, jc.workstation, jc.workstation_type) .where( (jctl.parent == jc.name) & (Criterion.any(time_conditions)) @@ -140,6 +142,9 @@ class JobCard(Document): .orderby(jctl.to_time, order=frappe.qb.desc) ) + if self.workstation_type: + query = query.where(jc.workstation_type == self.workstation_type) + if self.workstation: production_capacity = ( frappe.get_cached_value("Workstation", self.workstation, "production_capacity") or 1 @@ -156,8 +161,21 @@ class JobCard(Document): if existing and production_capacity > len(existing): return + if self.workstation_type: + if workstation := self.get_workstation_based_on_available_slot(existing): + self.workstation = workstation + return None + return existing[0] if existing else None + def get_workstation_based_on_available_slot(self, existing) -> Optional[str]: + workstations = get_workstations(self.workstation_type) + if workstations: + busy_workstations = [row.workstation for row in existing] + for workstation in workstations: + if workstation not in busy_workstations: + return workstation + def schedule_time_logs(self, row): row.remaining_time_in_mins = row.time_in_mins while row.remaining_time_in_mins > 0: @@ -170,6 +188,9 @@ class JobCard(Document): # get the last record based on the to time from the job card data = self.get_overlap_for(args, check_next_available_slot=True) if data: + if not self.workstation: + self.workstation = data.workstation + row.planned_start_time = get_datetime(data.to_time + get_mins_between_operations()) def check_workstation_time(self, row): diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index 62476182485..4aff42cb73d 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -446,7 +446,6 @@ frappe.ui.form.on("Work Order", { frm.fields_dict.required_items.grid.toggle_reqd("source_warehouse", true); frm.toggle_reqd("transfer_material_against", frm.doc.operations && frm.doc.operations.length > 0); - frm.fields_dict.operations.grid.toggle_reqd("workstation", frm.doc.operations); }, set_sales_order: function(frm) { diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 81673856f76..4dd95a1a336 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -87,11 +87,19 @@ class WorkOrder(Document): self.validate_transfer_against() self.validate_operation_time() self.status = self.get_status() + self.validate_workstation_type() validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"]) self.set_required_items(reset_only_qty=len(self.get("required_items"))) + def validate_workstation_type(self): + for row in self.operations: + if not row.workstation and not row.workstation_type: + frappe.throw( + _(f"Row {row.idx}: Workstation or Workstation Type is mandatory for {row.operation}") + ) + def validate_sales_order(self): if self.sales_order: self.check_sales_order_on_hold_or_close() @@ -491,11 +499,6 @@ class WorkOrder(Document): def prepare_data_for_job_card(self, row, index, plan_days, enable_capacity_planning): self.set_operation_start_end_time(index, row) - if not row.workstation: - frappe.throw( - _("Row {0}: select the workstation against the operation {1}").format(row.idx, row.operation) - ) - original_start_time = row.planned_start_time job_card_doc = create_job_card( self, row, auto_create=True, enable_capacity_planning=enable_capacity_planning @@ -662,6 +665,7 @@ class WorkOrder(Document): "description", "workstation", "idx", + "workstation_type", "base_hour_rate as hour_rate", "time_in_mins", "parent as bom", @@ -1398,6 +1402,7 @@ def create_job_card(work_order, row, enable_capacity_planning=False, auto_create doc.update( { "work_order": work_order.name, + "workstation_type": row.get("workstation_type"), "operation": row.get("operation"), "workstation": row.get("workstation"), "posting_date": nowdate(), diff --git a/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json b/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json index 4e1a464cb05..31b920145e0 100644 --- a/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json +++ b/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json @@ -10,6 +10,7 @@ "completed_qty", "column_break_4", "bom", + "workstation_type", "workstation", "sequence_id", "section_break_10", @@ -196,12 +197,18 @@ { "fieldname": "section_break_10", "fieldtype": "Section Break" + }, + { + "fieldname": "workstation_type", + "fieldtype": "Link", + "label": "Workstation Type", + "options": "Workstation Type" } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2021-11-29 16:37:18.824489", + "modified": "2022-11-09 01:37:56.563068", "modified_by": "Administrator", "module": "Manufacturing", "name": "Work Order Operation", @@ -209,5 +216,6 @@ "permissions": [], "sort_field": "modified", "sort_order": "DESC", + "states": [], "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/workstation/workstation.json b/erpnext/manufacturing/doctype/workstation/workstation.json index d130391cece..881cba0cce0 100644 --- a/erpnext/manufacturing/doctype/workstation/workstation.json +++ b/erpnext/manufacturing/doctype/workstation/workstation.json @@ -1,26 +1,30 @@ { + "actions": [], "allow_import": 1, "allow_rename": 1, "autoname": "field:workstation_name", "creation": "2013-01-10 16:34:17", "doctype": "DocType", "document_type": "Setup", + "engine": "InnoDB", "field_order": [ "workstation_name", "production_capacity", "column_break_3", + "workstation_type", "over_heads", "hour_rate_electricity", "hour_rate_consumable", "column_break_11", "hour_rate_rent", "hour_rate_labour", + "section_break_11", "hour_rate", + "workstaion_description", + "description", "working_hours_section", "holiday_list", - "working_hours", - "workstaion_description", - "description" + "working_hours" ], "fields": [ { @@ -44,7 +48,7 @@ }, { "fieldname": "over_heads", - "fieldtype": "Section Break", + "fieldtype": "Tab Break", "label": "Operating Costs", "oldfieldtype": "Section Break" }, @@ -99,7 +103,7 @@ }, { "fieldname": "working_hours_section", - "fieldtype": "Section Break", + "fieldtype": "Tab Break", "label": "Working Hours" }, { @@ -128,16 +132,29 @@ { "collapsible": 1, "fieldname": "workstaion_description", - "fieldtype": "Section Break", + "fieldtype": "Tab Break", "label": "Description" + }, + { + "bold": 1, + "fieldname": "workstation_type", + "fieldtype": "Link", + "label": "Workstation Type", + "options": "Workstation Type" + }, + { + "fieldname": "section_break_11", + "fieldtype": "Section Break" } ], "icon": "icon-wrench", "idx": 1, - "modified": "2019-11-26 12:39:19.742052", + "links": [], + "modified": "2022-11-04 17:39:01.549346", "modified_by": "Administrator", "module": "Manufacturing", "name": "Workstation", + "naming_rule": "By fieldname", "owner": "Administrator", "permissions": [ { @@ -154,6 +171,8 @@ ], "quick_entry": 1, "show_name_in_global_search": 1, + "sort_field": "modified", "sort_order": "ASC", + "states": [], "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/workstation_type/__init__.py b/erpnext/manufacturing/doctype/workstation_type/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py new file mode 100644 index 00000000000..9e7a54dbe34 --- /dev/null +++ b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py @@ -0,0 +1,9 @@ +# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestWorkstationType(FrappeTestCase): + pass diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.js b/erpnext/manufacturing/doctype/workstation_type/workstation_type.js new file mode 100644 index 00000000000..419fa6c10ad --- /dev/null +++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.js @@ -0,0 +1,8 @@ +// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Workstation Type', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.json b/erpnext/manufacturing/doctype/workstation_type/workstation_type.json new file mode 100644 index 00000000000..86321cf2ffe --- /dev/null +++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.json @@ -0,0 +1,146 @@ +{ + "actions": [], + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:workstation_type", + "creation": "2022-11-04 17:03:23.334818", + "default_view": "List", + "doctype": "DocType", + "document_type": "Setup", + "engine": "InnoDB", + "field_order": [ + "workstation_type", + "over_heads", + "hour_rate_electricity", + "hour_rate_consumable", + "column_break_5", + "hour_rate_rent", + "hour_rate_labour", + "section_break_8", + "hour_rate", + "description_tab", + "description", + "holiday_tab", + "holiday_list" + ], + "fields": [ + { + "fieldname": "workstation_type", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Workstation Type", + "oldfieldname": "workstation_name", + "oldfieldtype": "Data", + "reqd": 1, + "unique": 1 + }, + { + "fieldname": "over_heads", + "fieldtype": "Section Break", + "label": "Operating Costs", + "oldfieldtype": "Section Break" + }, + { + "description": "per hour", + "fieldname": "hour_rate_electricity", + "fieldtype": "Currency", + "label": "Electricity Cost", + "oldfieldname": "hour_rate_electricity", + "oldfieldtype": "Currency" + }, + { + "description": "per hour", + "fieldname": "hour_rate_consumable", + "fieldtype": "Currency", + "label": "Consumable Cost", + "oldfieldname": "hour_rate_consumable", + "oldfieldtype": "Currency" + }, + { + "description": "per hour", + "fieldname": "hour_rate_rent", + "fieldtype": "Currency", + "label": "Rent Cost", + "oldfieldname": "hour_rate_rent", + "oldfieldtype": "Currency" + }, + { + "description": "Wages per hour", + "fieldname": "hour_rate_labour", + "fieldtype": "Currency", + "label": "Wages", + "oldfieldname": "hour_rate_labour", + "oldfieldtype": "Currency" + }, + { + "description": "per hour", + "fieldname": "hour_rate", + "fieldtype": "Currency", + "label": "Net Hour Rate", + "oldfieldname": "hour_rate", + "oldfieldtype": "Currency", + "read_only": 1 + }, + { + "fieldname": "holiday_list", + "fieldtype": "Link", + "label": "Holiday List", + "options": "Holiday List" + }, + { + "fieldname": "description", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Text", + "width": "300px" + }, + { + "fieldname": "column_break_5", + "fieldtype": "Column Break" + }, + { + "collapsible": 1, + "fieldname": "description_tab", + "fieldtype": "Tab Break", + "label": "Description" + }, + { + "fieldname": "holiday_tab", + "fieldtype": "Tab Break", + "label": "Holiday" + }, + { + "fieldname": "section_break_8", + "fieldtype": "Section Break" + } + ], + "icon": "icon-wrench", + "links": [], + "modified": "2022-11-04 17:30:33.397719", + "modified_by": "Administrator", + "module": "Manufacturing", + "name": "Workstation Type", + "naming_rule": "By fieldname", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing User", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "ASC", + "states": [], + "track_changes": 1 +} \ No newline at end of file diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/workstation_type.py new file mode 100644 index 00000000000..b097755abb3 --- /dev/null +++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.py @@ -0,0 +1,15 @@ +# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +import frappe +from frappe.model.document import Document + + +class WorkstationType(Document): + pass + + +def get_workstations(workstation_type): + workstations = frappe.get_all("Workstation", filters={"workstation_type": workstation_type}) + + return [workstation.name for workstation in workstations] From bb337455b942fc8e5a64f455d585ced44cc02243 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 14 Nov 2022 12:58:17 +0530 Subject: [PATCH 05/38] test: test case to check workstation type (cherry picked from commit 7bd06e6fbc30ebd92b18055983e3b88fa9545e2a) --- .../doctype/work_order/test_work_order.py | 162 ++++++++- .../doctype/workstation/test_workstation.py | 1 + .../doctype/workstation/workstation.js | 14 +- .../doctype/workstation/workstation.py | 30 +- .../workstation_type/test_workstation_type.py | 14 +- .../workstation_type/workstation_type.json | 17 +- .../workstation_type/workstation_type.py | 12 +- .../manufacturing/manufacturing.json | 336 +++++++++--------- 8 files changed, 403 insertions(+), 183 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 804f03dc519..694dc79d4a9 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -5,7 +5,7 @@ import copy import frappe from frappe.tests.utils import FrappeTestCase, change_settings, timeout -from frappe.utils import add_days, add_months, cint, flt, now, today +from frappe.utils import add_days, add_months, add_to_date, cint, flt, now, today from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom @@ -1480,6 +1480,166 @@ class TestWorkOrder(FrappeTestCase): for row in return_ste_doc.items: self.assertEqual(row.qty, 2) + def test_workstation_type_for_work_order(self): + prepare_data_for_workstation_type_check() + + workstation_types = ["Workstation Type 1", "Workstation Type 2", "Workstation Type 3"] + planned_start_date = "2022-11-14 10:00:00" + + wo_order = make_wo_order_test_record( + item="Test FG Item For Workstation Type", planned_start_date=planned_start_date, qty=2 + ) + + job_cards = frappe.get_all( + "Job Card", + fields=[ + "`tabJob Card`.`name`", + "`tabJob Card`.`workstation_type`", + "`tabJob Card`.`workstation`", + "`tabJob Card Time Log`.`from_time`", + "`tabJob Card Time Log`.`to_time`", + "`tabJob Card Time Log`.`time_in_mins`", + ], + filters=[ + ["Job Card", "work_order", "=", wo_order.name], + ["Job Card Time Log", "docstatus", "=", 1], + ], + order_by="`tabJob Card`.`creation` desc", + ) + + workstations_to_check = ["Workstation 1", "Workstation 3", "Workstation 5"] + for index, row in enumerate(job_cards): + if index != 0: + planned_start_date = add_to_date(planned_start_date, minutes=40) + + self.assertEqual(row.workstation_type, workstation_types[index]) + self.assertEqual(row.from_time, planned_start_date) + self.assertEqual(row.to_time, add_to_date(planned_start_date, minutes=30)) + self.assertEqual(row.workstation, workstations_to_check[index]) + + planned_start_date = "2022-11-14 10:00:00" + + wo_order = make_wo_order_test_record( + item="Test FG Item For Workstation Type", planned_start_date=planned_start_date, qty=2 + ) + + job_cards = frappe.get_all( + "Job Card", + fields=[ + "`tabJob Card`.`name`", + "`tabJob Card`.`workstation_type`", + "`tabJob Card`.`workstation`", + "`tabJob Card Time Log`.`from_time`", + "`tabJob Card Time Log`.`to_time`", + "`tabJob Card Time Log`.`time_in_mins`", + ], + filters=[ + ["Job Card", "work_order", "=", wo_order.name], + ["Job Card Time Log", "docstatus", "=", 1], + ], + order_by="`tabJob Card`.`creation` desc", + ) + + workstations_to_check = ["Workstation 2", "Workstation 4", "Workstation 6"] + for index, row in enumerate(job_cards): + if index != 0: + planned_start_date = add_to_date(planned_start_date, minutes=40) + + self.assertEqual(row.workstation_type, workstation_types[index]) + self.assertEqual(row.from_time, planned_start_date) + self.assertEqual(row.to_time, add_to_date(planned_start_date, minutes=30)) + self.assertEqual(row.workstation, workstations_to_check[index]) + + +def prepare_data_for_workstation_type_check(): + from erpnext.manufacturing.doctype.operation.test_operation import make_operation + from erpnext.manufacturing.doctype.workstation.test_workstation import make_workstation + from erpnext.manufacturing.doctype.workstation_type.test_workstation_type import ( + create_workstation_type, + ) + + workstation_types = ["Workstation Type 1", "Workstation Type 2", "Workstation Type 3"] + for workstation_type in workstation_types: + create_workstation_type(workstation_type=workstation_type) + + operations = ["Cutting", "Sewing", "Packing"] + for operation in operations: + make_operation( + { + "operation": operation, + } + ) + + workstations = [ + { + "workstation": "Workstation 1", + "workstation_type": "Workstation Type 1", + }, + { + "workstation": "Workstation 2", + "workstation_type": "Workstation Type 1", + }, + { + "workstation": "Workstation 3", + "workstation_type": "Workstation Type 2", + }, + { + "workstation": "Workstation 4", + "workstation_type": "Workstation Type 2", + }, + { + "workstation": "Workstation 5", + "workstation_type": "Workstation Type 3", + }, + { + "workstation": "Workstation 6", + "workstation_type": "Workstation Type 3", + }, + ] + + for row in workstations: + make_workstation(row) + + fg_item = make_item( + "Test FG Item For Workstation Type", + { + "is_stock_item": 1, + }, + ) + + rm_item = make_item( + "Test RM Item For Workstation Type", + { + "is_stock_item": 1, + }, + ) + + if not frappe.db.exists("BOM", {"item": fg_item.name}): + bom_doc = make_bom( + item=fg_item.name, + source_warehouse="Stores - _TC", + raw_materials=[rm_item.name], + do_not_submit=True, + ) + + submit_bom = False + for index, operation in enumerate(operations): + if not frappe.db.exists("BOM Operation", {"parent": bom_doc.name, "operation": operation}): + bom_doc.append( + "operations", + { + "operation": operation, + "time_in_mins": 30, + "hour_rate": 100, + "workstation_type": workstation_types[index], + }, + ) + + submit_bom = True + + if submit_bom: + bom_doc.submit() + def prepare_data_for_backflush_based_on_materials_transferred(): batch_item_doc = make_item( diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py index 6db985c8c2e..1eb47ae577b 100644 --- a/erpnext/manufacturing/doctype/workstation/test_workstation.py +++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py @@ -107,6 +107,7 @@ def make_workstation(*args, **kwargs): doc = frappe.get_doc({"doctype": "Workstation", "workstation_name": workstation_name}) doc.hour_rate_rent = args.get("hour_rate_rent") doc.hour_rate_labour = args.get("hour_rate_labour") + doc.workstation_type = args.get("workstation_type") doc.insert() return doc diff --git a/erpnext/manufacturing/doctype/workstation/workstation.js b/erpnext/manufacturing/doctype/workstation/workstation.js index 5b9cedb6f98..f830b170ed0 100644 --- a/erpnext/manufacturing/doctype/workstation/workstation.js +++ b/erpnext/manufacturing/doctype/workstation/workstation.js @@ -2,7 +2,7 @@ // License: GNU General Public License v3. See license.txt frappe.ui.form.on("Workstation", { - onload: function(frm) { + onload(frm) { if(frm.is_new()) { frappe.call({ @@ -15,6 +15,18 @@ frappe.ui.form.on("Workstation", { } }) } + }, + + workstation_type(frm) { + if (frm.doc.workstation_type) { + frm.call({ + method: "set_data_based_on_workstation_type", + doc: frm.doc, + callback: function(r) { + frm.refresh_fields(); + } + }) + } } }); diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py index 5e57fcd8e96..fabd254d8f6 100644 --- a/erpnext/manufacturing/doctype/workstation/workstation.py +++ b/erpnext/manufacturing/doctype/workstation/workstation.py @@ -32,7 +32,11 @@ class OverlapError(frappe.ValidationError): class Workstation(Document): - def validate(self): + def before_save(self): + self.set_data_based_on_workstation_type() + self.set_hour_rate() + + def set_hour_rate(self): self.hour_rate = ( flt(self.hour_rate_labour) + flt(self.hour_rate_electricity) @@ -40,6 +44,30 @@ class Workstation(Document): + flt(self.hour_rate_rent) ) + @frappe.whitelist() + def set_data_based_on_workstation_type(self): + if self.workstation_type: + fields = [ + "hour_rate_labour", + "hour_rate_electricity", + "hour_rate_consumable", + "hour_rate_rent", + "hour_rate", + "description", + ] + + data = frappe.get_cached_value("Workstation Type", self.workstation_type, fields, as_dict=True) + + if not data: + return + + for field in fields: + if self.get(field): + continue + + if value := data.get(field): + self.set(field, value) + def on_update(self): self.validate_overlap_for_operation_timings() self.update_bom_operation() diff --git a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py index 9e7a54dbe34..aa7a3ee92f6 100644 --- a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py +++ b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py @@ -1,9 +1,21 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -# import frappe +import frappe from frappe.tests.utils import FrappeTestCase class TestWorkstationType(FrappeTestCase): pass + + +def create_workstation_type(**args): + args = frappe._dict(args) + + if workstation_type := frappe.db.exists("Workstation Type", args.workstation_type): + return frappe.get_doc("Workstation Type", workstation_type) + else: + doc = frappe.new_doc("Workstation Type") + doc.update(args) + doc.insert() + return doc diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.json b/erpnext/manufacturing/doctype/workstation_type/workstation_type.json index 86321cf2ffe..7d9e36abb45 100644 --- a/erpnext/manufacturing/doctype/workstation_type/workstation_type.json +++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.json @@ -19,9 +19,7 @@ "section_break_8", "hour_rate", "description_tab", - "description", - "holiday_tab", - "holiday_list" + "description" ], "fields": [ { @@ -81,12 +79,6 @@ "oldfieldtype": "Currency", "read_only": 1 }, - { - "fieldname": "holiday_list", - "fieldtype": "Link", - "label": "Holiday List", - "options": "Holiday List" - }, { "fieldname": "description", "fieldtype": "Small Text", @@ -106,11 +98,6 @@ "fieldtype": "Tab Break", "label": "Description" }, - { - "fieldname": "holiday_tab", - "fieldtype": "Tab Break", - "label": "Holiday" - }, { "fieldname": "section_break_8", "fieldtype": "Section Break" @@ -118,7 +105,7 @@ ], "icon": "icon-wrench", "links": [], - "modified": "2022-11-04 17:30:33.397719", + "modified": "2022-11-16 23:11:36.224249", "modified_by": "Administrator", "module": "Manufacturing", "name": "Workstation Type", diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/workstation_type.py index b097755abb3..348f4f8a161 100644 --- a/erpnext/manufacturing/doctype/workstation_type/workstation_type.py +++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.py @@ -3,10 +3,20 @@ import frappe from frappe.model.document import Document +from frappe.utils import flt class WorkstationType(Document): - pass + def before_save(self): + self.set_hour_rate() + + def set_hour_rate(self): + self.hour_rate = ( + flt(self.hour_rate_labour) + + flt(self.hour_rate_electricity) + + flt(self.hour_rate_consumable) + + flt(self.hour_rate_rent) + ) def get_workstations(workstation_type): diff --git a/erpnext/manufacturing/workspace/manufacturing/manufacturing.json b/erpnext/manufacturing/workspace/manufacturing/manufacturing.json index 549f5afc707..c25f606060f 100644 --- a/erpnext/manufacturing/workspace/manufacturing/manufacturing.json +++ b/erpnext/manufacturing/workspace/manufacturing/manufacturing.json @@ -73,168 +73,6 @@ "onboard": 0, "type": "Link" }, - { - "hidden": 0, - "is_query_report": 0, - "label": "Bill of Materials", - "link_count": 0, - "onboard": 0, - "type": "Card Break" - }, - { - "dependencies": "", - "hidden": 0, - "is_query_report": 0, - "label": "Item", - "link_count": 0, - "link_to": "Item", - "link_type": "DocType", - "onboard": 1, - "type": "Link" - }, - { - "dependencies": "Item", - "hidden": 0, - "is_query_report": 0, - "label": "Bill of Materials", - "link_count": 0, - "link_to": "BOM", - "link_type": "DocType", - "onboard": 1, - "type": "Link" - }, - { - "dependencies": "", - "hidden": 0, - "is_query_report": 0, - "label": "Workstation", - "link_count": 0, - "link_to": "Workstation", - "link_type": "DocType", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "", - "hidden": 0, - "is_query_report": 0, - "label": "Operation", - "link_count": 0, - "link_to": "Operation", - "link_type": "DocType", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "", - "hidden": 0, - "is_query_report": 0, - "label": "Routing", - "link_count": 0, - "link_to": "Routing", - "link_type": "DocType", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "Work Order", - "hidden": 0, - "is_query_report": 1, - "label": "Production Planning Report", - "link_count": 0, - "link_to": "Production Planning Report", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "Work Order", - "hidden": 0, - "is_query_report": 1, - "label": "Work Order Summary", - "link_count": 0, - "link_to": "Work Order Summary", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "Quality Inspection", - "hidden": 0, - "is_query_report": 1, - "label": "Quality Inspection Summary", - "link_count": 0, - "link_to": "Quality Inspection Summary", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "Downtime Entry", - "hidden": 0, - "is_query_report": 1, - "label": "Downtime Analysis", - "link_count": 0, - "link_to": "Downtime Analysis", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "Job Card", - "hidden": 0, - "is_query_report": 1, - "label": "Job Card Summary", - "link_count": 0, - "link_to": "Job Card Summary", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "BOM", - "hidden": 0, - "is_query_report": 1, - "label": "BOM Search", - "link_count": 0, - "link_to": "BOM Search", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "BOM", - "hidden": 0, - "is_query_report": 1, - "label": "BOM Stock Report", - "link_count": 0, - "link_to": "BOM Stock Report", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "Work Order", - "hidden": 0, - "is_query_report": 1, - "label": "Production Analytics", - "link_count": 0, - "link_to": "Production Analytics", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, - { - "dependencies": "BOM", - "hidden": 0, - "is_query_report": 1, - "label": "BOM Operations Time", - "link_count": 0, - "link_to": "BOM Operations Time", - "link_type": "Report", - "onboard": 0, - "type": "Link" - }, { "hidden": 0, "is_query_report": 0, @@ -400,9 +238,181 @@ "link_type": "Report", "onboard": 0, "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "Bill of Materials", + "link_count": 15, + "onboard": 0, + "type": "Card Break" + }, + { + "dependencies": "", + "hidden": 0, + "is_query_report": 0, + "label": "Item", + "link_count": 0, + "link_to": "Item", + "link_type": "DocType", + "onboard": 1, + "type": "Link" + }, + { + "dependencies": "Item", + "hidden": 0, + "is_query_report": 0, + "label": "Bill of Materials", + "link_count": 0, + "link_to": "BOM", + "link_type": "DocType", + "onboard": 1, + "type": "Link" + }, + { + "dependencies": "", + "hidden": 0, + "is_query_report": 0, + "label": "Workstation Type", + "link_count": 0, + "link_to": "Workstation Type", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "", + "hidden": 0, + "is_query_report": 0, + "label": "Workstation", + "link_count": 0, + "link_to": "Workstation", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "", + "hidden": 0, + "is_query_report": 0, + "label": "Operation", + "link_count": 0, + "link_to": "Operation", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "Work Order", + "hidden": 0, + "is_query_report": 1, + "label": "Routing", + "link_count": 0, + "link_to": "Routing", + "link_type": "DocType", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "Work Order", + "hidden": 0, + "is_query_report": 1, + "label": "Production Planning Report", + "link_count": 0, + "link_to": "Production Planning Report", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "Quality Inspection", + "hidden": 0, + "is_query_report": 1, + "label": "Work Order Summary", + "link_count": 0, + "link_to": "Work Order Summary", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "Downtime Entry", + "hidden": 0, + "is_query_report": 1, + "label": "Quality Inspection Summary", + "link_count": 0, + "link_to": "Quality Inspection Summary", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "Job Card", + "hidden": 0, + "is_query_report": 1, + "label": "Downtime Analysis", + "link_count": 0, + "link_to": "Downtime Analysis", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "BOM", + "hidden": 0, + "is_query_report": 1, + "label": "Job Card Summary", + "link_count": 0, + "link_to": "Job Card Summary", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "BOM", + "hidden": 0, + "is_query_report": 1, + "label": "BOM Search", + "link_count": 0, + "link_to": "BOM Search", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "Work Order", + "hidden": 0, + "is_query_report": 1, + "label": "BOM Stock Report", + "link_count": 0, + "link_to": "BOM Stock Report", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "dependencies": "BOM", + "hidden": 0, + "is_query_report": 1, + "label": "Production Analytics", + "link_count": 0, + "link_to": "Production Analytics", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, + { + "hidden": 0, + "is_query_report": 0, + "label": "BOM Operations Time", + "link_count": 0, + "link_to": "BOM Operations Time", + "link_type": "Report", + "onboard": 0, + "type": "Link" } ], - "modified": "2022-06-15 15:18:57.062935", + "modified": "2022-11-14 14:53:34.616862", "modified_by": "Administrator", "module": "Manufacturing", "name": "Manufacturing", From 24aafb3866174214087da2c38728d321b3d04968 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 16 Nov 2022 23:23:06 +0530 Subject: [PATCH 06/38] fix: linters failing (cherry picked from commit ffa30127e7e449de7ef88316f7d83339b91a98bb) --- erpnext/manufacturing/doctype/work_order/work_order.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 4dd95a1a336..52753a092d4 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -96,9 +96,8 @@ class WorkOrder(Document): def validate_workstation_type(self): for row in self.operations: if not row.workstation and not row.workstation_type: - frappe.throw( - _(f"Row {row.idx}: Workstation or Workstation Type is mandatory for {row.operation}") - ) + msg = f"Row {row.idx}: Workstation or Workstation Type is mandatory for an operation {row.operation}" + frappe.throw(_(msg)) def validate_sales_order(self): if self.sales_order: From 9a737afb771884c28e8815eec297a074e8445556 Mon Sep 17 00:00:00 2001 From: Ritwik Puri Date: Thu, 17 Nov 2022 11:59:42 +0530 Subject: [PATCH 07/38] chore(patch): remove reload_doc from post model sync update_exchange_rate_settings patch (#32994) [skip ci] (cherry picked from commit b03b568e6cc7bcab31e4c6a3fd98f17f0eb65c1f) --- erpnext/patches/v13_0/update_exchange_rate_settings.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/erpnext/patches/v13_0/update_exchange_rate_settings.py b/erpnext/patches/v13_0/update_exchange_rate_settings.py index ed11c627d97..746195f2e13 100644 --- a/erpnext/patches/v13_0/update_exchange_rate_settings.py +++ b/erpnext/patches/v13_0/update_exchange_rate_settings.py @@ -1,10 +1,5 @@ -import frappe - from erpnext.setup.install import setup_currency_exchange def execute(): - frappe.reload_doc("accounts", "doctype", "currency_exchange_settings_result") - frappe.reload_doc("accounts", "doctype", "currency_exchange_settings_details") - frappe.reload_doc("accounts", "doctype", "currency_exchange_settings") setup_currency_exchange() From 1db83247ce9b916849da3cedc82b08b34f335339 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 17 Nov 2022 11:58:05 +0530 Subject: [PATCH 08/38] chore: hardcode doctype --- erpnext/assets/doctype/location/location.py | 4 ++-- .../doctype/quality_procedure/quality_procedure.py | 2 +- erpnext/setup/doctype/company/company.py | 4 ++-- erpnext/setup/doctype/department/department.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/assets/doctype/location/location.py b/erpnext/assets/doctype/location/location.py index 0d87bb2bf4d..5bff3dd8c99 100644 --- a/erpnext/assets/doctype/location/location.py +++ b/erpnext/assets/doctype/location/location.py @@ -200,11 +200,11 @@ def get_children(doctype, parent=None, location=None, is_root=False): name as value, is_group as expandable from - `tab{doctype}` comp + `tabLocation` comp where ifnull(parent_location, "")={parent} """.format( - doctype=doctype, parent=frappe.db.escape(parent) + parent=frappe.db.escape(parent) ), as_dict=1, ) diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py index 72f9e6d6e44..e8604080fbf 100644 --- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py +++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py @@ -79,7 +79,7 @@ def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=Fa ] else: return frappe.get_all( - doctype, + "Quality Procedure", fields=["name as value", "is_group as expandable"], filters=dict(parent_quality_procedure=parent), order_by="name asc", diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 875f63da63b..d6f23780942 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -689,11 +689,11 @@ def get_children(doctype, parent=None, company=None, is_root=False): name as value, is_group as expandable from - `tab{doctype}` comp + `tabCompany` comp where ifnull(parent_company, "")={parent} """.format( - doctype=doctype, parent=frappe.db.escape(parent) + parent=frappe.db.escape(parent) ), as_dict=1, ) diff --git a/erpnext/setup/doctype/department/department.py b/erpnext/setup/doctype/department/department.py index c4766ee6f8e..1745178574b 100644 --- a/erpnext/setup/doctype/department/department.py +++ b/erpnext/setup/doctype/department/department.py @@ -63,7 +63,7 @@ def get_children(doctype, parent=None, company=None, is_root=False): else: filters["parent_department"] = parent - return frappe.get_all(doctype, fields=fields, filters=filters, order_by="name") + return frappe.get_all("Department", fields=fields, filters=filters, order_by="name") @frappe.whitelist() From 4c0b5ceb9e272a9c98f7207cf4b6c84711fb1c53 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 17 Nov 2022 13:06:46 +0530 Subject: [PATCH 09/38] refactor: search queries (backport #33004) (#33007) refactor: search queries (#33004) - guard clauses for readability - use values or format (cherry picked from commit 34e4903ed7936c35176d6031a16d1a27654dcb40) Co-authored-by: Ankush Menat --- .../request_for_quotation.py | 19 +-- .../material_request/material_request.py | 12 +- .../quality_inspection/quality_inspection.py | 119 +++++++++--------- 3 files changed, 78 insertions(+), 72 deletions(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py index a560bdacb2a..bdbc9ce0b73 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -478,7 +478,7 @@ def get_rfq_containing_supplier(doctype, txt, searchfield, start, page_len, filt conditions += "and rfq.transaction_date = '{0}'".format(filters.get("transaction_date")) rfq_data = frappe.db.sql( - """ + f""" select distinct rfq.name, rfq.transaction_date, rfq.company @@ -486,15 +486,18 @@ def get_rfq_containing_supplier(doctype, txt, searchfield, start, page_len, filt `tabRequest for Quotation` rfq, `tabRequest for Quotation Supplier` rfq_supplier where rfq.name = rfq_supplier.parent - and rfq_supplier.supplier = '{0}' + and rfq_supplier.supplier = %(supplier)s and rfq.docstatus = 1 - and rfq.company = '{1}' - {2} + and rfq.company = %(company)s + {conditions} order by rfq.transaction_date ASC - limit %(page_len)s offset %(start)s """.format( - filters.get("supplier"), filters.get("company"), conditions - ), - {"page_len": page_len, "start": start}, + limit %(page_len)s offset %(start)s """, + { + "page_len": page_len, + "start": start, + "company": filters.get("company"), + "supplier": filters.get("supplier"), + }, as_dict=1, ) diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 817248ef3d9..04aee423647 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -10,7 +10,7 @@ import json import frappe from frappe import _, msgprint from frappe.model.mapper import get_mapped_doc -from frappe.utils import cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate +from frappe.utils import cint, cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate from erpnext.buying.utils import check_on_hold_or_closed_status, validate_for_items from erpnext.controllers.buying_controller import BuyingController @@ -500,13 +500,13 @@ def get_material_requests_based_on_supplier(doctype, txt, searchfield, start, pa and mr.per_ordered < 99.99 and mr.docstatus = 1 and mr.status != 'Stopped' - and mr.company = '{1}' - {2} + and mr.company = %s + {1} order by mr_item.item_code ASC - limit {3} offset {4} """.format( - ", ".join(["%s"] * len(supplier_items)), filters.get("company"), conditions, page_len, start + limit {2} offset {3} """.format( + ", ".join(["%s"] * len(supplier_items)), conditions, cint(page_len), cint(start) ), - tuple(supplier_items), + tuple(supplier_items) + (filters.get("company"),), as_dict=1, ) diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py index 8ffd3f2ad10..e44e1b7e9d6 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py @@ -6,7 +6,7 @@ import frappe from frappe import _ from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc -from frappe.utils import cint, flt +from frappe.utils import cint, cstr, flt from erpnext.stock.doctype.quality_inspection_template.quality_inspection_template import ( get_template_details, @@ -219,68 +219,71 @@ class QualityInspection(Document): @frappe.whitelist() @frappe.validate_and_sanitize_search_inputs def item_query(doctype, txt, searchfield, start, page_len, filters): - if filters.get("from"): - from frappe.desk.reportview import get_match_cond + from frappe.desk.reportview import get_match_cond - mcond = get_match_cond(filters["from"]) - cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')" + from_doctype = cstr(filters.get("doctype")) + if not from_doctype or not frappe.db.exist("DocType", from_doctype): + return [] - if filters.get("parent"): - if ( - filters.get("from") in ["Purchase Invoice Item", "Purchase Receipt Item"] - and filters.get("inspection_type") != "In Process" - ): - cond = """and item_code in (select name from `tabItem` where - inspection_required_before_purchase = 1)""" - elif ( - filters.get("from") in ["Sales Invoice Item", "Delivery Note Item"] - and filters.get("inspection_type") != "In Process" - ): - cond = """and item_code in (select name from `tabItem` where - inspection_required_before_delivery = 1)""" - elif filters.get("from") == "Stock Entry Detail": - cond = """and s_warehouse is null""" + mcond = get_match_cond(from_doctype) + cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')" - if filters.get("from") in ["Supplier Quotation Item"]: - qi_condition = "" + if filters.get("parent"): + if ( + from_doctype in ["Purchase Invoice Item", "Purchase Receipt Item"] + and filters.get("inspection_type") != "In Process" + ): + cond = """and item_code in (select name from `tabItem` where + inspection_required_before_purchase = 1)""" + elif ( + from_doctype in ["Sales Invoice Item", "Delivery Note Item"] + and filters.get("inspection_type") != "In Process" + ): + cond = """and item_code in (select name from `tabItem` where + inspection_required_before_delivery = 1)""" + elif from_doctype == "Stock Entry Detail": + cond = """and s_warehouse is null""" - return frappe.db.sql( - """ - SELECT item_code - FROM `tab{doc}` - WHERE parent=%(parent)s and docstatus < 2 and item_code like %(txt)s - {qi_condition} {cond} {mcond} - ORDER BY item_code limit {page_len} offset {start} - """.format( - doc=filters.get("from"), - cond=cond, - mcond=mcond, - start=start, - page_len=page_len, - qi_condition=qi_condition, - ), - {"parent": filters.get("parent"), "txt": "%%%s%%" % txt}, - ) + if from_doctype in ["Supplier Quotation Item"]: + qi_condition = "" - elif filters.get("reference_name"): - return frappe.db.sql( - """ - SELECT production_item - FROM `tab{doc}` - WHERE name = %(reference_name)s and docstatus < 2 and production_item like %(txt)s - {qi_condition} {cond} {mcond} - ORDER BY production_item - limit {page_len} offset {start} - """.format( - doc=filters.get("from"), - cond=cond, - mcond=mcond, - start=start, - page_len=page_len, - qi_condition=qi_condition, - ), - {"reference_name": filters.get("reference_name"), "txt": "%%%s%%" % txt}, - ) + return frappe.db.sql( + """ + SELECT item_code + FROM `tab{doc}` + WHERE parent=%(parent)s and docstatus < 2 and item_code like %(txt)s + {qi_condition} {cond} {mcond} + ORDER BY item_code limit {page_len} offset {start} + """.format( + doc=from_doctype, + cond=cond, + mcond=mcond, + start=cint(start), + page_len=cint(page_len), + qi_condition=qi_condition, + ), + {"parent": filters.get("parent"), "txt": "%%%s%%" % txt}, + ) + + elif filters.get("reference_name"): + return frappe.db.sql( + """ + SELECT production_item + FROM `tab{doc}` + WHERE name = %(reference_name)s and docstatus < 2 and production_item like %(txt)s + {qi_condition} {cond} {mcond} + ORDER BY production_item + limit {page_len} offset {start} + """.format( + doc=from_doctype, + cond=cond, + mcond=mcond, + start=cint(start), + page_len=cint(page_len), + qi_condition=qi_condition, + ), + {"reference_name": filters.get("reference_name"), "txt": "%%%s%%" % txt}, + ) @frappe.whitelist() From caef140a9b515d1d25c04ede6c5baa3935667e50 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Thu, 17 Nov 2022 12:36:44 +0530 Subject: [PATCH 10/38] fix: make `is_internal_supplier` read-only (cherry picked from commit 5efbc2cbf8dd9ac0b0bc84194d640a0443c81c56) --- erpnext/buying/doctype/purchase_order/purchase_order.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 2193985ff23..ded45b866ef 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1108,7 +1108,8 @@ "fetch_from": "supplier.is_internal_supplier", "fieldname": "is_internal_supplier", "fieldtype": "Check", - "label": "Is Internal Supplier" + "label": "Is Internal Supplier", + "read_only": 1 }, { "fetch_from": "supplier.represents_company", @@ -1232,7 +1233,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2022-10-11 13:01:41.674352", + "modified": "2022-11-17 12:34:36.033363", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", From 00558af873fe1a64496173d9928d0ddcdffb2350 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 17 Nov 2022 14:24:59 +0530 Subject: [PATCH 11/38] chore: typo --- erpnext/stock/doctype/quality_inspection/quality_inspection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py index e44e1b7e9d6..9321c2c166b 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py @@ -222,7 +222,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters): from frappe.desk.reportview import get_match_cond from_doctype = cstr(filters.get("doctype")) - if not from_doctype or not frappe.db.exist("DocType", from_doctype): + if not from_doctype or not frappe.db.exists("DocType", from_doctype): return [] mcond = get_match_cond(from_doctype) From aaed4ab9585c2fcea72436ae3e1ea199e17a66e4 Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Thu, 17 Nov 2022 12:56:42 +0530 Subject: [PATCH 12/38] fix(pos): item selector image border radius Signed-off-by: Sabu Siyad (cherry picked from commit 2f4940cc269ab6402dae649ebd9e2f9dfc18d1e7) --- erpnext/public/scss/point-of-sale.scss | 6 ++++++ erpnext/selling/page/point_of_sale/pos_item_selector.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/public/scss/point-of-sale.scss b/erpnext/public/scss/point-of-sale.scss index 7a3854cc611..7b7530b1501 100644 --- a/erpnext/public/scss/point-of-sale.scss +++ b/erpnext/public/scss/point-of-sale.scss @@ -159,6 +159,12 @@ } } + .item-img { + @extend .image; + border-radius: 8px 8px 0 0; + object-fit: cover; + } + > .item-detail { display: flex; flex-direction: column; diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js index 7a90fb044f3..b5eb0489f9d 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_selector.js +++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js @@ -103,9 +103,9 @@ erpnext.PointOfSale.ItemSelector = class {
${frappe.get_abbr(item.item_name)} + >
`; } else { return `
From 444f241263e6ba89e316e06b9f67302c698da343 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Thu, 17 Nov 2022 12:13:06 +0530 Subject: [PATCH 13/38] fix: precision in asset tests (cherry picked from commit b5e5d3b3af9116d29b65e1edcebea3b2fb895344) --- erpnext/assets/doctype/asset/test_asset.py | 43 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 5c1311d68a9..417d62f7ecb 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -230,9 +230,22 @@ class TestAsset(AssetSetup): self.assertTrue(asset.journal_entry_for_scrap) expected_gle = ( - ("_Test Accumulated Depreciations - _TC", 18000.0 + pro_rata_amount, 0.0), - ("_Test Fixed Asset - _TC", 0.0, 100000.0), - ("_Test Gain/Loss on Asset Disposal - _TC", 82000.0 - pro_rata_amount, 0.0), + ( + "_Test Accumulated Depreciations - _TC", + flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), + 0.0 + ), + ( + "_Test Fixed Asset - _TC", + 0.0, + 100000.0 + ), + ( + "_Test Gain/Loss on Asset Disposal - _TC", + flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")), + 0.0 + ), + ) gle = frappe.db.sql( @@ -288,10 +301,26 @@ class TestAsset(AssetSetup): pro_rata_amount = flt(pro_rata_amount, asset.precision("gross_purchase_amount")) expected_gle = ( - ("_Test Accumulated Depreciations - _TC", 18000.0 + pro_rata_amount, 0.0), - ("_Test Fixed Asset - _TC", 0.0, 100000.0), - ("_Test Gain/Loss on Asset Disposal - _TC", 57000.0 - pro_rata_amount, 0.0), - ("Debtors - _TC", 25000.0, 0.0), + ( + "_Test Accumulated Depreciations - _TC", + flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")) + 0.0 + ), + ( + "_Test Fixed Asset - _TC", + 0.0, + 100000.0 + ), + ( + "_Test Gain/Loss on Asset Disposal - _TC", + flt(57000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")) + 0.0 + ), + ( + "Debtors - _TC", + 25000.0, + 0.0 + ), ) gle = frappe.db.sql( From ecd4eab2da1c89f05acef5bf3eccf521ba114774 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Thu, 17 Nov 2022 12:22:05 +0530 Subject: [PATCH 14/38] fix: add missing commas and brackets (cherry picked from commit 218da1217a27d759fc853ace4c372c1f82b2cbf2) --- erpnext/assets/doctype/asset/test_asset.py | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 417d62f7ecb..19c913ae910 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -233,19 +233,14 @@ class TestAsset(AssetSetup): ( "_Test Accumulated Depreciations - _TC", flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), - 0.0 - ), - ( - "_Test Fixed Asset - _TC", 0.0, - 100000.0 ), + ("_Test Fixed Asset - _TC", 0.0, 100000.0), ( "_Test Gain/Loss on Asset Disposal - _TC", flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")), - 0.0 + 0.0, ), - ) gle = frappe.db.sql( @@ -303,24 +298,16 @@ class TestAsset(AssetSetup): expected_gle = ( ( "_Test Accumulated Depreciations - _TC", - flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")) - 0.0 - ), - ( - "_Test Fixed Asset - _TC", + flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), 0.0, - 100000.0 ), + ("_Test Fixed Asset - _TC", 0.0, 100000.0), ( "_Test Gain/Loss on Asset Disposal - _TC", - flt(57000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")) - 0.0 - ), - ( - "Debtors - _TC", - 25000.0, - 0.0 + flt(57000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")), + 0.0, ), + ("Debtors - _TC", 25000.0, 0.0), ) gle = frappe.db.sql( From eb968d7f0247e40f149a279250e3f4dbab89619e Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Thu, 17 Nov 2022 17:46:49 +0530 Subject: [PATCH 15/38] fix: use `list()` on self mutating iteration https://github.com/frappe/erpnext/issues/30325 Signed-off-by: Sabu Siyad (cherry picked from commit 546c809cbeead2b556b3b09b632f3d73a500900e) --- erpnext/erpnext_integrations/taxjar_integration.py | 2 +- erpnext/stock/report/stock_ledger/stock_ledger.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py index b8893aa7732..2d9093b6e92 100644 --- a/erpnext/erpnext_integrations/taxjar_integration.py +++ b/erpnext/erpnext_integrations/taxjar_integration.py @@ -302,7 +302,7 @@ def check_for_nexus(doc, tax_dict): item.tax_collectable = flt(0) item.taxable_amount = flt(0) - for tax in doc.taxes: + for tax in list(doc.taxes): if tax.account_head == TAX_ACCOUNT_HEAD: doc.taxes.remove(tax) return diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index af7f20f3ccf..b725d49de70 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -394,7 +394,7 @@ def get_opening_balance(filters, columns, sl_entries): ) # check if any SLEs are actually Opening Stock Reconciliation - for sle in sl_entries: + for sle in list(sl_entries): if ( sle.get("voucher_type") == "Stock Reconciliation" and sle.posting_date == filters.from_date From eaf09503a998ef27aec916b1b3acf7ec720bec07 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 9 Nov 2022 12:47:34 +0530 Subject: [PATCH 16/38] fix: Internal Transfer Material Request cycle and tracking fixed till purchase receipt (cherry picked from commit 71412f6877b558a84f5e8a60ba9822a89147d6f0) --- .../doctype/sales_invoice/sales_invoice.py | 2 ++ .../sales_order_item/sales_order_item.json | 15 ++++++++++++++- .../stock/doctype/delivery_note/delivery_note.py | 2 ++ .../delivery_note/delivery_note_dashboard.py | 3 +++ .../delivery_note_item/delivery_note_item.json | 15 ++++++++++++++- .../material_request_dashboard.py | 1 + 6 files changed, 36 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 51df37044d5..4748826ec37 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -2071,6 +2071,8 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None): if source.doctype == "Purchase Order Item" and target.doctype == "Sales Order Item": target.purchase_order = source.parent target.purchase_order_item = source.name + target.material_request = source.material_request + target.material_request_item = source.material_request_item if ( source.get("purchase_order") diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 8c7c5520a40..5b0b3958da6 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -95,8 +95,10 @@ "item_tax_rate", "transaction_date", "inter_transfer_reference_section", + "material_request", "purchase_order", "column_break_89", + "material_request_item", "purchase_order_item" ], "fields": [ @@ -847,7 +849,18 @@ "label": "quotation_item", "no_copy": 1, "read_only": 1 - } + }, + { + "fieldname": "material_request", + "fieldtype": "Link", + "label": "Material Request", + "options": "Material Request" + }, + { + "fieldname": "material_request_item", + "fieldtype": "Data", + "label": "Material Request Item" + } ], "idx": 1, "istable": 1, diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 9dd28dc60b3..a1df764ea9d 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -902,6 +902,8 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None): "serial_no": "serial_no", "purchase_order": "purchase_order", "purchase_order_item": "purchase_order_item", + "material_request": "material_request", + "Material_request_item": "material_request_item", }, "field_no_map": ["warehouse"], }, diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py index fd44e9cee5c..ba816cef9b5 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py @@ -11,11 +11,14 @@ def get_data(): }, "internal_links": { "Sales Order": ["items", "against_sales_order"], + "Material Request": ["items", "material_request"], + "Purchase Order": ["items", "purchase_order"] }, "transactions": [ {"label": _("Related"), "items": ["Sales Invoice", "Packing Slip", "Delivery Trip"]}, {"label": _("Reference"), "items": ["Sales Order", "Shipment", "Quality Inspection"]}, {"label": _("Returns"), "items": ["Stock Entry"]}, {"label": _("Subscription"), "items": ["Auto Repeat"]}, + {"label": _("Internal Transfer"), "items": ["Material Request", "Purchase Order"]} ], } diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index 32294630700..916ab2a05be 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -88,9 +88,11 @@ "allow_zero_valuation_rate", "column_break_71", "internal_transfer_section", + "material_request", "purchase_order", "column_break_82", "purchase_order_item", + "material_request_item", "accounting_dimensions_section", "cost_center", "dimension_col_break", @@ -818,13 +820,24 @@ "fieldtype": "Check", "label": "Has Item Scanned", "read_only": 1 + }, + { + "fieldname": "material_request", + "fieldtype": "Link", + "label": "Material Request", + "options": "Material Request" + }, + { + "fieldname": "material_request_item", + "fieldtype": "Data", + "label": "Material Request Item" } ], "idx": 1, "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2022-11-02 12:54:07.225623", + "modified": "2022-11-09 12:17:50.850142", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py index 691a8b39b1b..2bba52a4e25 100644 --- a/erpnext/stock/doctype/material_request/material_request_dashboard.py +++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py @@ -14,5 +14,6 @@ def get_data(): }, {"label": _("Stock"), "items": ["Stock Entry", "Purchase Receipt", "Pick List"]}, {"label": _("Manufacturing"), "items": ["Work Order"]}, + {"label": _("Internal Transfer"), "items": ["Sales Order"]}, ], } From c356d2cabdf79bae32c52afe7cf7406efdc47577 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 9 Nov 2022 13:03:04 +0530 Subject: [PATCH 17/38] fix: minor issue fixed (cherry picked from commit d86afddb60357c2f1a31c5bf204bacf5c74979f4) --- .../stock/doctype/delivery_note/delivery_note_dashboard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py index ba816cef9b5..b6b5ff4296f 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py @@ -12,13 +12,13 @@ def get_data(): "internal_links": { "Sales Order": ["items", "against_sales_order"], "Material Request": ["items", "material_request"], - "Purchase Order": ["items", "purchase_order"] + "Purchase Order": ["items", "purchase_order"], }, "transactions": [ {"label": _("Related"), "items": ["Sales Invoice", "Packing Slip", "Delivery Trip"]}, {"label": _("Reference"), "items": ["Sales Order", "Shipment", "Quality Inspection"]}, {"label": _("Returns"), "items": ["Stock Entry"]}, {"label": _("Subscription"), "items": ["Auto Repeat"]}, - {"label": _("Internal Transfer"), "items": ["Material Request", "Purchase Order"]} + {"label": _("Internal Transfer"), "items": ["Material Request", "Purchase Order"]}, ], } From 2a892f5c523171814511c1ed983212746ba930bd Mon Sep 17 00:00:00 2001 From: Vishal Date: Tue, 15 Nov 2022 17:41:14 +0530 Subject: [PATCH 18/38] fix: test case added for MR internal Transfer (cherry picked from commit 89aabdaaaa5009a94cfa14ae2bdd50c036afd670) --- .../purchase_order/test_purchase_order.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 5a96131157b..e7c2db8574b 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -879,6 +879,50 @@ class TestPurchaseOrder(FrappeTestCase): po.load_from_db() self.assertEqual(po.status, "Completed") + def test_internal_transfer_flow_with_mr(self): + from erpnext.selling.doctype.sales_order.sales_order import ( + make_delivery_note, + ) + from erpnext.stock.doctype.delivery_note.delivery_note import make_inter_company_purchase_receipt + + frappe.db.set_value("Selling Settings", None, "maintain_same_sales_rate", 1) + frappe.db.set_value("Buying Settings", None, "maintain_same_rate", 1) + + supplier = "_Test Internal Supplier 2" + + mr = make_material_request(qty=2, company="_Test Company with perpetual inventory", warehouse="Stores - TCP1") + po = make_purchase_order(mr.name) + po.supplier = supplier + po.from_warehouse="_Test Internal Warehouse New 1 - TCP1", + po.rate=1, + po.save() + po.submit() + + so = make_inter_company_sales_order(po.name) + so.items[0].delivery_date = today() + self.assertEqual(so.items[0].warehouse, "_Test Internal Warehouse New 1 - TCP1") + self.assertTrue(so.items[0].material_request) + self.assertTrue(so.items[0].material_request_item) + so.submit() + + dn = make_delivery_note(so.name) + dn.items[0].target_warehouse = "_Test Internal Warehouse GIT - TCP1" + self.assertEqual(dn.items[0].warehouse, "_Test Internal Warehouse New 1 - TCP1") + self.assertTrue(dn.items[0].material_request) + self.assertTrue(dn.items[0].material_request_item) + + self.assertEqual(mr.items[0].name, dn.items[0].material_request_item) + dn.submit() + + pr = make_inter_company_purchase_receipt(dn.name) + self.assertEqual(pr.items[0].warehouse, "Stores - TCP1") + self.assertTrue(pr.items[0].material_request) + self.assertTrue(pr.items[0].material_request_item) + self.assertEqual(mr.items[0].name, pr.items[0].material_request_item) + pr.submit() + + po.load_from_db() + self.assertEqual(mr.status, "Received") def prepare_data_for_internal_transfer(): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier From 6ddf27380f845c8d0f5b9a574cafbe53d807abee Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 16 Nov 2022 13:52:07 +0530 Subject: [PATCH 19/38] fix: test case updated for mr (cherry picked from commit 343b414b402d3feede1f6e1fb3a3262a763ea329) --- .../purchase_order/test_purchase_order.py | 53 ++++--------------- 1 file changed, 9 insertions(+), 44 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index e7c2db8574b..af687a0066b 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -833,6 +833,10 @@ class TestPurchaseOrder(FrappeTestCase): prepare_data_for_internal_transfer() supplier = "_Test Internal Supplier 2" + mr = make_material_request( + qty=2, company="_Test Company with perpetual inventory", warehouse="Stores - TCP1" + ) + po = create_purchase_order( company="_Test Company with perpetual inventory", supplier=supplier, @@ -840,6 +844,8 @@ class TestPurchaseOrder(FrappeTestCase): from_warehouse="_Test Internal Warehouse New 1 - TCP1", qty=2, rate=1, + material_request = mr.name, + material_request_item = mr.items[0].name, ) so = make_inter_company_sales_order(po.name) @@ -875,53 +881,10 @@ class TestPurchaseOrder(FrappeTestCase): self.assertTrue(pi.items[0].purchase_order) self.assertTrue(pi.items[0].po_detail) pi.submit() + mr.reload() po.load_from_db() self.assertEqual(po.status, "Completed") - - def test_internal_transfer_flow_with_mr(self): - from erpnext.selling.doctype.sales_order.sales_order import ( - make_delivery_note, - ) - from erpnext.stock.doctype.delivery_note.delivery_note import make_inter_company_purchase_receipt - - frappe.db.set_value("Selling Settings", None, "maintain_same_sales_rate", 1) - frappe.db.set_value("Buying Settings", None, "maintain_same_rate", 1) - - supplier = "_Test Internal Supplier 2" - - mr = make_material_request(qty=2, company="_Test Company with perpetual inventory", warehouse="Stores - TCP1") - po = make_purchase_order(mr.name) - po.supplier = supplier - po.from_warehouse="_Test Internal Warehouse New 1 - TCP1", - po.rate=1, - po.save() - po.submit() - - so = make_inter_company_sales_order(po.name) - so.items[0].delivery_date = today() - self.assertEqual(so.items[0].warehouse, "_Test Internal Warehouse New 1 - TCP1") - self.assertTrue(so.items[0].material_request) - self.assertTrue(so.items[0].material_request_item) - so.submit() - - dn = make_delivery_note(so.name) - dn.items[0].target_warehouse = "_Test Internal Warehouse GIT - TCP1" - self.assertEqual(dn.items[0].warehouse, "_Test Internal Warehouse New 1 - TCP1") - self.assertTrue(dn.items[0].material_request) - self.assertTrue(dn.items[0].material_request_item) - - self.assertEqual(mr.items[0].name, dn.items[0].material_request_item) - dn.submit() - - pr = make_inter_company_purchase_receipt(dn.name) - self.assertEqual(pr.items[0].warehouse, "Stores - TCP1") - self.assertTrue(pr.items[0].material_request) - self.assertTrue(pr.items[0].material_request_item) - self.assertEqual(mr.items[0].name, pr.items[0].material_request_item) - pr.submit() - - po.load_from_db() self.assertEqual(mr.status, "Received") def prepare_data_for_internal_transfer(): @@ -1023,6 +986,8 @@ def create_purchase_order(**args): "schedule_date": add_days(nowdate(), 1), "include_exploded_items": args.get("include_exploded_items", 1), "against_blanket_order": args.against_blanket_order, + "material_request": args.material_request, + "material_request_item": args.material_request_item, }, ) From ac3120b6f9e9d4e4f8ca64e01b8b434c1ad41293 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 16 Nov 2022 13:58:29 +0530 Subject: [PATCH 20/38] fix: minor change (cherry picked from commit ba6189d054cf6e6b1bf53c995e86366bafe92ecf) --- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index af687a0066b..97c862c0661 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -844,8 +844,8 @@ class TestPurchaseOrder(FrappeTestCase): from_warehouse="_Test Internal Warehouse New 1 - TCP1", qty=2, rate=1, - material_request = mr.name, - material_request_item = mr.items[0].name, + material_request=mr.name, + material_request_item=mr.items[0].name, ) so = make_inter_company_sales_order(po.name) From 660e3fa081acb1897963417a0116fd33b0490d54 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 16 Nov 2022 14:25:35 +0530 Subject: [PATCH 21/38] chore: minor fix (cherry picked from commit e5dfd53e6f8a73c81c682f8d2a7a872eb5b8445f) --- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 97c862c0661..5206a428c4e 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -887,6 +887,7 @@ class TestPurchaseOrder(FrappeTestCase): self.assertEqual(po.status, "Completed") self.assertEqual(mr.status, "Received") + def prepare_data_for_internal_transfer(): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier from erpnext.selling.doctype.customer.test_customer import create_internal_customer From 0c73280a9b0ebca169439206f123b451adc5ede1 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Fri, 18 Nov 2022 11:40:53 +0530 Subject: [PATCH 22/38] chore: linters (cherry picked from commit 12d7b7e9c2cd59e2393c1647f5030415d6560af2) --- .../sales_order_item/sales_order_item.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 5b0b3958da6..b801de314cc 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -851,21 +851,21 @@ "read_only": 1 }, { - "fieldname": "material_request", - "fieldtype": "Link", - "label": "Material Request", - "options": "Material Request" - }, - { - "fieldname": "material_request_item", - "fieldtype": "Data", - "label": "Material Request Item" - } + "fieldname": "material_request", + "fieldtype": "Link", + "label": "Material Request", + "options": "Material Request" + }, + { + "fieldname": "material_request_item", + "fieldtype": "Data", + "label": "Material Request Item" + } ], "idx": 1, "istable": 1, "links": [], - "modified": "2022-11-10 18:20:30.137455", + "modified": "2022-11-18 11:39:01.741665", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Item", From 4de02dc2588d11b415157315f069461eedd53764 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 16 Nov 2022 14:12:55 +0530 Subject: [PATCH 23/38] fix: don't set `rejected-qty` in return SCR (cherry picked from commit 8a73e963ce56e1cccb9ecb61f3afda5bb3586467) --- .../controllers/sales_and_purchase_return.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index 39ef68a9fb5..15c82af856b 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -404,12 +404,17 @@ def make_return_doc(doctype: str, source_name: str, target_doc=None): returned_qty_map = get_returned_qty_map_for_row( source_parent.name, source_parent.supplier, source_doc.name, doctype ) - target_doc.received_qty = -1 * flt( - source_doc.received_qty - (returned_qty_map.get("received_qty") or 0) - ) - target_doc.rejected_qty = -1 * flt( - source_doc.rejected_qty - (returned_qty_map.get("rejected_qty") or 0) - ) + + if doctype == "Subcontracting Receipt": + target_doc.received_qty = -1 * flt(source_doc.qty) + else: + target_doc.received_qty = -1 * flt( + source_doc.received_qty - (returned_qty_map.get("received_qty") or 0) + ) + target_doc.rejected_qty = -1 * flt( + source_doc.rejected_qty - (returned_qty_map.get("rejected_qty") or 0) + ) + target_doc.qty = -1 * flt(source_doc.qty - (returned_qty_map.get("qty") or 0)) if hasattr(target_doc, "stock_qty"): From 71d6f2a4901a6af6f05a9cb20a6d784c1b49dbe8 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 16 Nov 2022 14:25:06 +0530 Subject: [PATCH 24/38] fix: hide reject-fields in return SCR (cherry picked from commit 7dd7617ec7c3a73b7b99d1c65fa9f0e2b992b1a0) --- .../subcontracting_receipt.json | 1397 +++++++++-------- .../subcontracting_receipt_item.json | 974 ++++++------ 2 files changed, 1187 insertions(+), 1184 deletions(-) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json index 5cd4e637cce..3385eac0528 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json @@ -1,700 +1,701 @@ { - "actions": [], - "autoname": "naming_series:", - "creation": "2022-04-18 11:20:44.226738", - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "title", - "naming_series", - "supplier", - "supplier_name", - "column_break1", - "company", - "posting_date", - "posting_time", - "set_posting_time", - "is_return", - "return_against", - "accounting_dimensions_section", - "cost_center", - "dimension_col_break", - "project", - "section_addresses", - "supplier_address", - "contact_person", - "address_display", - "contact_display", - "contact_mobile", - "contact_email", - "col_break_address", - "shipping_address", - "shipping_address_display", - "billing_address", - "billing_address_display", - "sec_warehouse", - "set_warehouse", - "rejected_warehouse", - "col_break_warehouse", - "supplier_warehouse", - "items_section", - "items", - "section_break0", - "total_qty", - "column_break_27", - "total", - "raw_material_details", - "get_current_stock", - "supplied_items", - "additional_costs_section", - "distribute_additional_costs_based_on", - "additional_costs", - "total_additional_costs", - "section_break_46", - "in_words", - "bill_no", - "bill_date", - "more_info", - "status", - "column_break_39", - "per_returned", - "section_break_47", - "amended_from", - "range", - "column_break4", - "represents_company", - "subscription_detail", - "auto_repeat", - "printing_settings", - "letter_head", - "language", - "instructions", - "column_break_97", - "select_print_heading", - "other_details", - "remarks", - "transporter_info", - "transporter_name", - "column_break5", - "lr_no", - "lr_date" - ], - "fields": [ - { - "allow_on_submit": 1, - "default": "{supplier_name}", - "fieldname": "title", - "fieldtype": "Data", - "hidden": 1, - "label": "Title", - "no_copy": 1, - "print_hide": 1 - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "options": "MAT-SCR-.YYYY.-\nMAT-SCR-RET-.YYYY.-", - "print_hide": 1, - "reqd": 1, - "set_only_once": 1 - }, - { - "bold": 1, - "fieldname": "supplier", - "fieldtype": "Link", - "in_global_search": 1, - "label": "Supplier", - "options": "Supplier", - "print_hide": 1, - "print_width": "150px", - "reqd": 1, - "search_index": 1, - "width": "150px" - }, - { - "bold": 1, - "depends_on": "supplier", - "fetch_from": "supplier.supplier_name", - "fieldname": "supplier_name", - "fieldtype": "Data", - "in_global_search": 1, - "label": "Supplier Name", - "read_only": 1 - }, - { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "print_width": "50%", - "width": "50%" - }, - { - "default": "Today", - "fieldname": "posting_date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Date", - "no_copy": 1, - "print_width": "100px", - "read_only_depends_on": "eval: !doc.set_posting_time", - "reqd": 1, - "search_index": 1, - "width": "100px" - }, - { - "description": "Time at which materials were received", - "fieldname": "posting_time", - "fieldtype": "Time", - "label": "Posting Time", - "no_copy": 1, - "print_hide": 1, - "print_width": "100px", - "read_only_depends_on": "eval: !doc.set_posting_time", - "reqd": 1, - "width": "100px" - }, - { - "fieldname": "company", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Company", - "options": "Company", - "print_hide": 1, - "print_width": "150px", - "remember_last_selected_value": 1, - "reqd": 1, - "width": "150px" - }, - { - "collapsible": 1, - "fieldname": "section_addresses", - "fieldtype": "Section Break", - "label": "Address and Contact" - }, - { - "fieldname": "supplier_address", - "fieldtype": "Link", - "label": "Select Supplier Address", - "options": "Address", - "print_hide": 1 - }, - { - "fieldname": "contact_person", - "fieldtype": "Link", - "label": "Contact Person", - "options": "Contact", - "print_hide": 1 - }, - { - "fieldname": "address_display", - "fieldtype": "Small Text", - "label": "Address", - "read_only": 1 - }, - { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "in_global_search": 1, - "label": "Contact", - "read_only": 1 - }, - { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "label": "Mobile No", - "read_only": 1 - }, - { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "label": "Contact Email", - "options": "Email", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "col_break_address", - "fieldtype": "Column Break" - }, - { - "fieldname": "shipping_address", - "fieldtype": "Link", - "label": "Select Shipping Address", - "options": "Address", - "print_hide": 1 - }, - { - "fieldname": "shipping_address_display", - "fieldtype": "Small Text", - "label": "Shipping Address", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "sec_warehouse", - "fieldtype": "Section Break" - }, - { - "description": "Sets 'Accepted Warehouse' in each row of the Items table.", - "fieldname": "set_warehouse", - "fieldtype": "Link", - "label": "Accepted Warehouse", - "options": "Warehouse", - "print_hide": 1 - }, - { - "description": "Sets 'Rejected Warehouse' in each row of the Items table.", - "fieldname": "rejected_warehouse", - "fieldtype": "Link", - "label": "Rejected Warehouse", - "no_copy": 1, - "options": "Warehouse", - "print_hide": 1 - }, - { - "fieldname": "col_break_warehouse", - "fieldtype": "Column Break" - }, - { - "fieldname": "supplier_warehouse", - "fieldtype": "Link", - "label": "Supplier Warehouse", - "no_copy": 1, - "options": "Warehouse", - "print_hide": 1, - "print_width": "50px", - "width": "50px" - }, - { - "fieldname": "items_section", - "fieldtype": "Section Break", - "options": "fa fa-shopping-cart" - }, - { - "allow_bulk_edit": 1, - "fieldname": "items", - "fieldtype": "Table", - "label": "Items", - "options": "Subcontracting Receipt Item", - "reqd": 1 - }, - { - "depends_on": "supplied_items", - "fieldname": "get_current_stock", - "fieldtype": "Button", - "label": "Get Current Stock", - "options": "get_current_stock", - "print_hide": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "supplied_items", - "depends_on": "supplied_items", - "fieldname": "raw_material_details", - "fieldtype": "Section Break", - "label": "Raw Materials Consumed", - "options": "fa fa-table", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "supplied_items", - "fieldtype": "Table", - "label": "Consumed Items", - "no_copy": 1, - "options": "Subcontracting Receipt Supplied Item", - "print_hide": 1 - }, - { - "fieldname": "section_break0", - "fieldtype": "Section Break" - }, - { - "fieldname": "total_qty", - "fieldtype": "Float", - "label": "Total Quantity", - "read_only": 1 - }, - { - "fieldname": "column_break_27", - "fieldtype": "Column Break" - }, - { - "fieldname": "total", - "fieldtype": "Currency", - "label": "Total", - "options": "currency", - "read_only": 1 - }, - { - "fieldname": "section_break_46", - "fieldtype": "Section Break" - }, - { - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words", - "length": 240, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "bill_no", - "fieldtype": "Data", - "hidden": 1, - "label": "Bill No", - "print_hide": 1 - }, - { - "fieldname": "bill_date", - "fieldtype": "Date", - "hidden": 1, - "label": "Bill Date", - "print_hide": 1 - }, - { - "collapsible": 1, - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Information", - "options": "fa fa-file-text" - }, - { - "default": "Draft", - "fieldname": "status", - "fieldtype": "Select", - "in_standard_filter": 1, - "label": "Status", - "no_copy": 1, - "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "reqd": 1, - "search_index": 1, - "width": "150px" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "options": "Subcontracting Receipt", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "width": "150px" - }, - { - "fieldname": "range", - "fieldtype": "Data", - "hidden": 1, - "label": "Range", - "print_hide": 1 - }, - { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "print_hide": 1, - "print_width": "50%", - "width": "50%" - }, - { - "fieldname": "subscription_detail", - "fieldtype": "Section Break", - "label": "Auto Repeat Detail" - }, - { - "fieldname": "auto_repeat", - "fieldtype": "Link", - "label": "Auto Repeat", - "no_copy": 1, - "options": "Auto Repeat", - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "fieldname": "printing_settings", - "fieldtype": "Section Break", - "label": "Printing Settings" - }, - { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "options": "Letter Head", - "print_hide": 1 - }, - { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "options": "Print Heading", - "print_hide": 1, - "report_hide": 1 - }, - { - "fieldname": "language", - "fieldtype": "Data", - "label": "Print Language", - "read_only": 1 - }, - { - "fieldname": "column_break_97", - "fieldtype": "Column Break" - }, - { - "fieldname": "other_details", - "fieldtype": "HTML", - "hidden": 1, - "label": "Other Details", - "options": "
Other Details
", - "print_hide": 1, - "print_width": "30%", - "width": "30%" - }, - { - "fieldname": "instructions", - "fieldtype": "Small Text", - "label": "Instructions" - }, - { - "fieldname": "remarks", - "fieldtype": "Small Text", - "label": "Remarks", - "print_hide": 1 - }, - { - "collapsible": 1, - "collapsible_depends_on": "transporter_name", - "fieldname": "transporter_info", - "fieldtype": "Section Break", - "label": "Transporter Details", - "options": "fa fa-truck" - }, - { - "fieldname": "transporter_name", - "fieldtype": "Data", - "label": "Transporter Name" - }, - { - "fieldname": "column_break5", - "fieldtype": "Column Break", - "print_width": "50%", - "width": "50%" - }, - { - "fieldname": "lr_no", - "fieldtype": "Data", - "label": "Vehicle Number", - "no_copy": 1, - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "lr_date", - "fieldtype": "Date", - "label": "Vehicle Date", - "no_copy": 1, - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "billing_address", - "fieldtype": "Link", - "label": "Select Billing Address", - "options": "Address" - }, - { - "fieldname": "billing_address_display", - "fieldtype": "Small Text", - "label": "Billing Address", - "read_only": 1 - }, - { - "fetch_from": "supplier.represents_company", - "fieldname": "represents_company", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Represents Company", - "options": "Company", - "read_only": 1 - }, - { - "default": "0", - "fieldname": "is_return", - "fieldtype": "Check", - "label": "Is Return", - "no_copy": 1, - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "is_return", - "fieldname": "return_against", - "fieldtype": "Link", - "label": "Return Against Subcontracting Receipt", - "no_copy": 1, - "options": "Subcontracting Receipt", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_39", - "fieldtype": "Column Break" - }, - { - "depends_on": "eval:(!doc.__islocal && doc.is_return==0)", - "fieldname": "per_returned", - "fieldtype": "Percent", - "in_list_view": 1, - "label": "% Returned", - "no_copy": 1, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "section_break_47", - "fieldtype": "Section Break" - }, - { - "collapsible": 1, - "fieldname": "accounting_dimensions_section", - "fieldtype": "Section Break", - "label": "Accounting Dimensions " - }, - { - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "options": "Cost Center" - }, - { - "fieldname": "dimension_col_break", - "fieldtype": "Column Break" - }, - { - "fieldname": "project", - "fieldtype": "Link", - "label": "Project", - "options": "Project" - }, - { - "collapsible": 1, - "collapsible_depends_on": "total_additional_costs", - "depends_on": "eval:(doc.docstatus == 0 || doc.total_additional_costs)", - "fieldname": "additional_costs_section", - "fieldtype": "Section Break", - "label": "Additional Costs" - }, - { - "default": "Qty", - "fieldname": "distribute_additional_costs_based_on", - "fieldtype": "Select", - "label": "Distribute Additional Costs Based On ", - "options": "Qty\nAmount" - }, - { - "fieldname": "additional_costs", - "fieldtype": "Table", - "label": "Additional Costs", - "options": "Landed Cost Taxes and Charges" - }, - { - "fieldname": "total_additional_costs", - "fieldtype": "Currency", - "label": "Total Additional Costs", - "print_hide_if_no_value": 1, - "read_only": 1 - }, - { - "default": "0", - "depends_on": "eval:doc.docstatus==0", - "fieldname": "set_posting_time", - "fieldtype": "Check", - "label": "Edit Posting Date and Time", - "print_hide": 1 - } - ], - "in_create": 1, - "is_submittable": 1, - "links": [], - "modified": "2022-08-26 21:02:26.353870", - "modified_by": "Administrator", - "module": "Subcontracting", - "name": "Subcontracting Receipt", - "naming_rule": "By \"Naming Series\" field", - "owner": "Administrator", - "permissions": [ - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Stock Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Stock User", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "read": 1, - "report": 1, - "role": "Accounts User" - }, - { - "permlevel": 1, - "read": 1, - "role": "Stock Manager", - "write": 1 - } - ], - "search_fields": "status, posting_date, supplier", - "show_name_in_global_search": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "timeline_field": "supplier", - "title_field": "title", - "track_changes": 1 + "actions": [], + "autoname": "naming_series:", + "creation": "2022-04-18 11:20:44.226738", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "title", + "naming_series", + "supplier", + "supplier_name", + "column_break1", + "company", + "posting_date", + "posting_time", + "set_posting_time", + "is_return", + "return_against", + "accounting_dimensions_section", + "cost_center", + "dimension_col_break", + "project", + "section_addresses", + "supplier_address", + "contact_person", + "address_display", + "contact_display", + "contact_mobile", + "contact_email", + "col_break_address", + "shipping_address", + "shipping_address_display", + "billing_address", + "billing_address_display", + "sec_warehouse", + "set_warehouse", + "rejected_warehouse", + "col_break_warehouse", + "supplier_warehouse", + "items_section", + "items", + "section_break0", + "total_qty", + "column_break_27", + "total", + "raw_material_details", + "get_current_stock", + "supplied_items", + "additional_costs_section", + "distribute_additional_costs_based_on", + "additional_costs", + "total_additional_costs", + "section_break_46", + "in_words", + "bill_no", + "bill_date", + "more_info", + "status", + "column_break_39", + "per_returned", + "section_break_47", + "amended_from", + "range", + "column_break4", + "represents_company", + "subscription_detail", + "auto_repeat", + "printing_settings", + "letter_head", + "language", + "instructions", + "column_break_97", + "select_print_heading", + "other_details", + "remarks", + "transporter_info", + "transporter_name", + "column_break5", + "lr_no", + "lr_date" + ], + "fields": [ + { + "allow_on_submit": 1, + "default": "{supplier_name}", + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "label": "Title", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "options": "MAT-SCR-.YYYY.-\nMAT-SCR-RET-.YYYY.-", + "print_hide": 1, + "reqd": 1, + "set_only_once": 1 + }, + { + "bold": 1, + "fieldname": "supplier", + "fieldtype": "Link", + "in_global_search": 1, + "label": "Supplier", + "options": "Supplier", + "print_hide": 1, + "print_width": "150px", + "reqd": 1, + "search_index": 1, + "width": "150px" + }, + { + "bold": 1, + "depends_on": "supplier", + "fetch_from": "supplier.supplier_name", + "fieldname": "supplier_name", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Supplier Name", + "read_only": 1 + }, + { + "fieldname": "column_break1", + "fieldtype": "Column Break", + "print_width": "50%", + "width": "50%" + }, + { + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Date", + "no_copy": 1, + "print_width": "100px", + "read_only_depends_on": "eval: !doc.set_posting_time", + "reqd": 1, + "search_index": 1, + "width": "100px" + }, + { + "description": "Time at which materials were received", + "fieldname": "posting_time", + "fieldtype": "Time", + "label": "Posting Time", + "no_copy": 1, + "print_hide": 1, + "print_width": "100px", + "read_only_depends_on": "eval: !doc.set_posting_time", + "reqd": 1, + "width": "100px" + }, + { + "fieldname": "company", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Company", + "options": "Company", + "print_hide": 1, + "print_width": "150px", + "remember_last_selected_value": 1, + "reqd": 1, + "width": "150px" + }, + { + "collapsible": 1, + "fieldname": "section_addresses", + "fieldtype": "Section Break", + "label": "Address and Contact" + }, + { + "fieldname": "supplier_address", + "fieldtype": "Link", + "label": "Select Supplier Address", + "options": "Address", + "print_hide": 1 + }, + { + "fieldname": "contact_person", + "fieldtype": "Link", + "label": "Contact Person", + "options": "Contact", + "print_hide": 1 + }, + { + "fieldname": "address_display", + "fieldtype": "Small Text", + "label": "Address", + "read_only": 1 + }, + { + "fieldname": "contact_display", + "fieldtype": "Small Text", + "in_global_search": 1, + "label": "Contact", + "read_only": 1 + }, + { + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "label": "Mobile No", + "read_only": 1 + }, + { + "fieldname": "contact_email", + "fieldtype": "Small Text", + "label": "Contact Email", + "options": "Email", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "col_break_address", + "fieldtype": "Column Break" + }, + { + "fieldname": "shipping_address", + "fieldtype": "Link", + "label": "Select Shipping Address", + "options": "Address", + "print_hide": 1 + }, + { + "fieldname": "shipping_address_display", + "fieldtype": "Small Text", + "label": "Shipping Address", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "sec_warehouse", + "fieldtype": "Section Break" + }, + { + "description": "Sets 'Accepted Warehouse' in each row of the Items table.", + "fieldname": "set_warehouse", + "fieldtype": "Link", + "label": "Accepted Warehouse", + "options": "Warehouse", + "print_hide": 1 + }, + { + "depends_on": "eval: !doc.is_return", + "description": "Sets 'Rejected Warehouse' in each row of the Items table.", + "fieldname": "rejected_warehouse", + "fieldtype": "Link", + "label": "Rejected Warehouse", + "no_copy": 1, + "options": "Warehouse", + "print_hide": 1 + }, + { + "fieldname": "col_break_warehouse", + "fieldtype": "Column Break" + }, + { + "fieldname": "supplier_warehouse", + "fieldtype": "Link", + "label": "Supplier Warehouse", + "no_copy": 1, + "options": "Warehouse", + "print_hide": 1, + "print_width": "50px", + "width": "50px" + }, + { + "fieldname": "items_section", + "fieldtype": "Section Break", + "options": "fa fa-shopping-cart" + }, + { + "allow_bulk_edit": 1, + "fieldname": "items", + "fieldtype": "Table", + "label": "Items", + "options": "Subcontracting Receipt Item", + "reqd": 1 + }, + { + "depends_on": "supplied_items", + "fieldname": "get_current_stock", + "fieldtype": "Button", + "label": "Get Current Stock", + "options": "get_current_stock", + "print_hide": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "supplied_items", + "depends_on": "supplied_items", + "fieldname": "raw_material_details", + "fieldtype": "Section Break", + "label": "Raw Materials Consumed", + "options": "fa fa-table", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "supplied_items", + "fieldtype": "Table", + "label": "Consumed Items", + "no_copy": 1, + "options": "Subcontracting Receipt Supplied Item", + "print_hide": 1 + }, + { + "fieldname": "section_break0", + "fieldtype": "Section Break" + }, + { + "fieldname": "total_qty", + "fieldtype": "Float", + "label": "Total Quantity", + "read_only": 1 + }, + { + "fieldname": "column_break_27", + "fieldtype": "Column Break" + }, + { + "fieldname": "total", + "fieldtype": "Currency", + "label": "Total", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "section_break_46", + "fieldtype": "Section Break" + }, + { + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words", + "length": 240, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "bill_no", + "fieldtype": "Data", + "hidden": 1, + "label": "Bill No", + "print_hide": 1 + }, + { + "fieldname": "bill_date", + "fieldtype": "Date", + "hidden": 1, + "label": "Bill Date", + "print_hide": 1 + }, + { + "collapsible": 1, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Information", + "options": "fa fa-file-text" + }, + { + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "in_standard_filter": 1, + "label": "Status", + "no_copy": 1, + "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "reqd": 1, + "search_index": 1, + "width": "150px" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "options": "Subcontracting Receipt", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "width": "150px" + }, + { + "fieldname": "range", + "fieldtype": "Data", + "hidden": 1, + "label": "Range", + "print_hide": 1 + }, + { + "fieldname": "column_break4", + "fieldtype": "Column Break", + "print_hide": 1, + "print_width": "50%", + "width": "50%" + }, + { + "fieldname": "subscription_detail", + "fieldtype": "Section Break", + "label": "Auto Repeat Detail" + }, + { + "fieldname": "auto_repeat", + "fieldtype": "Link", + "label": "Auto Repeat", + "no_copy": 1, + "options": "Auto Repeat", + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "printing_settings", + "fieldtype": "Section Break", + "label": "Printing Settings" + }, + { + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "options": "Letter Head", + "print_hide": 1 + }, + { + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "options": "Print Heading", + "print_hide": 1, + "report_hide": 1 + }, + { + "fieldname": "language", + "fieldtype": "Data", + "label": "Print Language", + "read_only": 1 + }, + { + "fieldname": "column_break_97", + "fieldtype": "Column Break" + }, + { + "fieldname": "other_details", + "fieldtype": "HTML", + "hidden": 1, + "label": "Other Details", + "options": "
Other Details
", + "print_hide": 1, + "print_width": "30%", + "width": "30%" + }, + { + "fieldname": "instructions", + "fieldtype": "Small Text", + "label": "Instructions" + }, + { + "fieldname": "remarks", + "fieldtype": "Small Text", + "label": "Remarks", + "print_hide": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "transporter_name", + "fieldname": "transporter_info", + "fieldtype": "Section Break", + "label": "Transporter Details", + "options": "fa fa-truck" + }, + { + "fieldname": "transporter_name", + "fieldtype": "Data", + "label": "Transporter Name" + }, + { + "fieldname": "column_break5", + "fieldtype": "Column Break", + "print_width": "50%", + "width": "50%" + }, + { + "fieldname": "lr_no", + "fieldtype": "Data", + "label": "Vehicle Number", + "no_copy": 1, + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "lr_date", + "fieldtype": "Date", + "label": "Vehicle Date", + "no_copy": 1, + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "billing_address", + "fieldtype": "Link", + "label": "Select Billing Address", + "options": "Address" + }, + { + "fieldname": "billing_address_display", + "fieldtype": "Small Text", + "label": "Billing Address", + "read_only": 1 + }, + { + "fetch_from": "supplier.represents_company", + "fieldname": "represents_company", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Represents Company", + "options": "Company", + "read_only": 1 + }, + { + "default": "0", + "fieldname": "is_return", + "fieldtype": "Check", + "label": "Is Return", + "no_copy": 1, + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "is_return", + "fieldname": "return_against", + "fieldtype": "Link", + "label": "Return Against Subcontracting Receipt", + "no_copy": 1, + "options": "Subcontracting Receipt", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "column_break_39", + "fieldtype": "Column Break" + }, + { + "depends_on": "eval:(!doc.__islocal && doc.is_return==0)", + "fieldname": "per_returned", + "fieldtype": "Percent", + "in_list_view": 1, + "label": "% Returned", + "no_copy": 1, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "section_break_47", + "fieldtype": "Section Break" + }, + { + "collapsible": 1, + "fieldname": "accounting_dimensions_section", + "fieldtype": "Section Break", + "label": "Accounting Dimensions " + }, + { + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center" + }, + { + "fieldname": "dimension_col_break", + "fieldtype": "Column Break" + }, + { + "fieldname": "project", + "fieldtype": "Link", + "label": "Project", + "options": "Project" + }, + { + "collapsible": 1, + "collapsible_depends_on": "total_additional_costs", + "depends_on": "eval:(doc.docstatus == 0 || doc.total_additional_costs)", + "fieldname": "additional_costs_section", + "fieldtype": "Section Break", + "label": "Additional Costs" + }, + { + "default": "Qty", + "fieldname": "distribute_additional_costs_based_on", + "fieldtype": "Select", + "label": "Distribute Additional Costs Based On ", + "options": "Qty\nAmount" + }, + { + "fieldname": "additional_costs", + "fieldtype": "Table", + "label": "Additional Costs", + "options": "Landed Cost Taxes and Charges" + }, + { + "fieldname": "total_additional_costs", + "fieldtype": "Currency", + "label": "Total Additional Costs", + "print_hide_if_no_value": 1, + "read_only": 1 + }, + { + "default": "0", + "depends_on": "eval:doc.docstatus==0", + "fieldname": "set_posting_time", + "fieldtype": "Check", + "label": "Edit Posting Date and Time", + "print_hide": 1 + } + ], + "in_create": 1, + "is_submittable": 1, + "links": [], + "modified": "2022-11-16 14:18:57.001239", + "modified_by": "Administrator", + "module": "Subcontracting", + "name": "Subcontracting Receipt", + "naming_rule": "By \"Naming Series\" field", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "read": 1, + "report": 1, + "role": "Accounts User" + }, + { + "permlevel": 1, + "read": 1, + "role": "Stock Manager", + "write": 1 + } + ], + "search_fields": "status, posting_date, supplier", + "show_name_in_global_search": 1, + "sort_field": "modified", + "sort_order": "DESC", + "states": [], + "timeline_field": "supplier", + "title_field": "title", + "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json index fd86895b9e3..4b64e4bafee 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json +++ b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json @@ -1,488 +1,490 @@ { - "actions": [], - "autoname": "hash", - "creation": "2022-04-13 16:05:55.395695", - "doctype": "DocType", - "document_type": "Document", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "item_code", - "column_break_2", - "item_name", - "section_break_4", - "description", - "brand", - "image_column", - "image", - "image_view", - "received_and_accepted", - "received_qty", - "qty", - "rejected_qty", - "returned_qty", - "col_break2", - "stock_uom", - "conversion_factor", - "tracking_section", - "col_break_tracking_section", - "rate_and_amount", - "rate", - "amount", - "recalculate_rate", - "column_break_19", - "rm_cost_per_qty", - "service_cost_per_qty", - "additional_cost_per_qty", - "rm_supp_cost", - "warehouse_and_reference", - "warehouse", - "rejected_warehouse", - "subcontracting_order", - "column_break_40", - "schedule_date", - "quality_inspection", - "subcontracting_order_item", - "subcontracting_receipt_item", - "section_break_45", - "bom", - "serial_no", - "col_break5", - "batch_no", - "rejected_serial_no", - "manufacture_details", - "manufacturer", - "column_break_16", - "manufacturer_part_no", - "accounting_details_section", - "expense_account", - "accounting_dimensions_section", - "cost_center", - "dimension_col_break", - "project", - "section_break_80", - "page_break" - ], - "fields": [ - { - "bold": 1, - "columns": 3, - "fieldname": "item_code", - "fieldtype": "Link", - "in_global_search": 1, - "in_list_view": 1, - "label": "Item Code", - "options": "Item", - "print_width": "100px", - "reqd": 1, - "search_index": 1, - "width": "100px" - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "item_name", - "fieldtype": "Data", - "in_global_search": 1, - "label": "Item Name", - "print_hide": 1, - "reqd": 1 - }, - { - "collapsible": 1, - "fieldname": "section_break_4", - "fieldtype": "Section Break", - "label": "Description" - }, - { - "fieldname": "description", - "fieldtype": "Text Editor", - "label": "Description", - "print_width": "300px", - "reqd": 1, - "width": "300px" - }, - { - "fieldname": "image", - "fieldtype": "Attach", - "hidden": 1, - "label": "Image" - }, - { - "fieldname": "image_view", - "fieldtype": "Image", - "label": "Image View", - "options": "image", - "print_hide": 1 - }, - { - "fieldname": "received_and_accepted", - "fieldtype": "Section Break", - "label": "Received and Accepted" - }, - { - "bold": 1, - "default": "0", - "fieldname": "received_qty", - "fieldtype": "Float", - "label": "Received Quantity", - "no_copy": 1, - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 1, - "width": "100px" - }, - { - "columns": 2, - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Accepted Quantity", - "no_copy": 1, - "print_width": "100px", - "width": "100px" - }, - { - "columns": 1, - "fieldname": "rejected_qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Rejected Quantity", - "no_copy": 1, - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "col_break2", - "fieldtype": "Column Break", - "print_hide": 1 - }, - { - "fieldname": "stock_uom", - "fieldtype": "Link", - "label": "Stock UOM", - "options": "UOM", - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 1, - "width": "100px" - }, - { - "default": "1", - "fieldname": "conversion_factor", - "fieldtype": "Float", - "hidden": 1, - "label": "Conversion Factor", - "read_only": 1 - }, - { - "fieldname": "rate_and_amount", - "fieldtype": "Section Break", - "label": "Rate and Amount" - }, - { - "bold": 1, - "columns": 2, - "fieldname": "rate", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Rate", - "options": "currency", - "print_width": "100px", - "read_only": 1, - "read_only_depends_on": "eval: doc.recalculate_rate", - "width": "100px" - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "options": "currency", - "read_only": 1 - }, - { - "fieldname": "column_break_19", - "fieldtype": "Column Break" - }, - { - "fieldname": "rm_cost_per_qty", - "fieldtype": "Currency", - "label": "Raw Material Cost Per Qty", - "no_copy": 1, - "read_only": 1 - }, - { - "fieldname": "service_cost_per_qty", - "fieldtype": "Currency", - "label": "Service Cost Per Qty", - "read_only": 1, - "reqd": 1 - }, - { - "default": "0", - "fieldname": "additional_cost_per_qty", - "fieldtype": "Currency", - "label": "Additional Cost Per Qty", - "read_only": 1 - }, - { - "fieldname": "warehouse_and_reference", - "fieldtype": "Section Break", - "label": "Warehouse and Reference" - }, - { - "bold": 1, - "fieldname": "warehouse", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Accepted Warehouse", - "options": "Warehouse", - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "fieldname": "rejected_warehouse", - "fieldtype": "Link", - "label": "Rejected Warehouse", - "no_copy": 1, - "options": "Warehouse", - "print_hide": 1, - "print_width": "100px", - "width": "100px" - }, - { - "depends_on": "eval:!doc.__islocal", - "fieldname": "quality_inspection", - "fieldtype": "Link", - "label": "Quality Inspection", - "no_copy": 1, - "options": "Quality Inspection", - "print_hide": 1 - }, - { - "fieldname": "column_break_40", - "fieldtype": "Column Break" - }, - { - "fieldname": "subcontracting_order", - "fieldtype": "Link", - "label": "Subcontracting Order", - "no_copy": 1, - "options": "Subcontracting Order", - "print_width": "150px", - "read_only": 1, - "search_index": 1, - "width": "150px" - }, - { - "fieldname": "schedule_date", - "fieldtype": "Date", - "label": "Required By", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "section_break_45", - "fieldtype": "Section Break" - }, - { - "depends_on": "eval:!doc.is_fixed_asset", - "fieldname": "serial_no", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Serial No", - "no_copy": 1 - }, - { - "depends_on": "eval:!doc.is_fixed_asset", - "fieldname": "batch_no", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Batch No", - "no_copy": 1, - "options": "Batch", - "print_hide": 1 - }, - { - "depends_on": "eval:!doc.is_fixed_asset", - "fieldname": "rejected_serial_no", - "fieldtype": "Small Text", - "label": "Rejected Serial No", - "no_copy": 1, - "print_hide": 1 - }, - { - "fieldname": "subcontracting_order_item", - "fieldtype": "Data", - "hidden": 1, - "label": "Subcontracting Order Item", - "no_copy": 1, - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "search_index": 1, - "width": "150px" - }, - { - "fieldname": "col_break5", - "fieldtype": "Column Break" - }, - { - "fieldname": "bom", - "fieldtype": "Link", - "label": "BOM", - "no_copy": 1, - "options": "BOM", - "print_hide": 1 - }, - { - "fetch_from": "item_code.brand", - "fieldname": "brand", - "fieldtype": "Link", - "hidden": 1, - "label": "Brand", - "options": "Brand", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "rm_supp_cost", - "fieldtype": "Currency", - "hidden": 1, - "label": "Raw Materials Supplied Cost", - "no_copy": 1, - "options": "Company:company:default_currency", - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "width": "150px" - }, - { - "fieldname": "expense_account", - "fieldtype": "Link", - "label": "Expense Account", - "options": "Account" - }, - { - "collapsible": 1, - "fieldname": "manufacture_details", - "fieldtype": "Section Break", - "label": "Manufacture" - }, - { - "fieldname": "manufacturer", - "fieldtype": "Link", - "label": "Manufacturer", - "options": "Manufacturer" - }, - { - "fieldname": "column_break_16", - "fieldtype": "Column Break" - }, - { - "fieldname": "manufacturer_part_no", - "fieldtype": "Data", - "label": "Manufacturer Part Number" - }, - { - "fieldname": "subcontracting_receipt_item", - "fieldtype": "Data", - "hidden": 1, - "label": "Subcontracting Receipt Item", - "no_copy": 1, - "print_hide": 1, - "read_only": 1 - }, - { - "collapsible": 1, - "fieldname": "image_column", - "fieldtype": "Column Break" - }, - { - "fieldname": "tracking_section", - "fieldtype": "Section Break" - }, - { - "fieldname": "col_break_tracking_section", - "fieldtype": "Column Break" - }, - { - "fieldname": "accounting_dimensions_section", - "fieldtype": "Section Break", - "label": "Accounting Dimensions" - }, - { - "fieldname": "project", - "fieldtype": "Link", - "label": "Project", - "options": "Project", - "print_hide": 1 - }, - { - "fieldname": "dimension_col_break", - "fieldtype": "Column Break" - }, - { - "default": ":Company", - "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))", - "fieldname": "cost_center", - "fieldtype": "Link", - "label": "Cost Center", - "options": "Cost Center", - "print_hide": 1 - }, - { - "fieldname": "section_break_80", - "fieldtype": "Section Break" - }, - { - "allow_on_submit": 1, - "default": "0", - "fieldname": "page_break", - "fieldtype": "Check", - "label": "Page Break", - "print_hide": 1 - }, - { - "depends_on": "returned_qty", - "fieldname": "returned_qty", - "fieldtype": "Float", - "label": "Returned Qty", - "no_copy": 1, - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "accounting_details_section", - "fieldtype": "Section Break", - "label": "Accounting Details" - }, - { - "default": "1", - "fieldname": "recalculate_rate", - "fieldtype": "Check", - "label": "Recalculate Rate" - } - ], - "idx": 1, - "istable": 1, - "links": [], - "modified": "2022-08-20 17:16:48.269164", - "modified_by": "Administrator", - "module": "Subcontracting", - "name": "Subcontracting Receipt Item", - "naming_rule": "Random", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [] + "actions": [], + "autoname": "hash", + "creation": "2022-04-13 16:05:55.395695", + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "item_code", + "column_break_2", + "item_name", + "section_break_4", + "description", + "brand", + "image_column", + "image", + "image_view", + "received_and_accepted", + "received_qty", + "qty", + "rejected_qty", + "returned_qty", + "col_break2", + "stock_uom", + "conversion_factor", + "tracking_section", + "col_break_tracking_section", + "rate_and_amount", + "rate", + "amount", + "recalculate_rate", + "column_break_19", + "rm_cost_per_qty", + "service_cost_per_qty", + "additional_cost_per_qty", + "rm_supp_cost", + "warehouse_and_reference", + "warehouse", + "rejected_warehouse", + "subcontracting_order", + "column_break_40", + "schedule_date", + "quality_inspection", + "subcontracting_order_item", + "subcontracting_receipt_item", + "section_break_45", + "bom", + "serial_no", + "col_break5", + "batch_no", + "rejected_serial_no", + "manufacture_details", + "manufacturer", + "column_break_16", + "manufacturer_part_no", + "accounting_details_section", + "expense_account", + "accounting_dimensions_section", + "cost_center", + "dimension_col_break", + "project", + "section_break_80", + "page_break" + ], + "fields": [ + { + "bold": 1, + "columns": 3, + "fieldname": "item_code", + "fieldtype": "Link", + "in_global_search": 1, + "in_list_view": 1, + "label": "Item Code", + "options": "Item", + "print_width": "100px", + "reqd": 1, + "search_index": 1, + "width": "100px" + }, + { + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, + { + "fieldname": "item_name", + "fieldtype": "Data", + "in_global_search": 1, + "label": "Item Name", + "print_hide": 1, + "reqd": 1 + }, + { + "collapsible": 1, + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "label": "Description" + }, + { + "fieldname": "description", + "fieldtype": "Text Editor", + "label": "Description", + "print_width": "300px", + "reqd": 1, + "width": "300px" + }, + { + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image" + }, + { + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "print_hide": 1 + }, + { + "fieldname": "received_and_accepted", + "fieldtype": "Section Break", + "label": "Received and Accepted" + }, + { + "bold": 1, + "default": "0", + "fieldname": "received_qty", + "fieldtype": "Float", + "label": "Received Quantity", + "no_copy": 1, + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 1, + "width": "100px" + }, + { + "columns": 2, + "fieldname": "qty", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Accepted Quantity", + "no_copy": 1, + "print_width": "100px", + "width": "100px" + }, + { + "columns": 1, + "depends_on": "eval: !parent.is_return", + "fieldname": "rejected_qty", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Rejected Quantity", + "no_copy": 1, + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "fieldname": "col_break2", + "fieldtype": "Column Break", + "print_hide": 1 + }, + { + "fieldname": "stock_uom", + "fieldtype": "Link", + "label": "Stock UOM", + "options": "UOM", + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 1, + "width": "100px" + }, + { + "default": "1", + "fieldname": "conversion_factor", + "fieldtype": "Float", + "hidden": 1, + "label": "Conversion Factor", + "read_only": 1 + }, + { + "fieldname": "rate_and_amount", + "fieldtype": "Section Break", + "label": "Rate and Amount" + }, + { + "bold": 1, + "columns": 2, + "fieldname": "rate", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Rate", + "options": "currency", + "print_width": "100px", + "read_only": 1, + "read_only_depends_on": "eval: doc.recalculate_rate", + "width": "100px" + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "options": "currency", + "read_only": 1 + }, + { + "fieldname": "column_break_19", + "fieldtype": "Column Break" + }, + { + "fieldname": "rm_cost_per_qty", + "fieldtype": "Currency", + "label": "Raw Material Cost Per Qty", + "no_copy": 1, + "read_only": 1 + }, + { + "fieldname": "service_cost_per_qty", + "fieldtype": "Currency", + "label": "Service Cost Per Qty", + "read_only": 1, + "reqd": 1 + }, + { + "default": "0", + "fieldname": "additional_cost_per_qty", + "fieldtype": "Currency", + "label": "Additional Cost Per Qty", + "read_only": 1 + }, + { + "fieldname": "warehouse_and_reference", + "fieldtype": "Section Break", + "label": "Warehouse and Reference" + }, + { + "bold": 1, + "fieldname": "warehouse", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Accepted Warehouse", + "options": "Warehouse", + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "depends_on": "eval: !parent.is_return", + "fieldname": "rejected_warehouse", + "fieldtype": "Link", + "label": "Rejected Warehouse", + "no_copy": 1, + "options": "Warehouse", + "print_hide": 1, + "print_width": "100px", + "width": "100px" + }, + { + "depends_on": "eval:!doc.__islocal", + "fieldname": "quality_inspection", + "fieldtype": "Link", + "label": "Quality Inspection", + "no_copy": 1, + "options": "Quality Inspection", + "print_hide": 1 + }, + { + "fieldname": "column_break_40", + "fieldtype": "Column Break" + }, + { + "fieldname": "subcontracting_order", + "fieldtype": "Link", + "label": "Subcontracting Order", + "no_copy": 1, + "options": "Subcontracting Order", + "print_width": "150px", + "read_only": 1, + "search_index": 1, + "width": "150px" + }, + { + "fieldname": "schedule_date", + "fieldtype": "Date", + "label": "Required By", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "section_break_45", + "fieldtype": "Section Break" + }, + { + "depends_on": "eval:!doc.is_fixed_asset", + "fieldname": "serial_no", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Serial No", + "no_copy": 1 + }, + { + "depends_on": "eval:!doc.is_fixed_asset", + "fieldname": "batch_no", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Batch No", + "no_copy": 1, + "options": "Batch", + "print_hide": 1 + }, + { + "depends_on": "eval: !parent.is_return", + "fieldname": "rejected_serial_no", + "fieldtype": "Small Text", + "label": "Rejected Serial No", + "no_copy": 1, + "print_hide": 1 + }, + { + "fieldname": "subcontracting_order_item", + "fieldtype": "Data", + "hidden": 1, + "label": "Subcontracting Order Item", + "no_copy": 1, + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "search_index": 1, + "width": "150px" + }, + { + "fieldname": "col_break5", + "fieldtype": "Column Break" + }, + { + "fieldname": "bom", + "fieldtype": "Link", + "label": "BOM", + "no_copy": 1, + "options": "BOM", + "print_hide": 1 + }, + { + "fetch_from": "item_code.brand", + "fieldname": "brand", + "fieldtype": "Link", + "hidden": 1, + "label": "Brand", + "options": "Brand", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "rm_supp_cost", + "fieldtype": "Currency", + "hidden": 1, + "label": "Raw Materials Supplied Cost", + "no_copy": 1, + "options": "Company:company:default_currency", + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "width": "150px" + }, + { + "fieldname": "expense_account", + "fieldtype": "Link", + "label": "Expense Account", + "options": "Account" + }, + { + "collapsible": 1, + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "column_break_16", + "fieldtype": "Column Break" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number" + }, + { + "fieldname": "subcontracting_receipt_item", + "fieldtype": "Data", + "hidden": 1, + "label": "Subcontracting Receipt Item", + "no_copy": 1, + "print_hide": 1, + "read_only": 1 + }, + { + "collapsible": 1, + "fieldname": "image_column", + "fieldtype": "Column Break" + }, + { + "fieldname": "tracking_section", + "fieldtype": "Section Break" + }, + { + "fieldname": "col_break_tracking_section", + "fieldtype": "Column Break" + }, + { + "fieldname": "accounting_dimensions_section", + "fieldtype": "Section Break", + "label": "Accounting Dimensions" + }, + { + "fieldname": "project", + "fieldtype": "Link", + "label": "Project", + "options": "Project", + "print_hide": 1 + }, + { + "fieldname": "dimension_col_break", + "fieldtype": "Column Break" + }, + { + "default": ":Company", + "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))", + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center", + "print_hide": 1 + }, + { + "fieldname": "section_break_80", + "fieldtype": "Section Break" + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "page_break", + "fieldtype": "Check", + "label": "Page Break", + "print_hide": 1 + }, + { + "depends_on": "returned_qty", + "fieldname": "returned_qty", + "fieldtype": "Float", + "label": "Returned Qty", + "no_copy": 1, + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "accounting_details_section", + "fieldtype": "Section Break", + "label": "Accounting Details" + }, + { + "default": "1", + "fieldname": "recalculate_rate", + "fieldtype": "Check", + "label": "Recalculate Rate" + } + ], + "idx": 1, + "istable": 1, + "links": [], + "modified": "2022-11-16 14:21:26.125815", + "modified_by": "Administrator", + "module": "Subcontracting", + "name": "Subcontracting Receipt Item", + "naming_rule": "Random", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "states": [] } \ No newline at end of file From 57b00e3b16d6150c8f1263506c73eebc2c4ac0bc Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 17 Nov 2022 15:53:56 +0530 Subject: [PATCH 25/38] fix: Bulk payment generation against invoices (cherry picked from commit 2dfe849c7d8e4e4f6c468b6728a7485daffd5c6b) --- .../doctype/purchase_invoice/purchase_invoice_list.js | 2 +- .../doctype/sales_invoice/sales_invoice_list.js | 2 +- erpnext/utilities/bulk_transaction.py | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js index 82d00308db4..e1c37c60013 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js @@ -63,7 +63,7 @@ frappe.listview_settings["Purchase Invoice"] = { }); listview.page.add_action_item(__("Payment"), ()=>{ - erpnext.bulk_transaction_processing.create(listview, "Purchase Invoice", "Payment"); + erpnext.bulk_transaction_processing.create(listview, "Purchase Invoice", "Payment Entry"); }); } }; diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js index 1130284ecc5..1605b151a14 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js @@ -29,7 +29,7 @@ frappe.listview_settings['Sales Invoice'] = { }); listview.page.add_action_item(__("Payment"), ()=>{ - erpnext.bulk_transaction_processing.create(listview, "Sales Invoice", "Payment"); + erpnext.bulk_transaction_processing.create(listview, "Sales Invoice", "Payment Entry"); }); } }; diff --git a/erpnext/utilities/bulk_transaction.py b/erpnext/utilities/bulk_transaction.py index eed7c12763b..c1579b3cbcc 100644 --- a/erpnext/utilities/bulk_transaction.py +++ b/erpnext/utilities/bulk_transaction.py @@ -73,7 +73,7 @@ def task(doc_name, from_doctype, to_doctype): }, "Sales Invoice": { "Delivery Note": sales_invoice.make_delivery_note, - "Payment": payment_entry.get_payment_entry, + "Payment Entry": payment_entry.get_payment_entry, }, "Delivery Note": { "Sales Invoice": delivery_note.make_sales_invoice, @@ -94,11 +94,11 @@ def task(doc_name, from_doctype, to_doctype): }, "Purchase Invoice": { "Purchase Receipt": purchase_invoice.make_purchase_receipt, - "Payment": payment_entry.get_payment_entry, + "Payment Entry": payment_entry.get_payment_entry, }, "Purchase Receipt": {"Purchase Invoice": purchase_receipt.make_purchase_invoice}, } - if to_doctype in ["Advance Payment", "Payment"]: + if to_doctype in ["Advance Payment", "Payment Entry"]: obj = mapper[from_doctype][to_doctype](from_doctype, doc_name) else: obj = mapper[from_doctype][to_doctype](doc_name) @@ -151,7 +151,9 @@ def update_logger(doc_name, e, from_doctype, to_doctype, status, log_date=None, def show_job_status(fail_count, deserialized_data_count, to_doctype): if not fail_count: frappe.msgprint( - _("Creation of {0} successful").format(to_doctype), + _("Creation of {1}(s) successful").format( + to_doctype.lower().replace(" ", "-"), to_doctype + ), title="Successful", indicator="green", ) From 9e8a8356e9ede1e19e68bde1c7f8021a6842feb9 Mon Sep 17 00:00:00 2001 From: gavin Date: Fri, 18 Nov 2022 17:17:54 +0530 Subject: [PATCH 26/38] fix(realtime): Restrict updates to only last modified or current user (#33034) (cherry picked from commit dd2493a541f0f8f8a231c4ba32970898b1bab224) --- .../opening_invoice_creation_tool.js | 1 - .../opening_invoice_creation_tool.py | 2 +- .../accounts/doctype/pos_closing_entry/pos_closing_entry.js | 2 +- .../doctype/pos_invoice_merge_log/pos_invoice_merge_log.py | 4 ++-- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 2 +- .../doctype/tally_migration/tally_migration.py | 1 + .../import_supplier_invoice/import_supplier_invoice.py | 4 +++- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js index 1f4166151a1..88867d11bb8 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js @@ -20,7 +20,6 @@ frappe.ui.form.on('Opening Invoice Creation Tool', { frm.dashboard.reset(); frm.doc.import_in_progress = true; } - if (data.user != frappe.session.user) return; if (data.count == data.total) { setTimeout(() => { frm.doc.import_in_progress = false; diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py index c566b420ba8..684c5f72e13 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py @@ -262,10 +262,10 @@ def publish(index, total, doctype): dict( title=_("Opening Invoice Creation In Progress"), message=_("Creating {} out of {} {}").format(index + 1, total, doctype), - user=frappe.session.user, count=index + 1, total=total, ), + user=frappe.session.user, ) diff --git a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js index 1d596c1bfbb..e6d9fe2b54d 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js +++ b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.js @@ -25,7 +25,7 @@ frappe.ui.form.on('POS Closing Entry', { frappe.realtime.on('closing_process_complete', async function(data) { await frm.reload_doc(); - if (frm.doc.status == 'Failed' && frm.doc.error_message && data.user == frappe.session.user) { + if (frm.doc.status == 'Failed' && frm.doc.error_message) { frappe.msgprint({ title: __('POS Closing Failed'), message: frm.doc.error_message, diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py index 81a234a20a7..70e3baff2e4 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py @@ -431,7 +431,7 @@ def create_merge_logs(invoice_by_customer, closing_entry=None): finally: frappe.db.commit() - frappe.publish_realtime("closing_process_complete", {"user": frappe.session.user}) + frappe.publish_realtime("closing_process_complete", user=frappe.session.user) def cancel_merge_logs(merge_logs, closing_entry=None): @@ -458,7 +458,7 @@ def cancel_merge_logs(merge_logs, closing_entry=None): finally: frappe.db.commit() - frappe.publish_realtime("closing_process_complete", {"user": frappe.session.user}) + frappe.publish_realtime("closing_process_complete", user=frappe.session.user) def enqueue_job(job, **kwargs): diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index b93c5c4d38c..da5699776fd 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -1345,7 +1345,7 @@ class QuickBooksMigrator(Document): )[0]["name"] def _publish(self, *args, **kwargs): - frappe.publish_realtime("quickbooks_progress_update", *args, **kwargs) + frappe.publish_realtime("quickbooks_progress_update", *args, **kwargs, user=self.modified_by) def _get_unique_account_name(self, quickbooks_name, number=0): if number: diff --git a/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py b/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py index cd4aaee2c45..e6840f505be 100644 --- a/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py +++ b/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py @@ -304,6 +304,7 @@ class TallyMigration(Document): frappe.publish_realtime( "tally_migration_progress_update", {"title": title, "message": message, "count": count, "total": total}, + user=self.modified_by, ) def _import_master_data(self): diff --git a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py index 34701c140d6..c52685e330a 100644 --- a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py +++ b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py @@ -146,7 +146,9 @@ class ImportSupplierInvoice(Document): def publish(self, title, message, count, total): frappe.publish_realtime( - "import_invoice_update", {"title": title, "message": message, "count": count, "total": total} + "import_invoice_update", + {"title": title, "message": message, "count": count, "total": total}, + user=self.modified_by, ) From b78220957b2362f0f05205b6c53075b6402bfda2 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 18 Nov 2022 15:07:12 +0530 Subject: [PATCH 27/38] fix: Accounting Dimension filtering for Sales and Purchase Report (cherry picked from commit 8b394afaa99b15cc4876fe28e13a8def01010cc7) --- .../accounts/report/purchase_register/purchase_register.py | 4 ++-- erpnext/accounts/report/sales_register/sales_register.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index e8a1e795d92..a05d581207c 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -232,12 +232,12 @@ def get_conditions(filters): conditions += ( common_condition - + "and ifnull(`tabPurchase Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname) + + "and ifnull(`tabPurchase Invoice`.{0}, '') in %({0})s)".format(dimension.fieldname) ) else: conditions += ( common_condition - + "and ifnull(`tabPurchase Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname) + + "and ifnull(`tabPurchase Invoice`.{0}, '') in %({0})s)".format(dimension.fieldname) ) return conditions diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index 06e3c6120de..b333901d7b3 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -390,12 +390,12 @@ def get_conditions(filters): conditions += ( common_condition - + "and ifnull(`tabSales Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname) + + "and ifnull(`tabSales Invoice`.{0}, '') in %({0})s)".format(dimension.fieldname) ) else: conditions += ( common_condition - + "and ifnull(`tabSales Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname) + + "and ifnull(`tabSales Invoice`.{0}, '') in %({0})s)".format(dimension.fieldname) ) return conditions From a26470a65f10ecc33beaae1d4afbdbb62248e9ed Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 17 Nov 2022 10:28:31 +0530 Subject: [PATCH 28/38] fix: incorrect currency in Exchange rate revaluation (cherry picked from commit 68b04e25775b2342ec6e1a0be517c476c0b5c1b1) --- .../exchange_rate_revaluation.json | 485 +++++------------- .../exchange_rate_revaluation_account.json | 427 ++------------- 2 files changed, 153 insertions(+), 759 deletions(-) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.json b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.json index a7315a672a3..e00b17e5a53 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.json +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.json @@ -1,389 +1,138 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 1, - "allow_rename": 0, - "autoname": "ACC-ERR-.YYYY.-.#####", - "beta": 0, - "creation": "2018-04-13 18:25:55.943587", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "actions": [], + "allow_import": 1, + "autoname": "ACC-ERR-.YYYY.-.#####", + "creation": "2018-04-13 18:25:55.943587", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "posting_date", + "column_break_2", + "company", + "section_break_4", + "get_entries", + "accounts", + "section_break_6", + "total_gain_loss", + "amended_from" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Today", - "fieldname": "posting_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Posting Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "default": "Today", + "fieldname": "posting_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Posting Date", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_2", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Company", - "length": 0, - "no_copy": 0, - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_4", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_4", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "get_entries", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Get Entries", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "get_entries", + "fieldtype": "Button", + "label": "Get Entries" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "accounts", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Exchange Rate Revaluation Account", - "length": 0, - "no_copy": 1, - "options": "Exchange Rate Revaluation Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "accounts", + "fieldtype": "Table", + "label": "Exchange Rate Revaluation Account", + "no_copy": 1, + "options": "Exchange Rate Revaluation Account", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_6", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_6", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "total_gain_loss", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Total Gain/Loss", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "total_gain_loss", + "fieldtype": "Currency", + "label": "Total Gain/Loss", + "options": "Company:company:default_currency", + "read_only": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Amended From", - "length": 0, - "no_copy": 1, - "options": "Exchange Rate Revaluation", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Exchange Rate Revaluation", + "print_hide": 1, + "read_only": 1 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 1, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-08-21 16:15:34.660715", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Exchange Rate Revaluation", - "name_case": "", - "owner": "Administrator", + ], + "is_submittable": 1, + "links": [], + "modified": "2022-11-17 10:28:03.911554", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Exchange Rate Revaluation", + "naming_rule": "Expression (old style)", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "set_user_permissions": 0, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "share": 1, + "submit": 1, "write": 1 } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0, - "track_views": 0 + ], + "sort_field": "modified", + "sort_order": "DESC", + "states": [], + "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json index 30ff9ebed5b..80e972bbdf2 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json +++ b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json @@ -1,475 +1,120 @@ { - "allow_copy": 0, - "allow_events_in_timeline": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, + "actions": [], "creation": "2018-04-13 18:30:06.110433", - "custom": 0, - "docstatus": 0, "doctype": "DocType", - "document_type": "", "editable_grid": 1, "engine": "InnoDB", + "field_order": [ + "account", + "party_type", + "party", + "column_break_2", + "account_currency", + "balance_in_account_currency", + "balances", + "current_exchange_rate", + "balance_in_base_currency", + "column_break_9", + "new_exchange_rate", + "new_balance_in_base_currency", + "gain_loss" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "account", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Account", - "length": 0, - "no_copy": 0, "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "party_type", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Party Type", - "length": 0, - "no_copy": 0, - "options": "DocType", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "DocType" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "party", "fieldtype": "Dynamic Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Party", - "length": 0, - "no_copy": 0, - "options": "party_type", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "party_type" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldtype": "Column Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "account_currency", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Account Currency", - "length": 0, - "no_copy": 0, "options": "Currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "balance_in_account_currency", "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Balance In Account Currency", - "length": 0, - "no_copy": 0, "options": "account_currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "balances", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldtype": "Section Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "current_exchange_rate", "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Current Exchange Rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "balance_in_base_currency", "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Balance In Base Currency", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "Company:company:default_currency", + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "column_break_9", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldtype": "Column Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "new_exchange_rate", "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "New Exchange Rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "new_balance_in_base_currency", "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "New Balance In Base Currency", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "Company:company:default_currency", + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, "fieldname": "gain_loss", "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Gain/Loss", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "Company:company:default_currency", + "read_only": 1 } ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, "istable": 1, - "max_attachments": 0, - "modified": "2019-06-26 18:57:51.762345", + "links": [], + "modified": "2022-11-17 10:26:18.302728", "modified_by": "Administrator", "module": "Accounts", "name": "Exchange Rate Revaluation Account", - "name_case": "", "owner": "Administrator", "permissions": [], "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0, - "track_views": 0 + "states": [], + "track_changes": 1 } \ No newline at end of file From f2fde8327d0cdedd78024a7ca8b9896b47f659ae Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 17 Nov 2022 10:52:40 +0530 Subject: [PATCH 29/38] fix: always send account currency in response (cherry picked from commit 5caaccc94bdd50b0ba052f05b4bcbecaf9147cab) --- .../exchange_rate_revaluation.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py index 2f81c5fb750..c907a25e14d 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py @@ -233,6 +233,10 @@ def get_account_details(account, company, posting_date, party_type=None, party=N balance = get_balance_on( account, date=posting_date, party_type=party_type, party=party, in_account_currency=False ) + account_details = { + "account_currency": account_currency, + } + if balance: balance_in_account_currency = get_balance_on( account, date=posting_date, party_type=party_type, party=party @@ -242,13 +246,14 @@ def get_account_details(account, company, posting_date, party_type=None, party=N ) new_exchange_rate = get_exchange_rate(account_currency, company_currency, posting_date) new_balance_in_base_currency = balance_in_account_currency * new_exchange_rate - account_details = { - "account_currency": account_currency, - "balance_in_base_currency": balance, - "balance_in_account_currency": balance_in_account_currency, - "current_exchange_rate": current_exchange_rate, - "new_exchange_rate": new_exchange_rate, - "new_balance_in_base_currency": new_balance_in_base_currency, - } + account_details = account_details.update( + { + "balance_in_base_currency": balance, + "balance_in_account_currency": balance_in_account_currency, + "current_exchange_rate": current_exchange_rate, + "new_exchange_rate": new_exchange_rate, + "new_balance_in_base_currency": new_balance_in_base_currency, + } + ) return account_details From b428307e9f4c3013b8bc8e14ba4379ac9d447ca3 Mon Sep 17 00:00:00 2001 From: Devin Slauenwhite Date: Mon, 14 Nov 2022 17:38:46 -0500 Subject: [PATCH 30/38] fix: link to brand doctype. (cherry picked from commit cee069d42666391c058140163b4b0c1c054434f7) --- erpnext/stock/doctype/item_price/item_price.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json index 8c6f6d85a46..73e326d7616 100644 --- a/erpnext/stock/doctype/item_price/item_price.json +++ b/erpnext/stock/doctype/item_price/item_price.json @@ -77,9 +77,10 @@ { "fetch_from": "item_code.brand", "fieldname": "brand", - "fieldtype": "Read Only", + "fieldtype": "Link", "in_list_view": 1, "label": "Brand", + "options": "Brand", "read_only": 1 }, { @@ -218,11 +219,10 @@ "idx": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2022-09-02 16:33:55.612992", + "modified": "2022-11-14 17:26:49.052007", "modified_by": "Administrator", "module": "Stock", "name": "Item Price", - "name_case": "Title Case", "owner": "Administrator", "permissions": [ { From a198a55d2d16e3c050d288701b1acd83dce3c0e0 Mon Sep 17 00:00:00 2001 From: Devin Slauenwhite Date: Tue, 15 Nov 2022 08:26:16 -0500 Subject: [PATCH 31/38] fix: naming (cherry picked from commit 3a356514417c4886855ea6ce39c5d69d8421d107) --- erpnext/stock/doctype/item_price/item_price.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json index 73e326d7616..f4d9bb0742d 100644 --- a/erpnext/stock/doctype/item_price/item_price.json +++ b/erpnext/stock/doctype/item_price/item_price.json @@ -1,6 +1,7 @@ { "actions": [], "allow_import": 1, + "autoname": "hash", "creation": "2013-05-02 16:29:48", "description": "Multiple Item prices.", "doctype": "DocType", @@ -219,10 +220,11 @@ "idx": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2022-11-14 17:26:49.052007", + "modified": "2022-11-15 08:26:04.041861", "modified_by": "Administrator", "module": "Stock", "name": "Item Price", + "naming_rule": "Random", "owner": "Administrator", "permissions": [ { From da2dfcc10b33bb6ba75dd4652ddc1caf71dd3325 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 20 Nov 2022 20:30:24 +0530 Subject: [PATCH 32/38] fix: Viewing account ledger from party master (cherry picked from commit 15e74c5d7b951e203c3b2c8ead4cbe9b8031fb3a) --- erpnext/accounts/report/general_ledger/general_ledger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 82f38dacd2a..af559d4c1ab 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -121,7 +121,7 @@ def set_account_currency(filters): if is_same_account_currency: account_currency = currency - elif filters.get("party"): + elif filters.get("party") and filters.get("party_type"): gle_currency = frappe.db.get_value( "GL Entry", {"party_type": filters.party_type, "party": filters.party[0], "company": filters.company}, @@ -134,7 +134,7 @@ def set_account_currency(filters): account_currency = ( None if filters.party_type in ["Employee", "Shareholder", "Member"] - else frappe.db.get_value(filters.party_type, filters.party[0], "default_currency") + else frappe.get_cached_value(filters.party_type, filters.party[0], "default_currency") ) filters["account_currency"] = account_currency or filters.company_currency From 53cf6b8c89a75d6959dbe727b2527820091f6982 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 20 Nov 2022 19:45:51 +0530 Subject: [PATCH 33/38] fix: Timesheet timer button (cherry picked from commit 64802d1220bc278dd1cdd9fe2365da47c1c3a4bf) --- erpnext/public/js/projects/timer.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js index 0e5c0d3720e..9dae7118d9a 100644 --- a/erpnext/public/js/projects/timer.js +++ b/erpnext/public/js/projects/timer.js @@ -48,21 +48,23 @@ erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) { var $btn_complete = dialog.$wrapper.find(".playpause .btn-complete"); var interval = null; var currentIncrement = timestamp; - var initialised = row ? true : false; + var initialized = row ? true : false; var clicked = false; var flag = true; // Alert only once // If row with not completed status, initialize timer with the time elapsed on click of 'Start Timer'. if (row) { - initialised = true; + initialized = true; $btn_start.hide(); $btn_complete.show(); - initialiseTimer(); + initializeTimer(); } - if (!initialised) { + + if (!initialized) { $btn_complete.hide(); } + $btn_start.click(function(e) { - if (!initialised) { + if (!initialized) { // New activity if no activities found var args = dialog.get_values(); if(!args) return; @@ -90,11 +92,11 @@ erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) { return false; } - if (!initialised) { - initialised = true; + if (!initialized) { + initialized = true; $btn_start.hide(); $btn_complete.show(); - initialiseTimer(); + initializeTimer(); } }); @@ -110,11 +112,13 @@ erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) { grid_row.doc.hours = currentIncrement / 3600; grid_row.doc.to_time = frappe.datetime.now_datetime(); grid_row.refresh(); + frm.dirty(); frm.save(); reset(); dialog.hide(); }); - function initialiseTimer() { + + function initializeTimer() { interval = setInterval(function() { var current = setCurrentIncrement(); updateStopwatch(current); @@ -151,7 +155,7 @@ erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) { function reset() { currentIncrement = 0; - initialised = false; + initialized = false; clearInterval(interval); $(".hours").text("00"); $(".minutes").text("00"); From 14235f24b2905fc026f3a42e6e17e6e60dc253e2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 22 Nov 2022 12:16:11 +0530 Subject: [PATCH 34/38] fix: update advace paid in SO/PO in account currency (cherry picked from commit bf76b85dfd3562f4384cdd9a42322e5a41bfd734) --- erpnext/controllers/accounts_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 216c9f45d3f..1849e8b3b55 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1352,12 +1352,12 @@ class AccountsController(TransactionBase): party = self.customer if self.doctype == "Sales Order" else self.supplier advance = ( frappe.qb.from_(ple) - .select(ple.account_currency, Abs(Sum(ple.amount)).as_("amount")) + .select(ple.account_currency, Abs(Sum(ple.amount_in_account_currency)).as_("amount")) .where( (ple.against_voucher_type == self.doctype) & (ple.against_voucher_no == self.name) & (ple.party == party) - & (ple.delinked == 0) + & (ple.docstatus == 1) & (ple.company == self.company) ) .run(as_dict=True) From 48a3b3f6f39da632adaf4659824b660f2da7bb9a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 22 Nov 2022 12:16:32 +0530 Subject: [PATCH 35/38] test: fix test case for SO/PO advance amount (cherry picked from commit 541cf153f7c5243c050a7344c6cb60806e213ebd) --- .../purchase_order/test_purchase_order.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 5206a428c4e..291d756a415 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -736,27 +736,29 @@ class TestPurchaseOrder(FrappeTestCase): def test_advance_paid_upon_payment_entry_cancellation(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry - po_doc = create_purchase_order() + po_doc = create_purchase_order(supplier="_Test Supplier USD", currency="USD", do_not_submit=1) + po_doc.conversion_rate = 80 + po_doc.submit() - pe = get_payment_entry("Purchase Order", po_doc.name, bank_account="_Test Bank - _TC") - pe.reference_no = "1" - pe.reference_date = nowdate() - pe.paid_from_account_currency = po_doc.currency - pe.paid_to_account_currency = po_doc.currency - pe.source_exchange_rate = 1 + pe = get_payment_entry("Purchase Order", po_doc.name) + pe.mode_of_payment = "Cash" + pe.paid_from = "Cash - _TC" + pe.source_exchange_rate = 80 pe.target_exchange_rate = 1 pe.paid_amount = po_doc.grand_total pe.save(ignore_permissions=True) pe.submit() po_doc.reload() - self.assertEqual(po_doc.advance_paid, po_doc.base_grand_total) + self.assertEqual(po_doc.advance_paid, po_doc.grand_total) + self.assertEqual(po_doc.party_account_currency, "USD") pe_doc = frappe.get_doc("Payment Entry", pe.name) pe_doc.cancel() po_doc.reload() self.assertEqual(po_doc.advance_paid, 0) + self.assertEqual(po_doc.party_account_currency, "USD") def test_schedule_date(self): po = create_purchase_order(do_not_submit=True) From 54317b56ea33e7f5696ffebbd89707bbcffd61be Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 22 Nov 2022 12:50:00 +0530 Subject: [PATCH 36/38] chore: Rearrange supplier invoice section in Purchase Invoice (cherry picked from commit e96be712b849f9e93b3afc386afce7abf3594f82) --- .../doctype/purchase_invoice/purchase_invoice.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 370c0fc9605..a5981fdebd1 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -25,6 +25,10 @@ "apply_tds", "tax_withholding_category", "amended_from", + "supplier_invoice_details", + "bill_no", + "column_break_15", + "bill_date", "accounting_dimensions_section", "cost_center", "dimension_col_break", @@ -151,10 +155,6 @@ "status", "column_break_177", "per_received", - "supplier_invoice_details", - "bill_no", - "column_break_15", - "bill_date", "accounting_details_section", "credit_to", "party_account_currency", @@ -1540,7 +1540,7 @@ "idx": 204, "is_submittable": 1, "links": [], - "modified": "2022-11-04 01:02:44.544878", + "modified": "2022-11-22 12:44:29.935567", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", From 7487acdeb6d6003450d09e6c2033c248a0d9446c Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 21 Nov 2022 21:50:55 +0530 Subject: [PATCH 37/38] fix: Don't show payment button for invoices on hold (cherry picked from commit 1b9e83251f07e1ce12f9a315ec84bda8072c49b4) --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 39a623519a6..a098e8d1db8 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -81,7 +81,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying. } if(doc.docstatus == 1 && doc.outstanding_amount != 0 - && !(doc.is_return && doc.return_against)) { + && !(doc.is_return && doc.return_against) && !doc.on_hold) { this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __('Create')); cur_frm.page.set_inner_btn_group_as_primary(__('Create')); } @@ -99,7 +99,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying. } } - if (doc.outstanding_amount > 0 && !cint(doc.is_return)) { + if (doc.outstanding_amount > 0 && !cint(doc.is_return) && !doc.on_hold) { cur_frm.add_custom_button(__('Payment Request'), function() { me.make_payment_request() }, __('Create')); From 387665d221d28450a4f7a49e71fcabc0c56062da Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 21 Nov 2022 22:21:03 +0530 Subject: [PATCH 38/38] fix: Remove unnecessary filters from Journal Entry (cherry picked from commit cd88a53533b2214c0f7f86e5e6d57cd112978825) --- erpnext/accounts/doctype/journal_entry/journal_entry.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index a5ff7f1aa79..30a32015f5d 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -253,9 +253,6 @@ erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Contro var party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to"; out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]); - if (in_list(['Debit Note', 'Credit Note'], doc.voucher_type)) { - out.filters.push([jvd.reference_type, "is_return", "=", 1]); - } } if(in_list(["Sales Order", "Purchase Order"], jvd.reference_type)) {