Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1374 มุมมอง

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.'))
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
how to delete a company? แก้ไขแล้ว
1
พ.ย. 23
13729
3
ต.ค. 23
9224
How to remove a existing company odoo 15 แก้ไขแล้ว
1
ต.ค. 22
4087
1
พ.ค. 20
3912
2
ก.ค. 25
1864