From 847fb3d342f0e6829418820c1ee0f23b4efe32ee Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Fri, 21 Aug 2020 09:38:04 +0000 Subject: [PATCH] [IMP] account: taxes: replace "repartition" by "distribution" The latter is more usual. closes odoo/odoo#56273 Signed-off-by: Laurent Smet --- addons/account/models/account_move.py | 6 +++--- addons/account/models/account_tax.py | 24 +++++++++++----------- addons/account/models/chart_template.py | 10 ++++----- addons/account/views/account_tax_views.xml | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 7a7f2824efe..4ce41e9c7d7 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2802,9 +2802,9 @@ class AccountMoveLine(models.Model): " are displayed). By default all new journal items are directly exigible, but with the feature cash_basis" " on taxes, some will become exigible only when the payment is recorded.") tax_repartition_line_id = fields.Many2one(comodel_name='account.tax.repartition.line', - string="Originator Tax Repartition Line", ondelete='restrict', readonly=True, + string="Originator Tax Distribution Line", ondelete='restrict', readonly=True, check_company=True, - help="Tax repartition line that caused the creation of this move line, if any") + help="Tax distribution line that caused the creation of this move line, if any") tax_tag_ids = fields.Many2many(string="Tags", comodel_name='account.account.tag', ondelete='restrict', help="Tags assigned to this line by the tax creating it, if any. It determines its impact on financial reports.", tracking=True) tax_audit = fields.Char(string="Tax Audit String", compute="_compute_tax_audit", store=True, @@ -2875,7 +2875,7 @@ class AccountMoveLine(models.Model): currency_id = company_currency_id AND ROUND(debit - credit - amount_currency, 2) = 0 - ) + ) )''', "The amount expressed in the secondary currency must be positive when account is debited and negative when " "account is credited. If the currency is the same as the one from the company, this amount must strictly " diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index 56b65e5d8ad..0e0e5f55ec5 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -89,8 +89,8 @@ class AccountTax(models.Model): domain="[('deprecated', '=', False), ('company_id', '=', company_id)]", comodel_name='account.account', help="Account used to transition the tax amount for cash basis taxes. It will contain the tax amount as long as the original invoice has not been reconciled ; at reconciliation, this amount cancelled on this account and put on the regular tax account.") - invoice_repartition_line_ids = fields.One2many(string="Repartition for Invoices", comodel_name="account.tax.repartition.line", inverse_name="invoice_tax_id", copy=True, help="Repartition when the tax is used on an invoice") - refund_repartition_line_ids = fields.One2many(string="Repartition for Refund Invoices", comodel_name="account.tax.repartition.line", inverse_name="refund_tax_id", copy=True, help="Repartition when the tax is used on a refund") + invoice_repartition_line_ids = fields.One2many(string="Distribution for Invoices", comodel_name="account.tax.repartition.line", inverse_name="invoice_tax_id", copy=True, help="Distribution when the tax is used on an invoice") + refund_repartition_line_ids = fields.One2many(string="Distribution for Refund Invoices", comodel_name="account.tax.repartition.line", inverse_name="refund_tax_id", copy=True, help="Distribution when the tax is used on a refund") tax_fiscal_country_id = fields.Many2one(string='Fiscal Country', comodel_name='res.country', related='company_id.account_tax_fiscal_country_id', help="Technical field used to restrict the domain of account tags for tax repartition lines created for this tax.") country_code = fields.Char(related='company_id.country_id.code', readonly=True) @@ -127,7 +127,7 @@ class AccountTax(models.Model): base_line = lines.filtered(lambda x: x.repartition_type == 'base') if len(base_line) != 1: - raise ValidationError(_("Invoice and credit note repartition should each contain exactly one line for the base.")) + raise ValidationError(_("Invoice and credit note distribution should each contain exactly one line for the base.")) @api.constrains('invoice_repartition_line_ids', 'refund_repartition_line_ids') def _validate_repartition_lines(self): @@ -138,14 +138,14 @@ class AccountTax(models.Model): record._check_repartition_lines(refund_repartition_line_ids) if len(invoice_repartition_line_ids) != len(refund_repartition_line_ids): - raise ValidationError(_("Invoice and credit note repartition should have the same number of lines.")) + raise ValidationError(_("Invoice and credit note distribution should have the same number of lines.")) index = 0 while index < len(invoice_repartition_line_ids): inv_rep_ln = invoice_repartition_line_ids[index] ref_rep_ln = refund_repartition_line_ids[index] if inv_rep_ln.repartition_type != ref_rep_ln.repartition_type or inv_rep_ln.factor_percent != ref_rep_ln.factor_percent: - raise ValidationError(_("Invoice and credit note repartitions should match (same percentages, in the same order).")) + raise ValidationError(_("Invoice and credit note distribution should match (same percentages, in the same order).")) index += 1 @api.constrains('children_tax_ids', 'type_tax_use') @@ -620,8 +620,8 @@ class AccountTaxRepartitionLine(models.Model): _order = 'sequence, repartition_type, id' _check_company_auto = True - factor_percent = fields.Float(string="%", required=True, help="Factor to apply on the account move lines generated from this repartition line, in percents") - factor = fields.Float(string="Factor Ratio", compute="_compute_factor", help="Factor to apply on the account move lines generated from this repartition line") + factor_percent = fields.Float(string="%", required=True, help="Factor to apply on the account move lines generated from this distribution line, in percents") + factor = fields.Float(string="Factor Ratio", compute="_compute_factor", help="Factor to apply on the account move lines generated from this distribution line") repartition_type = fields.Selection(string="Based On", selection=[('base', 'Base'), ('tax', 'of tax')], required=True, default='tax', help="Base on which the factor will be applied.") account_id = fields.Many2one(string="Account", comodel_name='account.account', @@ -631,14 +631,14 @@ class AccountTaxRepartitionLine(models.Model): tag_ids = fields.Many2many(string="Tax Grids", comodel_name='account.account.tag', domain=[('applicability', '=', 'taxes')], copy=True) invoice_tax_id = fields.Many2one(comodel_name='account.tax', check_company=True, - help="The tax set to apply this repartition on invoices. Mutually exclusive with refund_tax_id") + help="The tax set to apply this distribution on invoices. Mutually exclusive with refund_tax_id") refund_tax_id = fields.Many2one(comodel_name='account.tax', check_company=True, - help="The tax set to apply this repartition on refund invoices. Mutually exclusive with invoice_tax_id") + help="The tax set to apply this distribution on refund invoices. Mutually exclusive with invoice_tax_id") tax_id = fields.Many2one(comodel_name='account.tax', compute='_compute_tax_id') tax_fiscal_country_id = fields.Many2one(string="Fiscal Country", comodel_name='res.country', related='company_id.account_tax_fiscal_country_id', help="Technical field used to restrict tags domain in form view.") - company_id = fields.Many2one(string="Company", comodel_name='res.company', compute="_compute_company", store=True, help="The company this repartition line belongs to.") - sequence = fields.Integer(string="Sequence", default=1, help="The order in which display and match repartition lines. For refunds to work properly, invoice repartition lines should be arranged in the same order as the credit note repartition lines they correspond to.") + company_id = fields.Many2one(string="Company", comodel_name='res.company', compute="_compute_company", store=True, help="The company this distribution line belongs to.") + sequence = fields.Integer(string="Sequence", default=1, help="The order in which display and match distribution lines. For refunds to work properly, invoice distribution lines should be arranged in the same order as the credit note distribution lines they correspond to.") use_in_tax_closing = fields.Boolean(string="Tax Closing Entry") @api.onchange('account_id') @@ -652,7 +652,7 @@ class AccountTaxRepartitionLine(models.Model): def validate_tax_template_link(self): for record in self: if record.invoice_tax_id and record.refund_tax_id: - raise ValidationError(_("Tax repartition lines should apply to either invoices or refunds, not both at the same time. invoice_tax_id and refund_tax_id should not be set together.")) + raise ValidationError(_("Tax distribution lines should apply to either invoices or refunds, not both at the same time. invoice_tax_id and refund_tax_id should not be set together.")) @api.depends('factor_percent') def _compute_factor(self): diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 748d9695d6f..cd4f8031223 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -998,11 +998,11 @@ class AccountTaxRepartitionLineTemplate(models.Model): _name = "account.tax.repartition.line.template" _description = "Tax Repartition Line Template" - factor_percent = fields.Float(string="%", required=True, help="Factor to apply on the account move lines generated from this repartition line, in percents") + factor_percent = fields.Float(string="%", required=True, help="Factor to apply on the account move lines generated from this distribution line, in percents") repartition_type = fields.Selection(string="Based On", selection=[('base', 'Base'), ('tax', 'of tax')], required=True, default='tax', help="Base on which the factor will be applied.") account_id = fields.Many2one(string="Account", comodel_name='account.account.template', help="Account on which to post the tax amount") - invoice_tax_id = fields.Many2one(comodel_name='account.tax.template', help="The tax set to apply this repartition on invoices. Mutually exclusive with refund_tax_id") - refund_tax_id = fields.Many2one(comodel_name='account.tax.template', help="The tax set to apply this repartition on refund invoices. Mutually exclusive with invoice_tax_id") + invoice_tax_id = fields.Many2one(comodel_name='account.tax.template', help="The tax set to apply this distribution on invoices. Mutually exclusive with refund_tax_id") + refund_tax_id = fields.Many2one(comodel_name='account.tax.template', help="The tax set to apply this distribution on refund invoices. Mutually exclusive with invoice_tax_id") tag_ids = fields.Many2many(string="Financial Tags", relation='account_tax_repartition_financial_tags', comodel_name='account.account.tag', copy=True, help="Additional tags that will be assigned by this repartition line for use in financial reports") use_in_tax_closing = fields.Boolean(string="Tax Closing Entry") @@ -1048,14 +1048,14 @@ class AccountTaxRepartitionLineTemplate(models.Model): def validate_tax_template_link(self): for record in self: if record.invoice_tax_id and record.refund_tax_id: - raise ValidationError(_("Tax repartition line templates should apply to either invoices or refunds, not both at the same time. invoice_tax_id and refund_tax_id should not be set together.")) + raise ValidationError(_("Tax distribution line templates should apply to either invoices or refunds, not both at the same time. invoice_tax_id and refund_tax_id should not be set together.")) @api.constrains('plus_report_line_ids', 'minus_report_line_ids') def validate_tags(self): all_tax_rep_lines = self.mapped('plus_report_line_ids') + self.mapped('minus_report_line_ids') lines_without_tag = all_tax_rep_lines.filtered(lambda x: not x.tag_name) if lines_without_tag: - raise ValidationError(_("The following tax report lines are used in some tax repartition template though they don't generate any tag: %s . This probably means you forgot to set a tag_name on these lines.", str(lines_without_tag.mapped('name')))) + raise ValidationError(_("The following tax report lines are used in some tax distribution template though they don't generate any tag: %s . This probably means you forgot to set a tag_name on these lines.", str(lines_without_tag.mapped('name')))) def get_repartition_line_create_vals(self, company): rslt = [(5, 0, 0)] diff --git a/addons/account/views/account_tax_views.xml b/addons/account/views/account_tax_views.xml index 6baf91b75ae..74e78d3e6e8 100644 --- a/addons/account/views/account_tax_views.xml +++ b/addons/account/views/account_tax_views.xml @@ -135,10 +135,10 @@
- + - +