Skip to content
Snippets Groups Projects
Commit 10a5ecce authored by Bhavesh Odedra's avatar Bhavesh Odedra Committed by oco-odoo
Browse files

[FIX] account: check if tax name on copy method

With this commit, it will check if the tax name is given by external method and take that name if any.

For example,
vals = {'rate': 5.2, 'name': 'Odoo New Tax'}
tax_template = self.env['account.tax'].search(domain, limit=1)
new_tax = tax_template.copy(default=vals)

Current Behavior:
new_tax.name => 'Odoo New Tax (Copy)'

Instead of 'Odoo New tax'

closes odoo/odoo#75330

X-original-commit: 7ba56a2d
Signed-off-by: default avataroco-odoo <oco-odoo@users.noreply.github.com>
parent c7e0229d
Branches
Tags
No related merge requests found
......@@ -183,7 +183,9 @@ class AccountTax(models.Model):
@api.returns('self', lambda value: value.id)
def copy(self, default=None):
default = dict(default or {}, name=_("%s (Copy)", self.name))
default = dict(default or {})
if 'name' not in default:
default['name'] = _("%s (Copy)") % self.name
return super(AccountTax, self).copy(default=default)
def name_get(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment