Skip to content

Commit

Permalink
[REM] account: Remove the cash-basis feature in reports
Browse files Browse the repository at this point in the history
This feature was too greedy in term of performance to be computed and not very used.

-task: 1888408

closes odoo#33500

Signed-off-by: Quentin De Paoli (qdp) <[email protected]>
  • Loading branch information
smetl committed May 20, 2019
1 parent 76aa319 commit 7f1a1fe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
15 changes: 0 additions & 15 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,17 +608,6 @@ def _get_currency(self):
currency = self.env['account.journal'].browse(context['default_journal_id']).currency_id
return currency

@api.depends('debit', 'credit', 'move_id.matched_percentage', 'move_id.journal_id')
def _compute_cash_basis(self):
for move_line in self:
if move_line.journal_id.type in ('sale', 'purchase'):
move_line.debit_cash_basis = move_line.debit * move_line.move_id.matched_percentage
move_line.credit_cash_basis = move_line.credit * move_line.move_id.matched_percentage
else:
move_line.debit_cash_basis = move_line.debit
move_line.credit_cash_basis = move_line.credit
move_line.balance_cash_basis = move_line.debit_cash_basis - move_line.credit_cash_basis

@api.depends('move_id.line_ids', 'move_id.line_ids.tax_line_id', 'move_id.line_ids.debit', 'move_id.line_ids.credit')
def _compute_tax_base_amount(self):
for move_line in self:
Expand All @@ -642,10 +631,6 @@ def _compute_parent_state(self):
credit = fields.Monetary(default=0.0, currency_field='company_currency_id')
balance = fields.Monetary(compute='_store_balance', store=True, currency_field='company_currency_id',
help="Technical field holding the debit - credit in order to open meaningful graph views from reports")
debit_cash_basis = fields.Monetary(currency_field='company_currency_id', compute='_compute_cash_basis', store=True)
credit_cash_basis = fields.Monetary(currency_field='company_currency_id', compute='_compute_cash_basis', store=True)
balance_cash_basis = fields.Monetary(compute='_compute_cash_basis', store=True, currency_field='company_currency_id',
help="Technical field holding the debit_cash_basis - credit_cash_basis in order to open meaningful graph views from reports")
amount_currency = fields.Monetary(default=0.0, help="The amount expressed in an optional other currency if it is a multi-currency entry.")
company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', string="Company Currency", readonly=True,
help='Utility field to express amount currency', store=True)
Expand Down
27 changes: 0 additions & 27 deletions addons/account/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,6 @@
</field>
</record>

<record id="account_move_line_graph_date_cash_basis" model="ir.ui.view">
<field name="name">account.move.line.graph</field>
<field name="model">account.move.line</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="date"/>
<field name="balance_cash_basis" operator="+" type='measure'/>
</graph>
</field>
</record>

<record id="view_account_move_line_filter" model="ir.ui.view">
<field name="name">account.move.line.search</field>
<field name="model">account.move.line</field>
Expand Down Expand Up @@ -491,22 +480,6 @@
<field name="res_model">account.move.line</field>
</record>

<record id="action_move_line_graph_cash_basis" model="ir.actions.act_window">
<field name="name">Journal Items</field>
<field name="view_mode">graph,pivot</field>
<field name="view_id" ref="account_move_line_graph_date_cash_basis"/>
<field name="context">{'search_default_account_id': [active_id]}</field>
<field name="res_model">account.move.line</field>
</record>

<record id="action_move_line_graph_cash_basis_posted" model="ir.actions.act_window">
<field name="name">Journal Items</field>
<field name="view_mode">graph,pivot</field>
<field name="view_id" ref="account_move_line_graph_date_cash_basis"/>
<field name="context">{'search_default_account_id': [active_id], 'search_default_posted': 1}</field>
<field name="res_model">account.move.line</field>
</record>

<!-- account.move (Journal Entry) -->

<record id="action_move_journal_line" model="ir.actions.act_window">
Expand Down

0 comments on commit 7f1a1fe

Please sign in to comment.