我继承了res.partner
模型,现在,我想将vat
字段设置为required
和{
我知道如何在正常情况下,例如在一个新模型上,但是我希望原始字段具有这些属性。在
我怎样才能做到这一点?在
我认为应该在视图中显示,但我不太确定,我不认为通过python可以用简单的方法实现。在
为了与众不同,我试过这样做:
class ResPartner(models.Model):
_name = 'res.partner'
_inherit = 'res.partner'
fields...
methods...
_sql_constraints = [
('vat_company_uniq', 'unique(company_id, vat)', '¡ El RIF debe ser único por compañia !'),
]
但它不起作用,我的意思是,我看不到的是,这个字段已经存在于原始对象中,所以如何“修改”它,使其成为unique
和{
删除\u name='res.合伙人'并且只使用inherit='res.合伙人'。在
然后,我们必须在.py侧重新声明vat字段,属性为required=True。在
\u sql\u constraints很好。在
重新启动Odoo服务器并升级模块。它会很好的。在
相关问题 更多 >
编程相关推荐