Skip to content

[17.0][ADD] stock_lot_product_category: product category available on Lots#2520

Open
dreispt wants to merge 1 commit intoOCA:17.0from
ursais:17-dr-stock_lot_product_category
Open

[17.0][ADD] stock_lot_product_category: product category available on Lots#2520
dreispt wants to merge 1 commit intoOCA:17.0from
ursais:17-dr-stock_lot_product_category

Conversation

@dreispt
Copy link
Copy Markdown
Member

@dreispt dreispt commented Feb 12, 2026

No description provided.

@dreispt dreispt changed the title [ADD] stock_lot_product_category: product category available on Lots [17.0][ADD] stock_lot_product_category: product category available on Lots Feb 12, 2026
@rousseldenis rousseldenis added this to the 17.0 milestone Feb 13, 2026
class StockLot(models.Model):
_inherit = "stock.lot"

product_category_id = fields.Many2one(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dreispt How does this behave on big databases ? Shouldn't we add a pre_init hook ?

Copy link
Copy Markdown
Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question

Copy link
Copy Markdown

@carlossainznetkia carlossainznetkia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.
I agree with the comment: adding a stored related Many2one (product_category_id) can be expensive on large DBs at install/upgrade due to the backfill/recompute.
It’d be safer to add a pre_init_hook to populate it efficiently and avoid potential long installs/locks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants