Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2154 Представления

Hello,


Does anyone know how to change the sequences of delivery orders to match the associated sale order.


For example, the sequence of the delivery would be:


WH/OUT/04538/01


04538 being the SO number and 01 being the number of delivery orders associated to the SO.


Thank you very much.


Julien

Аватар
Отменить

Bonjour,


Ne travaillant actuellement plus chez Deuse, je vous invite à transférer ce mail à Arthur De L'Arbre : a.delarbre@deuse.be


Bonne journée, 

Лучший ответ

Hi, Julien Plaitin


from odoo import models, fields, api


class StockPicking(models.Model):

    _inherit = 'stock.picking'


    sale_order_number = fields.Char(string='Sale Order Number')


    @api.model

    def create(self, vals):

        """

        Overrides the create method of stock.picking model to customize the creation of new picking records.

        """

        if vals.get('origin'):

            sale_order_number = vals['origin']

            existing_delivery_orders_count = self.search_count([('origin', '=', sale_order_number)])

            vals['name'] = f"WH/OUT/{sale_order_number}/{existing_delivery_orders_count + 1:02d}"

        return super(StockPicking, self).create(vals)


Please refer to the attached screenshot.




I Hope this information proves helpful to you. 


Thanks & Regards,

Email:   odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
нояб. 24
1117
0
нояб. 18
2959
0
нояб. 24
1148
0
сент. 24
1185
2
июл. 24
988