From be72e64633fe8053a23f14cd1e1f5e383bae7a25 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Sun, 27 Apr 2025 18:04:53 +0200 Subject: [PATCH 1/2] feat(Customer): add table Supplier Numbers --- .../selling/doctype/customer/customer.json | 12 +++++- erpnext/selling/doctype/customer/customer.py | 8 ++-- .../supplier_number_at_customer/__init__.py | 0 .../supplier_number_at_customer.json | 41 +++++++++++++++++++ .../supplier_number_at_customer.py | 24 +++++++++++ 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 erpnext/selling/doctype/supplier_number_at_customer/__init__.py create mode 100644 erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.json create mode 100644 erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.py diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 06e8432d672..33ddc6d316d 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -42,6 +42,7 @@ "language", "column_break_45", "customer_details", + "supplier_numbers", "dashboard_tab", "contact_and_address_tab", "address_contacts", @@ -597,6 +598,13 @@ "fieldtype": "Read Only", "hidden": 1, "label": "Last Name" + }, + { + "description": "Supplier numbers assigned by the customer", + "fieldname": "supplier_numbers", + "fieldtype": "Table", + "label": "Supplier Numbers", + "options": "Supplier Number At Customer" } ], "icon": "fa fa-user", @@ -610,7 +618,7 @@ "link_fieldname": "party" } ], - "modified": "2025-03-05 10:01:47.885574", + "modified": "2025-04-27 12:01:29.549008", "modified_by": "Administrator", "module": "Selling", "name": "Customer", @@ -696,4 +704,4 @@ "states": [], "title_field": "customer_name", "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 869dc944a3b..8d61d0fa246 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -35,10 +35,11 @@ class Customer(TransactionBase): AllowedToTransactWith, ) from erpnext.accounts.doctype.party_account.party_account import PartyAccount - from erpnext.selling.doctype.customer_credit_limit.customer_credit_limit import ( - CustomerCreditLimit, - ) + from erpnext.selling.doctype.customer_credit_limit.customer_credit_limit import CustomerCreditLimit from erpnext.selling.doctype.sales_team.sales_team import SalesTeam + from erpnext.selling.doctype.supplier_number_at_customer.supplier_number_at_customer import ( + SupplierNumberAtCustomer, + ) from erpnext.utilities.doctype.portal_user.portal_user import PortalUser account_manager: DF.Link | None @@ -83,6 +84,7 @@ class Customer(TransactionBase): sales_team: DF.Table[SalesTeam] salutation: DF.Link | None so_required: DF.Check + supplier_numbers: DF.Table[SupplierNumberAtCustomer] tax_category: DF.Link | None tax_id: DF.Data | None tax_withholding_category: DF.Link | None diff --git a/erpnext/selling/doctype/supplier_number_at_customer/__init__.py b/erpnext/selling/doctype/supplier_number_at_customer/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.json b/erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.json new file mode 100644 index 00000000000..867561dea4a --- /dev/null +++ b/erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.json @@ -0,0 +1,41 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2025-04-27 11:59:08.238924", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "company", + "supplier_number" + ], + "fields": [ + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company" + }, + { + "fieldname": "supplier_number", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Supplier Number" + } + ], + "grid_page_length": 50, + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2025-04-27 12:00:04.890068", + "modified_by": "Administrator", + "module": "Selling", + "name": "Supplier Number At Customer", + "owner": "Administrator", + "permissions": [], + "row_format": "Dynamic", + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} diff --git a/erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.py b/erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.py new file mode 100644 index 00000000000..c3cf2bff81b --- /dev/null +++ b/erpnext/selling/doctype/supplier_number_at_customer/supplier_number_at_customer.py @@ -0,0 +1,24 @@ +# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class SupplierNumberAtCustomer(Document): + # begin: auto-generated types + # This code is auto-generated. Do not modify anything in this block. + + from typing import TYPE_CHECKING + + if TYPE_CHECKING: + from frappe.types import DF + + company: DF.Link | None + parent: DF.Data + parentfield: DF.Data + parenttype: DF.Data + supplier_number: DF.Data | None + # end: auto-generated types + + pass From edcc1d39ae3f6775c909454f4dc76ff3e294816f Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Sun, 27 Apr 2025 18:09:13 +0200 Subject: [PATCH 2/2] feat(Supplier): add table Customer Numbers --- .../customer_number_at_supplier/__init__.py | 0 .../customer_number_at_supplier.json | 41 +++++++++++++++++++ .../customer_number_at_supplier.py | 24 +++++++++++ erpnext/buying/doctype/supplier/supplier.json | 13 +++++- erpnext/buying/doctype/supplier/supplier.py | 4 ++ 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 erpnext/buying/doctype/customer_number_at_supplier/__init__.py create mode 100644 erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.json create mode 100644 erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.py diff --git a/erpnext/buying/doctype/customer_number_at_supplier/__init__.py b/erpnext/buying/doctype/customer_number_at_supplier/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.json b/erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.json new file mode 100644 index 00000000000..9c1246371e8 --- /dev/null +++ b/erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.json @@ -0,0 +1,41 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2025-04-27 12:05:44.989999", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "company", + "customer_number" + ], + "fields": [ + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company" + }, + { + "fieldname": "customer_number", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Customer Number" + } + ], + "grid_page_length": 50, + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2025-04-27 12:06:04.146431", + "modified_by": "Administrator", + "module": "Buying", + "name": "Customer Number At Supplier", + "owner": "Administrator", + "permissions": [], + "row_format": "Dynamic", + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} diff --git a/erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.py b/erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.py new file mode 100644 index 00000000000..e27bdd5fa11 --- /dev/null +++ b/erpnext/buying/doctype/customer_number_at_supplier/customer_number_at_supplier.py @@ -0,0 +1,24 @@ +# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class CustomerNumberAtSupplier(Document): + # begin: auto-generated types + # This code is auto-generated. Do not modify anything in this block. + + from typing import TYPE_CHECKING + + if TYPE_CHECKING: + from frappe.types import DF + + company: DF.Link | None + customer_number: DF.Data | None + parent: DF.Data + parentfield: DF.Data + parenttype: DF.Data + # end: auto-generated types + + pass diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index c35abc9c122..6975bd56571 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -33,6 +33,7 @@ "column_break_30", "website", "language", + "customer_numbers", "dashboard_tab", "tax_tab", "tax_id", @@ -473,8 +474,15 @@ { "fieldname": "column_break_mglr", "fieldtype": "Column Break" + }, + { + "fieldname": "customer_numbers", + "fieldtype": "Table", + "label": "Customer Numbers", + "options": "Customer Number At Supplier" } ], + "grid_page_length": 50, "icon": "fa fa-user", "idx": 370, "image_field": "image", @@ -485,7 +493,7 @@ "link_fieldname": "party" } ], - "modified": "2024-05-08 18:02:57.342931", + "modified": "2025-04-27 12:07:10.859758", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", @@ -544,6 +552,7 @@ } ], "quick_entry": 1, + "row_format": "Dynamic", "search_fields": "supplier_group", "show_name_in_global_search": 1, "sort_field": "creation", @@ -551,4 +560,4 @@ "states": [], "title_field": "supplier_name", "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 3b72953c563..e3aac1b407a 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -32,6 +32,9 @@ class Supplier(TransactionBase): AllowedToTransactWith, ) from erpnext.accounts.doctype.party_account.party_account import PartyAccount + from erpnext.buying.doctype.customer_number_at_supplier.customer_number_at_supplier import ( + CustomerNumberAtSupplier, + ) from erpnext.utilities.doctype.portal_user.portal_user import PortalUser accounts: DF.Table[PartyAccount] @@ -39,6 +42,7 @@ class Supplier(TransactionBase): allow_purchase_invoice_creation_without_purchase_receipt: DF.Check companies: DF.Table[AllowedToTransactWith] country: DF.Link | None + customer_numbers: DF.Table[CustomerNumberAtSupplier] default_bank_account: DF.Link | None default_currency: DF.Link | None default_price_list: DF.Link | None