Improve payable/receivable lines
- use a simplified view - add amount function field - use search_value for reconciliation filtering issue4515 review10101003
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Improve payable/receivable lines
|
||||
* Enforce same sign between amount_second_currency and debit - credit
|
||||
* Allow tax modifying the unit price
|
||||
* Add reverse_compute on Tax
|
||||
|
||||
@@ -622,6 +622,14 @@ class Line(ModelSQL, ModelView):
|
||||
'get_currency_digits')
|
||||
second_currency_digits = fields.Function(fields.Integer(
|
||||
'Second Currency Digits'), 'get_currency_digits')
|
||||
amount = fields.Function(fields.Numeric('Amount',
|
||||
digits=(16, Eval('amount_currency_digits', 2)),
|
||||
depends=['amount_currency_digits']),
|
||||
'get_amount')
|
||||
amount_currency = fields.Function(fields.Many2One('currency.currency',
|
||||
'Amount Currency'), 'get_amount_currency')
|
||||
amount_currency_digits = fields.Function(fields.Integer(
|
||||
'Amount Currency Digits'), 'get_amount_currency')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
@@ -1152,6 +1160,23 @@ class Line(ModelSQL, ModelView):
|
||||
order_origin = _order_move_field('origin')
|
||||
order_move_state = _order_move_field('state')
|
||||
|
||||
def get_amount(self, name):
|
||||
sign = 1 if self.account.type.display_balance == 'debit-credit' else -1
|
||||
if self.amount_second_currency is not None:
|
||||
return self.amount_second_currency * sign
|
||||
else:
|
||||
return self.debit - self.credit * sign
|
||||
|
||||
def get_amount_currency(self, name):
|
||||
if self.second_currency:
|
||||
currency = self.second_currency
|
||||
else:
|
||||
currency = self.account.currency
|
||||
if name == 'amount_currency':
|
||||
return currency.id
|
||||
elif name == 'amount_currency_digits':
|
||||
return currency.digits
|
||||
|
||||
def get_rec_name(self, name):
|
||||
if self.debit > self.credit:
|
||||
return self.account.rec_name
|
||||
|
||||
@@ -163,6 +163,13 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">move_line_tree_move</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="move_line_view_list_payable_receivable">
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="30"/>
|
||||
<field name="name">move_line_list_payable_receivable</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_move_line_form">
|
||||
<field name="name">Account Move Lines</field>
|
||||
<field name="res_model">account.move.line</field>
|
||||
@@ -192,7 +199,15 @@ this repository contains the full copyright notices and license terms. -->
|
||||
id="act_move_line_payable_receivable">
|
||||
<field name="name">Payable/Receivable Lines</field>
|
||||
<field name="res_model">account.move.line</field>
|
||||
<field name="domain">[('party', 'in', Eval('active_ids')), ('account.kind', 'in', ['payable', 'receivable']), ('reconciliation', '=', None)]</field>
|
||||
<field name="domain">[('party', 'in', Eval('active_ids')), ('account.kind', 'in', ['payable', 'receivable'])]</field>
|
||||
<field name="search_value">[('reconciliation', '=', None)]</field>
|
||||
<field name="order">[('date', 'DESC')]</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_move_line_payable_receivable_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="move_line_view_list_payable_receivable"/>
|
||||
<field name="act_window" ref="act_move_line_payable_receivable"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_move_line_payable_receivable_domain_payable">
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Account Move Lines">
|
||||
<field name="date"/>
|
||||
<field name="party"/>
|
||||
<field name="amount"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="origin"/>
|
||||
<field name="description"/>
|
||||
<field name="move_description"/>
|
||||
<field name="reconciliation"/>
|
||||
</tree>
|
||||
Reference in New Issue
Block a user