İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
1267 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Kas 23
13571
3
Eki 23
9100
1
Eki 22
3935
1
May 20
3861
2
Tem 25
1677