diff --git a/line.py b/line.py index 3ae1c5b..f90bc46 100644 --- a/line.py +++ b/line.py @@ -58,9 +58,11 @@ class Line(SecondUomMixin, metaclass=PoolMeta): }, depends=['currency_digits', 'quantity_digits', 'feature']), 'on_change_with_asset_rate') quantity_balance = fields.Function(fields.Numeric(string='Quantity', - digits=(16, Eval('quantity_digits', 4)), + digits=(16, Eval('quantity_digits', 4)), readonly=True, help='Number of shares in the cashbook up to the current row if the default sort applies.', - readonly=True, depends=['quantity_digits']), + states={ + 'invisible': Eval('feature', '') != 'asset', + }, depends=['quantity_digits', 'feature']), 'on_change_with_quantity_balance') @classmethod @@ -134,7 +136,7 @@ class Line(SecondUomMixin, metaclass=PoolMeta): }) return result - @fields.depends('id', 'date', 'cashbook', \ + @fields.depends('id', 'date', 'cashbook', 'feature',\ '_parent_cashbook.id', 'reconciliation', \ '_parent_reconciliation.start_quantity',\ '_parent_reconciliation.state') @@ -142,10 +144,12 @@ class Line(SecondUomMixin, metaclass=PoolMeta): """ get quantity-balance """ Line2 = Pool().get('cashbook.line') - return Line2.get_balance_of_line(self, - field_name='quantity', - credit_name='quantity_credit', - debit_name='quantity_debit') + + if self.feature == 'asset': + return Line2.get_balance_of_line(self, + field_name='quantity', + credit_name='quantity_credit', + debit_name='quantity_debit') @fields.depends('quantity', 'amount', 'currency_digits', 'quantity_digits') def on_change_with_asset_rate(self, name=None): diff --git a/line.xml b/line.xml index 83df0ea..536f01c 100644 --- a/line.xml +++ b/line.xml @@ -11,5 +11,16 @@ full copyright notices and license terms. --> line_form + + cashbook.line + + line_list + + + cashbook.line + + line_recon_list + + diff --git a/mixin.py b/mixin.py index 078c714..a662493 100644 --- a/mixin.py +++ b/mixin.py @@ -105,6 +105,9 @@ class SecondUomMixin(object): for line in lines: if line.booktransf is None: continue + if (line.cashbook.quantity_uom is None) or \ + (line.booktransf.quantity_uom is None): + continue if line.cashbook.quantity_uom.id == line.booktransf.quantity_uom.id: continue diff --git a/view/line_list.xml b/view/line_list.xml new file mode 100644 index 0000000..d66b4b3 --- /dev/null +++ b/view/line_list.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/view/line_recon_list.xml b/view/line_recon_list.xml new file mode 100644 index 0000000..bc560d5 --- /dev/null +++ b/view/line_recon_list.xml @@ -0,0 +1,12 @@ + + + + + + + + + +