Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1257 Zobrazení

Hello,


Through the Settings/Companies, I am trying to Duplicate an existing company and get the User Error:  Duplicating a company is not allowed. Please create a new company instead.

How can I fix that?

Version 16.0


thanks


Avatar
Zrušit
Nejlepší odpověď

Hello ilias,

its base User Error for restricting company duplication.
Still you want to fix this then you have to override base copy method and handle the same.

​import logging
from odoo import api, fields, models, tools, _, Command


class Company(models.Model):
_inherit = "res.company"

​def copy(self, default=None):
_logger.warning("Duplicating a company forcefully")​
​#raise UserError(_('Duplicating a company is not allowed. Please create a new company ​#instead.'))
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
lis 23
13558
3
říj 23
9097
1
říj 22
3933
1
kvě 20
3857
2
čvc 25
1661