line/splitline: fixed selection of quantity-uom/digits
This commit is contained in:
parent
6b630b7c20
commit
e8d69b64ae
3 changed files with 126 additions and 14 deletions
23
splitline.py
23
splitline.py
|
@ -47,23 +47,32 @@ class SplitLine(SecondUomMixin, metaclass=PoolMeta):
|
|||
}
|
||||
return recname
|
||||
|
||||
@fields.depends('line', '_parent_line.cashbook', 'booktransf', '_parent_booktransf.quantity_uom')
|
||||
@fields.depends('line', '_parent_line.cashbook', 'booktransf', \
|
||||
'_parent_booktransf.feature', '_parent_booktransf.quantity_uom')
|
||||
def on_change_with_quantity_uom(self, name=None):
|
||||
""" get quantity-unit of asset
|
||||
"""
|
||||
if self.line:
|
||||
if self.line.cashbook.quantity_uom:
|
||||
return self.cashbook.quantity_uom.id
|
||||
if self.line.cashbook.feature == 'asset':
|
||||
if self.line.cashbook.quantity_uom:
|
||||
return self.cashbook.quantity_uom.id
|
||||
if self.booktransf:
|
||||
if self.booktransf.quantity_uom:
|
||||
return self.booktransf.quantity_uom.id
|
||||
if self.booktransf.feature == 'asset':
|
||||
if self.booktransf.quantity_uom:
|
||||
return self.booktransf.quantity_uom.id
|
||||
|
||||
@fields.depends('line', '_parent_line.cashbook')
|
||||
@fields.depends('line', '_parent_line.cashbook', 'booktransf', \
|
||||
'_parent_booktransf.feature', '_parent_booktransf.quantity_digits')
|
||||
def on_change_with_quantity_digits(self, name=None):
|
||||
""" get digits from cashbook
|
||||
"""
|
||||
if self.line:
|
||||
return self.line.cashbook.quantity_digits
|
||||
if self.line.cashbook.feature == 'asset':
|
||||
return self.line.cashbook.quantity_digits
|
||||
if self.booktransf:
|
||||
if self.booktransf.feature == 'asset':
|
||||
return self.booktransf.quantity_digits
|
||||
|
||||
return 4
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue