[IMP] account: improve settings
* [IMP] account, account_accountant: Move 'tax_cash_basis_journal_id' field from 'account_accountant' to 'account' module.
* [IMP] account: Few improvements in accounting settings,
- Set 'Invoicing' section as a last section.
- Add checkbox 'Cash Basis' in settings and make it company dependent and add multi company's icon to it.
- Disable the 'Tax Cash Basis Journal' field if 'Cash Basis' not active. Also add tooltip on 'Cash Basis'.
- Visible/Invisible 'Use Cash Basis' field in 'Taxes' form view based on 'Cash Basis' settings from accounting settings.
- Don't allow untick 'Cash Basis' settings if there are taxes using the configuration.
- When any CoA is installed which is creating taxes with configuration 'Use Cash Basis' set then make the 'Cash Basis' option in accounting settings checked by default.
Was PR #16516
This commit is contained in:
@@ -662,6 +662,8 @@ class AccountTax(models.Model):
|
||||
analytic = fields.Boolean(string="Include in Analytic Cost", help="If set, the amount computed by this tax will be assigned to the same analytic account as the invoice line (if any)")
|
||||
tag_ids = fields.Many2many('account.account.tag', 'account_tax_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting")
|
||||
tax_group_id = fields.Many2one('account.tax.group', string="Tax Group", default=_default_tax_group, required=True)
|
||||
# Technical field to make the 'use_cash_basis' field invisible if the same named field is set to false in 'res.company' model
|
||||
hide_use_cash_basis = fields.Boolean(string='Hide Use Cash Basis Option', related='company_id.use_cash_basis')
|
||||
use_cash_basis = fields.Boolean(
|
||||
'Use Cash Basis',
|
||||
help="Select this if the tax should use cash basis,"
|
||||
|
||||
@@ -60,6 +60,8 @@ class AccountConfigSettings(models.TransientModel):
|
||||
module_product_margin = fields.Boolean(string="Allow Product Margin")
|
||||
module_l10n_eu_service = fields.Boolean(string="EU Digital Goods VAT")
|
||||
module_account_taxcloud = fields.Boolean(string="Account TaxCloud")
|
||||
use_cash_basis = fields.Boolean(string='Cash Basis', related='company_id.use_cash_basis')
|
||||
tax_cash_basis_journal_id = fields.Many2one('account.journal', related='company_id.tax_cash_basis_journal_id', string="Tax Cash Basis Journal")
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
@@ -123,6 +125,21 @@ class AccountConfigSettings(models.TransientModel):
|
||||
if self.module_account_yodlee:
|
||||
self.module_account_plaid = True
|
||||
|
||||
@api.onchange('use_cash_basis')
|
||||
def _onchange_use_cash_basis(self):
|
||||
res = {}
|
||||
tax = self.env['account.tax'].search([
|
||||
('company_id', '=', self.env.user.company_id.id), ('use_cash_basis', '=', True)
|
||||
], limit=1)
|
||||
if not self.use_cash_basis and tax:
|
||||
self.use_cash_basis = True
|
||||
res['warning'] = {
|
||||
'title': _('Error!'),
|
||||
'message': _('You cannot disable this setting because some of your taxes are cash basis. '
|
||||
'Modify your taxes first before disabling this setting.')
|
||||
}
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def create(self, values):
|
||||
# Optimisation purpose, saving a res_config even without changing any values will trigger the write of all
|
||||
|
||||
@@ -598,6 +598,11 @@ class AccountTaxTemplate(models.Model):
|
||||
'cash_basis_account': tax.cash_basis_account.id,
|
||||
}
|
||||
|
||||
if any([tax.use_cash_basis for tax in self]):
|
||||
# When a CoA is being installed automatically and if it is creating account tax(es) whose field `Use Cash Basis`(use_cash_basis) is set to True by default
|
||||
# (exapmple of such CoA's are l10n_fr and l10n_mx) then in the `Accounting Settings` the option `Cash Basis` should be checked by default.
|
||||
company.use_cash_basis = True
|
||||
|
||||
return {
|
||||
'tax_template_to_tax': tax_template_to_tax,
|
||||
'account_dict': todo_dict
|
||||
|
||||
@@ -44,6 +44,7 @@ If you have any queries regarding your account, Please contact us.
|
||||
|
||||
Thank you in advance for your cooperation.
|
||||
Best Regards,''')
|
||||
use_cash_basis = fields.Boolean(string='Use Cash Basis')
|
||||
|
||||
@api.multi
|
||||
def compute_fiscalyear_dates(self, date):
|
||||
|
||||
@@ -112,6 +112,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="Select this if the taxes should use cash basis, which will create an entry for such taxes on a given account during reconciliation.">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="use_cash_basis"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="use_cash_basis"/>
|
||||
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." groups="base.group_multi_company"/>
|
||||
<div class="text-muted">
|
||||
Allow to configure taxes using cash basis
|
||||
</div>
|
||||
<div class="content-group" attrs="{'invisible': [('use_cash_basis', '=', False)]}">
|
||||
<div class="row mt16">
|
||||
<label for="tax_cash_basis_journal_id" class="col-md-3 o_light_label"/>
|
||||
<field name="tax_cash_basis_journal_id"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Accounting Reports</h2>
|
||||
<div class="row mt16 o_settings_container" id="accounting_reports">
|
||||
@@ -189,31 +207,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Invoicing</h2>
|
||||
<div class="row mt16 o_settings_container" id="invoicing_settings">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="group_warning_account"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="group_warning_account"/>
|
||||
<div class="text-muted">
|
||||
Get warnings when invoicing specific customers
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_print_docsaway" widget="upgrade_boolean"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_print_docsaway"/>
|
||||
<div class="text-muted">
|
||||
Mail your invoices in one-click using <a target="_blank" href="https://www.docsaway.com/">Docsaway</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Customer Payments</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" id="account_followup" title="This feature is useful if you issue a high amounts of invoices.">
|
||||
@@ -379,6 +372,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Invoicing</h2>
|
||||
<div class="row mt16 o_settings_container" id="invoicing_settings">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="group_warning_account"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="group_warning_account"/>
|
||||
<div class="text-muted">
|
||||
Get warnings when invoicing specific customers
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_print_docsaway" widget="upgrade_boolean"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="module_print_docsaway"/>
|
||||
<div class="text-muted">
|
||||
Mail your invoices in one-click using <a target="_blank" href="https://www.docsaway.com/">Docsaway</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -1053,7 +1053,8 @@
|
||||
<field name="price_include" attrs="{'invisible':[('amount_type','=', 'group')]}" />
|
||||
<field name="include_base_amount" attrs="{'invisible':[('amount_type','=', 'group')]}" />
|
||||
<field name="tax_adjustment"/>
|
||||
<field name="use_cash_basis" attrs="{'invisible':[('amount_type','=', 'group')]}"/>
|
||||
<field name="hide_use_cash_basis" invisible="1"/>
|
||||
<field name="use_cash_basis" attrs="{'invisible':['|', ('amount_type','=', 'group'), ('hide_use_cash_basis', '=', False)]}"/>
|
||||
<field name="cash_basis_account" attrs="{'invisible': [('use_cash_basis', '=', False)], 'required': [('use_cash_basis', '=', True)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -29,7 +29,3 @@ class AccountConfigSettings(models.TransientModel):
|
||||
related='company_id.transfer_account_id',
|
||||
domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
|
||||
help="Intermediary account used when moving money from a liquidity account to another")
|
||||
tax_cash_basis_journal_id = fields.Many2one(
|
||||
'account.journal',
|
||||
related='company_id.tax_cash_basis_journal_id',
|
||||
string="Tax Cash Basis Journal",)
|
||||
|
||||
@@ -77,23 +77,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="eu_service" position="after">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane"/>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="id" string="Cash Basis"/>
|
||||
<div class="text-muted">
|
||||
Journal used to declare taxes at payment date
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="row mt16">
|
||||
<label for="tax_cash_basis_journal_id" class="col-md-3 o_light_label"/>
|
||||
<field name="tax_cash_basis_journal_id"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="analytic" position="after">
|
||||
<h2>Automated Entries</h2>
|
||||
<div class="row mt16 o_settings_container" id="recommended_apps">
|
||||
|
||||
Reference in New Issue
Block a user