Skip to Content
Menu
This question has been flagged
2 Replies
1347 Views

Hello,


We are dealing with Odoo Enterprise v14 rental module, and we need to duplicate a sale.order but keeping the same lot ids as in the original one and just modify rental period for a larger period.


The reason is that in many scenarios rental orders need to be extended, whilst preserving the original quotation by tax reasons, therefore we have to create a copy, modify rental dates and return each item from original quotation to pick up again in the new one and this process can be time consuming for larger orders.


By default odoo sets these fields to copy=False, tried to override with
        _inherit = 'sale.order.line'        reserved_lot_ids = fields.Many2many('stock.production.lot', 'rental_reserved_lot_rel', domain="[('product_id','=',product_id)]", copy=True)        pickedup_lot_ids = fields.Many2many('stock.production.lot', 'rental_pickedup_lot_rel', domain="[('product_id','=',product_id)]", copy=True)        returned_lot_ids = fields.Many2many('stock.production.lot', 'rental_returned_lot_rel', domain="[('product_id','=',product_id)]", copy=True)

But this is not working, tried to override sale.order.line copy method and not working either, is there any workaround?


Thanks and regards,
Ramon

Avatar
Discard
Best Answer

Hello Ramon,

If you want to copy 'True' on base fields then you don't override whole base field you just write below code to make a copy 'True' and need to upgrade the module.

_inherit = 'sale.order.line'

reserved_lot_ids = fields.Many2many(copy=True)
pickedup_lot_ids = fields.Many2many(copy=True)
returned_lot_ids = fields.Many2many(copy=True)

I hope this solution is help for you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard
Author Best Answer

Thank you for your answer Jainesh,


Indeed it solves the problem of the copy attribute for the field.


Kind regards,

Ramon

Avatar
Discard
Related Posts Replies Views Activity
2
Jan 24
3672
0
Jun 23
940
1
Dec 22
1960
0
Apr 22
1401
1
Apr 19
5133