Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
568 มุมมอง

hi

I want to set delivery lead time/manufacturing lead time in hours unit. 
Is there any solution to change default unit of days to hours?

Thank you so much

HB

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Please refer to the code below:


class ProductTemplate(models.Model):

    _inherit = 'product.template'


    delivery_lead_time_hours = fields.Float(

        string='Customer Lead Time (Hours)',

        compute='_compute_delivery_lead_time_hours',

        inverse='_inverse_delivery_lead_time_hours',

    )


    @api.depends('sale_delay')

    def _compute_delivery_lead_time_hours(self):

        for rec in self:

            rec.delivery_lead_time_hours = rec.sale_delay * 24


    def _inverse_delivery_lead_time_hours(self):

        for rec in self:

            rec.sale_delay = rec.delivery_lead_time_hours / 24


Hope it helps.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ม.ค. 25
1266
0
มิ.ย. 25
915
1
ต.ค. 21
4923
1
ก.ค. 18
2798
0
มี.ค. 15
3563