跳至內容
選單
此問題已被標幟
1 回覆
1285 瀏覽次數

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


頭像
捨棄
最佳答案

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.'))
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 23
13587
3
10月 23
9113
1
10月 22
3947
1
5月 20
3868
2
7月 25
1719