From 438035cca24869bf2d91887d32adc1b279f14735 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Sun, 5 Feb 2023 11:35:55 +0100 Subject: [PATCH] line: fix write() - get 'bookingtype' from line if not in values --- line.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/line.py b/line.py index 517bea2..8c7b862 100644 --- a/line.py +++ b/line.py @@ -150,10 +150,10 @@ class Line(SecondUomMixin, metaclass=PoolMeta): cashbook = Cashbook.browse([id_cashbook])[0] if isinstance(values, dict): - type_ = values.get('bookingtype', None) + type_ = values.get('bookingtype', getattr(line, 'bookingtype', None)) quantity = values.get('quantity', None) else : - type_ = getattr(values, 'bookingtype', None) + type_ = getattr(values, 'bookingtype', getattr(line, 'bookingtype', None)) quantity = getattr(values, 'quantity', None) if (type_ is not None) and (cashbook.feature == 'asset'): @@ -170,6 +170,7 @@ class Line(SecondUomMixin, metaclass=PoolMeta): }) else : raise ValueError('invalid "bookingtype"') + return result @classmethod