diff options
| author | Laurent Smet <las@odoo.com> | 2020-04-17 07:43:33 +0000 |
|---|---|---|
| committer | Laurent Smet <las@odoo.com> | 2020-06-15 08:36:04 +0000 |
| commit | beccf82e09d536255d9d9cb9bfe58ebae2559843 (patch) | |
| tree | e031e879cb607248f437acc351540324c2f27b31 /addons/account/models/company.py | |
| parent | f074772d259656a08376bd0519e5648997e700ba (diff) | |
[REF] account: journal items reconciliation (part 1/2)
This commits refactors the code of the reconciliation, in order to facilitate the process of complex use cases, namely multi-currencies or cash-basis-taxes related (see details below). It also prepares the code for a second refactoring where we will save on each journal items the amount_currency and currency_id field (even in case of operation made in company currency), also in the sake of simplification.
1) Multi-currencies:
- the account.partial.reconcile model now will have dedicated columns to specify the amount of the partial reconciliation in the debit_line_id currency and the credit_line_id currency. That comes in handy when dealing with journal items having different secondary currencies, but also allows some simplification.
- residual_amount_currency computation changed accordingly
- moved models account.full.reconcile and account.partial.reconcile in their dedicated .py file
2) Cash basis taxes
- cash basis entries now handle correctly rounding errors to make sure the exact amount of gets reported when the reconciliation becomes full.
- the account for the base amount of cash basis entries has to be set, now, on the company instead of on each cash basis tax.
- that new 'property' field can be set at the CoA installation via the field property_cash_basis_base_account_id of account.chart.template, or going through the accounting settings.
Was task task: 2243420
Was PR #50308
Related: odoo/upgrade#1121
Related: odoo/enterprise#10252
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons/account/models/company.py')
| -rw-r--r-- | addons/account/models/company.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 11e02db2baa..853b2321252 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -55,7 +55,6 @@ class ResCompany(models.Model): transfer_account_code_prefix = fields.Char(string='Prefix of the transfer accounts') account_sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax") account_purchase_tax_id = fields.Many2one('account.tax', string="Default Purchase Tax") - tax_cash_basis_journal_id = fields.Many2one('account.journal', string="Cash Basis Journal") tax_calculation_rounding_method = fields.Selection([ ('round_per_line', 'Round per Line'), ('round_globally', 'Round Globally'), @@ -113,6 +112,17 @@ class ResCompany(models.Model): # Technical field to hide country specific fields in company form view country_code = fields.Char(related='country_id.code') + # Cash basis taxes + tax_cash_basis_journal_id = fields.Many2one( + comodel_name='account.journal', + string="Cash Basis Journal") + account_cash_basis_base_account_id = fields.Many2one( + comodel_name='account.account', + domain=[('deprecated', '=', False)], + string="Base Tax Received Account", + help="Account that will be set on lines created in cash basis journal entry and used to keep track of the " + "tax base amount.") + @api.constrains('account_opening_move_id', 'fiscalyear_last_day', 'fiscalyear_last_month') def _check_fiscalyear_last_day(self): # if the user explicitly chooses the 29th of February we allow it: |
