line/splitline: fixed selection of quantity-uom/digits
This commit is contained in:
parent
e79c68e75b
commit
e38d02ff9d
3 changed files with 126 additions and 14 deletions
27
line.py
27
line.py
|
@ -314,20 +314,33 @@ class Line(SecondUomMixin, metaclass=PoolMeta):
|
|||
self.amount / self.quantity
|
||||
).quantize(Decimal(Decimal(1) / 10**digit))
|
||||
|
||||
@fields.depends('cashbook', '_parent_cashbook.quantity_uom')
|
||||
@fields.depends('feature', 'cashbook', '_parent_cashbook.quantity_uom', \
|
||||
'booktransf', '_parent_booktransf.quantity_uom', '_parent_booktransf.feature')
|
||||
def on_change_with_quantity_uom(self, name=None):
|
||||
""" get quantity-unit of asset
|
||||
"""
|
||||
if self.cashbook:
|
||||
if self.cashbook.quantity_uom:
|
||||
return self.cashbook.quantity_uom.id
|
||||
if self.feature == 'asset':
|
||||
if self.cashbook:
|
||||
if self.cashbook.quantity_uom:
|
||||
return self.cashbook.quantity_uom.id
|
||||
else :
|
||||
if self.booktransf:
|
||||
if self.booktransf.feature == 'asset':
|
||||
if self.booktransf.quantity_uom:
|
||||
return self.booktransf.quantity_uom.id
|
||||
|
||||
@fields.depends('cashbook', '_parent_cashbook.quantity_digits')
|
||||
@fields.depends('feature', 'cashbook', '_parent_cashbook.quantity_digits', \
|
||||
'booktransf', '_parent_booktransf.quantity_digits', '_parent_booktransf.feature')
|
||||
def on_change_with_quantity_digits(self, name=None):
|
||||
""" get digits from cashbook
|
||||
"""
|
||||
if self.cashbook:
|
||||
return self.cashbook.quantity_digits
|
||||
if self.feature == 'asset':
|
||||
if self.cashbook:
|
||||
return self.cashbook.quantity_digits
|
||||
else :
|
||||
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