Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
1288 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
nov 23
13591
3
ott 23
9118
1
ott 22
3948
1
mag 20
3868
2
lug 25
1722