line: fix transfer between cash-/asset-book with zero quantity

This commit is contained in:
Frederik Jaeckel 2023-01-23 22:29:41 +01:00
parent bbf94c95df
commit 12e088f79a
2 changed files with 212 additions and 11 deletions

17
line.py
View file

@ -181,19 +181,16 @@ class Line(SecondUomMixin, metaclass=PoolMeta):
'quantity_2nd_uom': splitline.quantity \
if (asset_books == 2) and (diff_uom == True) else None,
})
elif booktransf_uom is None:
# counterpart-cashbook has no uom -> no quantity
elif sum([1 if booktransf_uom is not None else 0,
1 if line_uom is not None else 0]) == 1:
# one of the related cashbooks only is asset-type
result.update({
'quantity': None,
'quantity': line.quantity,
'quantity_2nd_uom': None,
})
else :
if line_uom is None:
result.update({
'quantity': line.quantity,
'quantity_2nd_uom': None,
})
elif line_uom == booktransf_uom:
elif sum([1 if booktransf_uom is not None else 0,
1 if line_uom is not None else 0]) == 2:
if line_uom == booktransf_uom:
result.update({
'quantity': line.quantity,
'quantity_2nd_uom': None,