How to pass custom field value from purchase.order.line to account.move.line in odoo 13
23 September, 2021 by
Umme Huzaifa
| No comments yet

Suppose, You have a field name free_quantity in purchase.order.line and you have a filed with the same name in the account.move.line and you want to pass the field value to the account.move.line.

Solution: You have a function name def _prepare_account_move_line in purchase.order.line, inherit it and pass your value in it like

def _prepare_account_move_line(self, move):
        res = super(PurchaseOrderLine, self)._prepare_account_move_line(move)
        res.update({

            'free_quantity': self.free_quantity
        })

        return res


or,

def _prepare_account_move_line(self, move):
        res = super(PurchaseOrderLine, self)._prepare_account_move_line(move)
        res["free_quantity"] = self.free_quantity
        return res


Hope it will help. Thanks

Umme Huzaifa
23 September, 2021
Share this post
Archive
Sign in to leave a comment