formatting
This commit is contained in:
parent
6c1fac8672
commit
ad067475f8
13 changed files with 1126 additions and 709 deletions
|
@ -14,22 +14,24 @@ from decimal import Decimal
|
|||
class Reconciliation(metaclass=PoolMeta):
|
||||
__name__ = 'cashbook.recon'
|
||||
|
||||
start_quantity = fields.Numeric(string='Start Quantity',
|
||||
readonly=True, digits=(16, Eval('quantity_digits', 4)),
|
||||
start_quantity = fields.Numeric(
|
||||
string='Start Quantity', readonly=True,
|
||||
digits=(16, Eval('quantity_digits', 4)),
|
||||
states={
|
||||
'required': Eval('feature', '') == 'asset',
|
||||
'invisible': Eval('feature', '') != 'asset',
|
||||
}, depends=['quantity_digits', 'feature'])
|
||||
end_quantity = fields.Numeric(string='End Quantity',
|
||||
readonly=True, digits=(16, Eval('quantity_digits', 4)),
|
||||
end_quantity = fields.Numeric(
|
||||
string='End Quantity', readonly=True,
|
||||
digits=(16, Eval('quantity_digits', 4)),
|
||||
states={
|
||||
'required': Eval('feature', '') == 'asset',
|
||||
'invisible': Eval('feature', '') != 'asset',
|
||||
}, depends=['quantity_digits', 'feature'])
|
||||
quantity_digits = fields.Function(fields.Integer(string='Quantity Digits'),
|
||||
'on_change_with_quantity_digits')
|
||||
quantity_uom = fields.Function(fields.Many2One(string='Symbol',
|
||||
readonly=True, model_name='product.uom'),
|
||||
quantity_digits = fields.Function(fields.Integer(
|
||||
string='Quantity Digits'), 'on_change_with_quantity_digits')
|
||||
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):
|
||||
|
@ -38,9 +40,11 @@ class Reconciliation(metaclass=PoolMeta):
|
|||
recname = super(Reconciliation, self).get_rec_name(name)
|
||||
if self.cashbook.feature == 'asset':
|
||||
recname += ' | %(start_quantity)s %(uom_symbol)s - %(end_quantity)s %(uom_symbol)s' % {
|
||||
'start_quantity': Report.format_number(self.start_quantity or 0.0, None,
|
||||
'start_quantity': Report.format_number(
|
||||
self.start_quantity or 0.0, None,
|
||||
digits=self.quantity_digits),
|
||||
'end_quantity': Report.format_number(self.end_quantity or 0.0, None,
|
||||
'end_quantity': Report.format_number(
|
||||
self.end_quantity or 0.0, None,
|
||||
digits=self.quantity_digits),
|
||||
'uom_symbol': getattr(self.quantity_uom, 'symbol', '-'),
|
||||
}
|
||||
|
@ -94,7 +98,7 @@ class Reconciliation(metaclass=PoolMeta):
|
|||
|
||||
if reconciliation.predecessor:
|
||||
values['start_quantity'] = reconciliation.predecessor.end_quantity
|
||||
else :
|
||||
else:
|
||||
values['start_quantity'] = Decimal('0.0')
|
||||
values['end_quantity'] = values['start_quantity']
|
||||
|
||||
|
@ -106,13 +110,13 @@ class Reconciliation(metaclass=PoolMeta):
|
|||
lines_records = Line.browse(values['lines'][0][1])
|
||||
values['end_quantity'] += sum([
|
||||
x.quantity_credit - x.quantity_debit
|
||||
for x in lines_records
|
||||
for x in lines_records
|
||||
])
|
||||
|
||||
# add quantities of already linked lines
|
||||
values['end_quantity'] += sum([
|
||||
x.quantity_credit - x.quantity_debit
|
||||
for x in reconciliation.lines
|
||||
for x in reconciliation.lines
|
||||
])
|
||||
|
||||
return values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue