Conversation
sale_partner_delay
afe46c8 to
e5d20a7
Compare
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for this clean module, Iván. The approach of overriding _compute_customer_lead and calling super() first to get the product delay, then adding the partner delay on top, is the right way to layer this.
A couple of observations:
In sale_order_line.py, when partner_id is an empty recordset (e.g. during draft order creation before a partner is set), line.order_id.partner_id.sale_delay will return 0 thanks to Odoo's ORM behavior on empty recordsets, so that's safe. Good.
The @api.depends('order_id.partner_id') on the override correctly ensures recomputation when the partner changes, and Odoo merges this with the parent's product_id dependency. The test test_partner_change_recomputes_lead confirms this works.
Registering sale_delay as a commercial field via _commercial_fields is a nice touch -- contacts will inherit the parent company's lead time, which is the expected behavior.
The view placement inside page[@name='sales_purchases']//group[@name='sale'] is well-chosen and consistent with where other sale-related partner fields live.
All CI checks pass. LGTM.
|
This PR has the |
This module adds a customer-specific delivery lead time field to partners.
When creating sale order lines, the partner's lead time is automatically added to the product's delivery lead time to calculate the total customer lead time.
This is useful when certain customers require additional delivery time due to: