From 7ce463a5f4d9cf0ef2f542ed845b04108c896c33 Mon Sep 17 00:00:00 2001 From: mav-adhoc Date: Fri, 13 Feb 2026 20:07:43 +0000 Subject: [PATCH] [IMP]purchase_ux: improve purchase bill line match view X-original-commit: 43234e1ffbe27060fc536a9e8fc6c02c45c15b0d --- purchase_ux/__manifest__.py | 11 ++++++ purchase_ux/i18n/es.po | 5 +++ purchase_ux/models/__init__.py | 5 +++ purchase_ux/models/account_move.py | 12 ++++++ .../models/purchase_bill_line_match.py | 39 +++++++++++++++++++ purchase_ux/models/purchase_order.py | 12 ++++++ .../views/purchase_bill_line_match_views.xml | 29 ++++++++++++++ 7 files changed, 113 insertions(+) create mode 100644 purchase_ux/models/purchase_bill_line_match.py create mode 100644 purchase_ux/views/purchase_bill_line_match_views.xml diff --git a/purchase_ux/__manifest__.py b/purchase_ux/__manifest__.py index 1b2f6eda..40bdb905 100644 --- a/purchase_ux/__manifest__.py +++ b/purchase_ux/__manifest__.py @@ -19,7 +19,13 @@ ############################################################################## { "name": "Purchase UX", +<<<<<<< 0f1921517783f52db616fa61e7bdc3480a806ae3 "version": "19.0.1.0.0", +||||||| c857ca26e6cd49d3c3e50d27a4100b72a83fc848 + "version": "18.0.1.1.0", +======= + "version": "18.0.1.2.0", +>>>>>>> 7497fc3172ed8a5028924d71be0a13c2a14d714a "category": "Purchases", "sequence": 14, "summary": "Purchase order improvements: currency change, price updates, invoice controls and menu enhancements", @@ -41,7 +47,12 @@ "views/purchase_line_views.xml", "views/product_template_views.xml", "views/product_supplierinfo_views.xml", +<<<<<<< 0f1921517783f52db616fa61e7bdc3480a806ae3 "views/res_company_views.xml", +||||||| c857ca26e6cd49d3c3e50d27a4100b72a83fc848 +======= + "views/purchase_bill_line_match_views.xml", +>>>>>>> 7497fc3172ed8a5028924d71be0a13c2a14d714a ], "demo": [ "demo/purchase_order_demo.xml", diff --git a/purchase_ux/i18n/es.po b/purchase_ux/i18n/es.po index 0f06986c..f8a0fc3a 100644 --- a/purchase_ux/i18n/es.po +++ b/purchase_ux/i18n/es.po @@ -432,3 +432,8 @@ msgstr "o" #: model:ir.model,name:purchase_ux.model_purchase_order_line_add_to_invoice msgid "purchase.order.line.add_to_invoice" msgstr "" + +#. module: purchase_ux +#: model:ir.model,name:purchase_ux.model_purchase_bill_line_match +msgid "Received" +msgstr "Recibido" diff --git a/purchase_ux/models/__init__.py b/purchase_ux/models/__init__.py index c4c937d5..fecb4971 100644 --- a/purchase_ux/models/__init__.py +++ b/purchase_ux/models/__init__.py @@ -6,4 +6,9 @@ from . import purchase_order from . import purchase_order_line from . import product_template +<<<<<<< 0f1921517783f52db616fa61e7bdc3480a806ae3 from . import res_company +||||||| c857ca26e6cd49d3c3e50d27a4100b72a83fc848 +======= +from . import purchase_bill_line_match +>>>>>>> 7497fc3172ed8a5028924d71be0a13c2a14d714a diff --git a/purchase_ux/models/account_move.py b/purchase_ux/models/account_move.py index b4a9b6d9..ef1f07de 100644 --- a/purchase_ux/models/account_move.py +++ b/purchase_ux/models/account_move.py @@ -82,3 +82,15 @@ def update_prices_with_supplier_cost(self): def get_product_lines_to_update(self): return self.with_company(self.company_id.id).invoice_line_ids.filtered(lambda x: x.product_id and x.price_unit) + + def action_purchase_matching(self): + result = super().action_purchase_matching() + result["context"] = result.get("context", {}) + result["context"].update( + { + "search_default_pol_id": 1, + "search_default_not_invoiced": 1, + "search_default_current_invoice": 1, + } + ) + return result diff --git a/purchase_ux/models/purchase_bill_line_match.py b/purchase_ux/models/purchase_bill_line_match.py new file mode 100644 index 00000000..ab14d400 --- /dev/null +++ b/purchase_ux/models/purchase_bill_line_match.py @@ -0,0 +1,39 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from odoo import api, fields, models + + +class PurchaseBillLineMatch(models.Model): + _inherit = "purchase.bill.line.match" + + reference_description = fields.Char( + string="Description", + compute="_compute_reference_description", + ) + + qty_received = fields.Float( + string="Received", + related="pol_id.qty_received", + readonly=True, + ) + + @api.depends("pol_id", "product_id", "display_name") + def _compute_reference_description(self): + for rec in self: + if rec.pol_id and rec.product_id: + pol_name = rec.pol_id.name or "" + product_name = rec.product_id.display_name or "" + if pol_name.startswith(product_name): + remaining = pol_name[len(product_name) :].strip() + if remaining: + rec.reference_description = f"{product_name} - {remaining}" + else: + rec.reference_description = product_name + else: + rec.reference_description = pol_name + elif rec.pol_id: + rec.reference_description = rec.pol_id.name + else: + rec.reference_description = rec.display_name diff --git a/purchase_ux/models/purchase_order.py b/purchase_ux/models/purchase_order.py index 3cc0f11b..17d63d3a 100644 --- a/purchase_ux/models/purchase_order.py +++ b/purchase_ux/models/purchase_order.py @@ -136,3 +136,15 @@ def _prepare_invoice(self): if self.internal_notes: result["internal_notes"] = self.internal_notes return result + + def action_bill_matching(self): + result = super().action_bill_matching() + result["context"] = result.get("context", {}) + result["context"].update( + { + "search_default_pol_id": 1, + "search_default_not_invoiced": 1, + "search_default_current_invoice": 1, + } + ) + return result diff --git a/purchase_ux/views/purchase_bill_line_match_views.xml b/purchase_ux/views/purchase_bill_line_match_views.xml new file mode 100644 index 00000000..6ccf14cb --- /dev/null +++ b/purchase_ux/views/purchase_bill_line_match_views.xml @@ -0,0 +1,29 @@ + + + + purchase.bill.line.match.list + purchase.bill.line.match + + + + + + + + + + + + + purchase.bill.line.match.search + purchase.bill.line.match + + + + + + + + + +