formatting
This commit is contained in:
parent
6c1fac8672
commit
ad067475f8
13 changed files with 1126 additions and 709 deletions
25
splitline.py
25
splitline.py
|
@ -22,17 +22,18 @@ STATESQ1A['readonly'] = ~And(
|
|||
Eval('booktransf_feature', '') == 'asset',
|
||||
))
|
||||
|
||||
|
||||
class SplitLine(SecondUomMixin, metaclass=PoolMeta):
|
||||
__name__ = 'cashbook.split'
|
||||
|
||||
quantity = fields.Numeric(string='Quantity',
|
||||
digits=(16, Eval('quantity_digits', 4)),
|
||||
quantity = fields.Numeric(
|
||||
string='Quantity', digits=(16, Eval('quantity_digits', 4)),
|
||||
states=STATESQ1A, depends=DEPENDSQ1)
|
||||
quantity_digits = fields.Function(fields.Integer(string='Digits',
|
||||
readonly=True, states={'invisible': True}),
|
||||
quantity_digits = fields.Function(fields.Integer(
|
||||
string='Digits', readonly=True, states={'invisible': True}),
|
||||
'on_change_with_quantity_digits')
|
||||
quantity_uom = fields.Function(fields.Many2One(string='Symbol',
|
||||
readonly=True, model_name='product.uom'),
|
||||
quantity_uom = fields.Function(fields.Many2One(
|
||||
string='Symbol', readonly=True, model_name='product.uom'),
|
||||
'on_change_with_quantity_uom')
|
||||
|
||||
def get_rec_name(self, name):
|
||||
|
@ -41,13 +42,15 @@ class SplitLine(SecondUomMixin, metaclass=PoolMeta):
|
|||
recname = super(SplitLine, self).get_rec_name(name)
|
||||
if self.line.cashbook.feature == 'asset':
|
||||
recname += '|%(quantity)s %(uom_symbol)s' % {
|
||||
'quantity': Report.format_number(self.quantity or 0.0, None,
|
||||
'quantity': Report.format_number(
|
||||
self.quantity or 0.0, None,
|
||||
digits=self.quantity_digits),
|
||||
'uom_symbol': self.quantity_uom.symbol,
|
||||
}
|
||||
return recname
|
||||
|
||||
@fields.depends('line', '_parent_line.cashbook', 'booktransf', \
|
||||
@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
|
||||
|
@ -61,7 +64,8 @@ class SplitLine(SecondUomMixin, metaclass=PoolMeta):
|
|||
if self.booktransf.quantity_uom:
|
||||
return self.booktransf.quantity_uom.id
|
||||
|
||||
@fields.depends('line', '_parent_line.cashbook', 'booktransf', \
|
||||
@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
|
||||
|
@ -85,7 +89,8 @@ class SplitLine(SecondUomMixin, metaclass=PoolMeta):
|
|||
line = Line2(values.get('line', None))
|
||||
|
||||
if line:
|
||||
values.update(cls.add_2nd_quantity(values, line.cashbook.quantity_uom))
|
||||
values.update(cls.add_2nd_quantity(
|
||||
values, line.cashbook.quantity_uom))
|
||||
return values
|
||||
|
||||
# end SplitLine
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue