diff options
| author | david <david.vidal@tecnativa.com> | 2021-01-29 11:45:12 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2021-02-10 15:17:45 +0000 |
| commit | 87cbd4be261a426cb28ed6c1de7941c6b751521f (patch) | |
| tree | 0311be218eea1c107c98e66b82278d56705fb7f5 | |
| parent | 62a43fcb8da2c5a3167d230820b514729fbf0bde (diff) | |
[12.0] purchase: recover vendor bill auto-complete by vendor reference
Up to v11 it was possible to search by purchase vendor reference when
we're using the auto-complete function in a vendor bill. With the
refactor of this functionality, this useful feature was lost.
closes odoo/odoo#65725
X-original-commit: 93365193fae23c352d3b825cf3a07d71977dde44
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
| -rw-r--r-- | addons/purchase/report/purchase_bill.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/purchase/report/purchase_bill.py b/addons/purchase/report/purchase_bill.py index 8ca87dfdaa7..e479bb4ce0b 100644 --- a/addons/purchase/report/purchase_bill.py +++ b/addons/purchase/report/purchase_bill.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, tools +from odoo import api, fields, models, tools +from odoo.osv import expression from odoo.tools import formatLang class PurchaseBillUnion(models.Model): @@ -52,3 +53,12 @@ class PurchaseBillUnion(models.Model): name += ': ' + formatLang(self.env, amount, monetary=True, currency_obj=doc.currency_id) result.append((doc.id, name)) return result + + @api.model + def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None): + args = args or [] + domain = [] + if name: + domain = ['|', ('name', operator, name), ('reference', operator, name)] + purchase_bills_union_ids = self._search(expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid) + return self.browse(purchase_bills_union_ids).name_get() |
