コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
496 ビュー

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.

アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 25
1209
0
6月 25
915
1
10月 21
4845
1
7月 18
2735
0
3月 15
3471