mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 07:20:26 +00:00
feat: Merge POS invoices based on customer group (#27471)
* feat: Merge POS invoices based on customer group
* fix: Linting Issues
* fix: fieldname
Co-authored-by: Saqib <nextchamp.saqib@gmail.com>
(cherry picked from commit c9c8957250)
# Conflicts:
# erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.json
# erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
# erpnext/accounts/doctype/sales_invoice/sales_invoice.py
# erpnext/hooks.py
# erpnext/patches.txt
# erpnext/patches/v13_0/create_accounting_dimensions_in_pos_doctypes.py
This commit is contained in:
@@ -6,7 +6,10 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"posting_date",
|
||||
<<<<<<< HEAD
|
||||
"posting_time",
|
||||
=======
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
"merge_invoices_based_on",
|
||||
"column_break_3",
|
||||
"pos_closing_entry",
|
||||
@@ -106,6 +109,7 @@
|
||||
"label": "Customer Group",
|
||||
"mandatory_depends_on": "eval:doc.merge_invoices_based_on == 'Customer Group'",
|
||||
"options": "Customer Group"
|
||||
<<<<<<< HEAD
|
||||
},
|
||||
{
|
||||
"fieldname": "posting_time",
|
||||
@@ -113,12 +117,18 @@
|
||||
"label": "Posting Time",
|
||||
"no_copy": 1,
|
||||
"reqd": 1
|
||||
=======
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
<<<<<<< HEAD
|
||||
"modified": "2022-08-01 11:36:42.456429",
|
||||
=======
|
||||
"modified": "2021-09-14 11:17:19.001142",
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Invoice Merge Log",
|
||||
|
||||
@@ -36,7 +36,11 @@ class POSInvoiceMergeLog(Document):
|
||||
frappe.throw(error_list, title=_("Duplicate POS Invoices found"), as_list=True)
|
||||
|
||||
def validate_customer(self):
|
||||
<<<<<<< HEAD
|
||||
if self.merge_invoices_based_on == "Customer Group":
|
||||
=======
|
||||
if self.merge_invoices_based_on == 'Customer Group':
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
return
|
||||
|
||||
for d in self.pos_invoices:
|
||||
@@ -165,6 +169,7 @@ class POSInvoiceMergeLog(Document):
|
||||
for item in doc.get("items"):
|
||||
found = False
|
||||
for i in items:
|
||||
<<<<<<< HEAD
|
||||
if (
|
||||
i.item_code == item.item_code
|
||||
and not i.serial_no
|
||||
@@ -173,6 +178,10 @@ class POSInvoiceMergeLog(Document):
|
||||
and i.net_rate == item.net_rate
|
||||
and i.warehouse == item.warehouse
|
||||
):
|
||||
=======
|
||||
if (i.item_code == item.item_code and not i.serial_no and not i.batch_no and
|
||||
i.uom == item.uom and i.net_rate == item.net_rate and i.warehouse == item.warehouse):
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
found = True
|
||||
i.qty = i.qty + item.qty
|
||||
i.amount = i.amount + item.net_amount
|
||||
@@ -238,6 +247,7 @@ class POSInvoiceMergeLog(Document):
|
||||
invoice.taxes_and_charges = None
|
||||
invoice.ignore_pricing_rule = 1
|
||||
invoice.customer = self.customer
|
||||
<<<<<<< HEAD
|
||||
invoice.disable_rounded_total = cint(
|
||||
frappe.db.get_value("POS Profile", invoice.pos_profile, "disable_rounded_total")
|
||||
)
|
||||
@@ -245,6 +255,12 @@ class POSInvoiceMergeLog(Document):
|
||||
if self.merge_invoices_based_on == "Customer Group":
|
||||
invoice.flags.ignore_pos_profile = True
|
||||
invoice.pos_profile = ""
|
||||
=======
|
||||
|
||||
if self.merge_invoices_based_on == 'Customer Group':
|
||||
invoice.flags.ignore_pos_profile = True
|
||||
invoice.pos_profile = ''
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
|
||||
return invoice
|
||||
|
||||
|
||||
@@ -556,7 +556,10 @@ class SalesInvoice(SellingController):
|
||||
)
|
||||
|
||||
from erpnext.stock.get_item_details import get_pos_profile, get_pos_profile_item_details
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
if not self.pos_profile and not self.flags.ignore_pos_profile:
|
||||
pos_profile = get_pos_profile(self.company) or {}
|
||||
if not pos_profile:
|
||||
|
||||
@@ -564,6 +564,7 @@ payment_gateway_enabled = "erpnext.accounts.utils.create_payment_gateway_account
|
||||
|
||||
communication_doctypes = ["Customer", "Supplier"]
|
||||
|
||||
<<<<<<< HEAD
|
||||
accounting_dimension_doctypes = [
|
||||
"GL Entry",
|
||||
"Sales Invoice",
|
||||
@@ -608,6 +609,15 @@ accounting_dimension_doctypes = [
|
||||
"Purchase Order",
|
||||
"Purchase Receipt",
|
||||
"Sales Order",
|
||||
=======
|
||||
accounting_dimension_doctypes = ["GL Entry", "Sales Invoice", "Purchase Invoice", "Payment Entry", "Asset",
|
||||
"Expense Claim", "Expense Claim Detail", "Expense Taxes and Charges", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note",
|
||||
"Sales Invoice Item", "Purchase Invoice Item", "Purchase Order Item", "Journal Entry Account", "Material Request Item", "Delivery Note Item",
|
||||
"Purchase Receipt Item", "Stock Entry Detail", "Payment Entry Deduction", "Sales Taxes and Charges", "Purchase Taxes and Charges", "Shipping Rule",
|
||||
"Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation",
|
||||
"Travel Request", "Fees", "POS Profile", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item", "Subscription",
|
||||
"Subscription Plan", "POS Invoice", "POS Invoice Item"
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
]
|
||||
|
||||
regional_overrides = {
|
||||
|
||||
@@ -315,6 +315,7 @@ erpnext.patches.v13_0.create_website_items #30-09-2021
|
||||
erpnext.patches.v13_0.populate_e_commerce_settings
|
||||
erpnext.patches.v13_0.make_homepage_products_website_items
|
||||
erpnext.patches.v13_0.update_dates_in_tax_withholding_category
|
||||
<<<<<<< HEAD
|
||||
erpnext.patches.v13_0.fix_invoice_statuses
|
||||
erpnext.patches.v13_0.replace_supplier_item_group_with_party_specific_item
|
||||
erpnext.patches.v13_0.gst_fields_for_pos_invoice
|
||||
@@ -379,3 +380,7 @@ erpnext.patches.v13_0.update_asset_value_for_manual_depr_entries
|
||||
erpnext.patches.v13_0.update_docs_link
|
||||
erpnext.patches.v13_0.correct_asset_value_if_je_with_workflow
|
||||
execute:frappe.db.set_value("Accounts Settings", "Accounts Settings", "service_provider", "frankfurter.app")
|
||||
=======
|
||||
erpnext.patches.v14_0.update_opportunity_currency_fields
|
||||
erpnext.patches.v13_0.create_accounting_dimensions_in_pos_doctypes
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
|
||||
@@ -3,12 +3,18 @@ from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
|
||||
|
||||
def execute():
|
||||
<<<<<<< HEAD
|
||||
frappe.reload_doc("accounts", "doctype", "accounting_dimension")
|
||||
accounting_dimensions = frappe.db.sql(
|
||||
"""select fieldname, label, document_type, disabled from
|
||||
`tabAccounting Dimension`""",
|
||||
as_dict=1,
|
||||
)
|
||||
=======
|
||||
frappe.reload_doc('accounts', 'doctype', 'accounting_dimension')
|
||||
accounting_dimensions = frappe.db.sql("""select fieldname, label, document_type, disabled from
|
||||
`tabAccounting Dimension`""", as_dict=1)
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
|
||||
if not accounting_dimensions:
|
||||
return
|
||||
@@ -17,9 +23,15 @@ def execute():
|
||||
for d in accounting_dimensions:
|
||||
|
||||
if count % 2 == 0:
|
||||
<<<<<<< HEAD
|
||||
insert_after_field = "dimension_col_break"
|
||||
else:
|
||||
insert_after_field = "accounting_dimensions_section"
|
||||
=======
|
||||
insert_after_field = 'dimension_col_break'
|
||||
else:
|
||||
insert_after_field = 'accounting_dimensions_section'
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
|
||||
for doctype in ["POS Invoice", "POS Invoice Item"]:
|
||||
|
||||
@@ -35,10 +47,17 @@ def execute():
|
||||
"label": d.label,
|
||||
"fieldtype": "Link",
|
||||
"options": d.document_type,
|
||||
<<<<<<< HEAD
|
||||
"insert_after": insert_after_field,
|
||||
}
|
||||
|
||||
if df["fieldname"] not in fieldnames:
|
||||
=======
|
||||
"insert_after": insert_after_field
|
||||
}
|
||||
|
||||
if df['fieldname'] not in fieldnames:
|
||||
>>>>>>> c9c8957250 (feat: Merge POS invoices based on customer group (#27471))
|
||||
create_custom_field(doctype, df)
|
||||
frappe.clear_cache(doctype=doctype)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user