Skip to Content
Menu
This question has been flagged
1 Reply
2096 Views

good afternoon,

I have a custom module that has a field that lists all the delivery orders, how can I make that when selecting a delivery order, the item detail of this delivery order, is copied in the detail of my custom module.


observation:

the module has the same definition of columns as it does

delivery orders.


I appreciate your comments,

Greetings.

Avatar
Discard
Best Answer

Hello GianceFTx


For copying all the data of delivery order lines to your custom module. You can do it by using base copy method.


Please refer below code and put that code in one button of delivery order.


@api.multi

def action_duplicate(self):

    self.ensure_one()

    custom_copy = self.copy()

    if custom_copy:

        context = dict(self.env.context)

        return {

            'type': 'ir.actions.act_window',

            'view_type': 'form',

            'view_mode': 'form',

            'res_model': 'your.custom.module',

            'res_id': custom_copy.id,

            'context': context,

        }

    return False


Note: When you use base copy method all the fields of custom module must be same as delivery order object.

Regards,




Email:   odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Avatar
Discard