Skip to content

Commit 18f991b

Browse files
committed
[IMP] backport from odoo/odoo@41d8fa3
1 parent 7420b7f commit 18f991b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

product_ux/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
##############################################################################
2020
{
2121
"name": "Product UX",
22-
"version": "18.0.1.1.0",
22+
"version": "18.0.1.2.0",
2323
"category": "Products",
2424
"sequence": 14,
2525
"summary": "",

product_ux/models/product_product.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33
# directory
44
##############################################################################
55
from odoo import api, fields, models
6+
from odoo.tools import create_index
7+
68

79

810
class ProductProduct(models.Model):
911
_inherit = "product.product"
12+
_order = 'default_code, name, id'
13+
14+
def init(self):
15+
super().init()
16+
create_index(
17+
self.env.cr,
18+
indexname='is_favorite_idx',
19+
tablename='product_product',
20+
expressions=['is_favorite'],
21+
where='is_favorite IS TRUE',
22+
)
23+
1024

1125
active = fields.Boolean(tracking=True)
1226
pricelist_price = fields.Float(compute="_compute_product_pricelist_price", digits="Product Price")
27+
is_favorite = fields.Boolean(related='product_tmpl_id.is_favorite', readonly=True, store=True)
1328

1429
@api.depends_context("pricelist", "quantity", "uom", "date", "no_variant_attributes_price_extra")
1530
def _compute_product_pricelist_price(self):

0 commit comments

Comments
 (0)