[18.0][IMP] product_main_seller: Add main_seller_id to product.product product and add to depends date_start, date_end#3057
Conversation
|
Hi @legalsylvain, @quentinDupont, |
| def _compute_main_seller_id(self): | ||
| for product in self: | ||
| if product.variant_seller_ids: | ||
| product.main_seller_id = fields.first( |
There was a problem hiding this comment.
You are missing here the filter for only this variant to have priority.
legalsylvain
left a comment
There was a problem hiding this comment.
Hi.
Unfortunately, it is not possible to compute and store fields, based on fields.Date.today() as this value is changing all the time.
|
The idea is to include a cron for updating that daily. @Andrii9090-tecnativa please do it at the same time. |
…uct and add to depends date_start, date_end
cb42118 to
e35c035
Compare
legalsylvain
left a comment
There was a problem hiding this comment.
Thanks for adding the cron !
some remarks inline.
| products._compute_main_seller_id() | ||
| templates._compute_main_seller_id() |
There was a problem hiding this comment.
This will be generate a huge computation, even if most of the value are the same each night.
If we filter, to only recompute for product that has supplierinfo with date (start and or end) defined, the recomputation will be very quicker. (even no recomputation, for many instances that doesn't use start / end feature.
WDYT ?
| products = self.env["product.product"].search([]) | ||
| templates = self.env["product.template"].search([]) |
There was a problem hiding this comment.
| products = self.env["product.product"].search([]) | |
| templates = self.env["product.template"].search([]) | |
| products = self.env["product.product"].with_context(active_test=false).search([]) | |
| templates = self.env["product.template"].with_context(active_test=false).search([]) |
Add field
main_seller_idtoproduct.product@pedrobaeza can you review, please?
@Tecnativa