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