Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
93 Vistas

Can anyone advise where to change the lead time to "x" amount of weeks and not days or alternatively make it a fillable field and not a certain amount

Avatar
Descartar
Mejor respuesta

Hi,


- Odoo uses days internally for lead time calculations (security lead time, supplier lead time, customer lead time, manufacturing lead time, etc.).

- The field type is Integer or Float (days), and Odoo converts that into expected dates in planning/delivery.

- This is why you only see days, not weeks/months.


Options to Handle Weeks Instead of Days


1- Options to Handle Weeks Instead of Days

       * If you want “2 weeks”, just enter 14 days.

       * Simple and works with Odoo’s logic.

       * You could also add a helper note in the field’s label (Lead Time (in days, e.g., 14 = 2 weeks)).


2- Change Field Behavior to Accept Weeks (customization)

    * If you want the field to be in weeks, you can override it:

           Example (for customer_lead on product):

                 from odoo import fields, models


class ProductTemplate(models.Model):

    _inherit = "product.template"


    customer_lead_weeks = fields.Float(

        string="Customer Lead Time (Weeks)",

        help="Lead time expressed in weeks instead of days."

    )


    def _convert_weeks_to_days(self):

        for product in self:

            product.customer_lead = product.customer_lead_weeks * 7


* You then hide the original customer_lead field in views, and show your new customer_lead_weeks.

* Use onchange or computed field to keep both fields in sync.


Hope it helps

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 25
711
0
ago 25
64
1
ago 25
1027
2
ago 25
489
2
ago 25
535