Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1206 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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.'))
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 23
13470
3
thg 10 23
9034
1
thg 10 22
3881
1
thg 5 20
3794
2
thg 7 25
1589