line: fix write() - get 'bookingtype' from line if not in values
This commit is contained in:
parent
e38d02ff9d
commit
438035cca2
1 changed files with 3 additions and 2 deletions
5
line.py
5
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
|
||||
|
|
Loading…
Reference in a new issue