line: counterpart-values for split-lines + tests
This commit is contained in:
parent
7ff631d850
commit
a397fe22a2
2 changed files with 26 additions and 7 deletions
16
line.py
16
line.py
|
@ -144,15 +144,25 @@ class Line(SecondUomMixin, metaclass=PoolMeta):
|
|||
return result
|
||||
|
||||
@classmethod
|
||||
def get_counterpart_values(cls, line, values={}):
|
||||
def get_counterpart_values(cls, line, splitline=None, values={}):
|
||||
""" add quantity to counterpart
|
||||
"""
|
||||
result = super(Line, cls).get_counterpart_values(line, values)
|
||||
result = super(Line, cls).get_counterpart_values(
|
||||
line,
|
||||
splitline = splitline,
|
||||
values = values
|
||||
)
|
||||
|
||||
line_uom = getattr(line.quantity_uom, 'id', None)
|
||||
booktransf_uom = getattr(getattr(line.booktransf, 'quantity_uom', {}), 'id', None)
|
||||
|
||||
if booktransf_uom is None:
|
||||
if getattr(splitline, 'quantity', None) is not None:
|
||||
# we add values to the counterpart of a splitbooking-line
|
||||
result.update({
|
||||
'quantity': splitline.quantity,
|
||||
'quantity_2nd_uom': None,
|
||||
})
|
||||
elif booktransf_uom is None:
|
||||
# counterpart-cashbook has no uom -> no quantity
|
||||
result.update({
|
||||
'quantity': None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue