Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

Odoo 11 how to remove _sql_constraint in stock.production.lot

形象
odoo
形象
丢弃
3 答案
0
形象
odoo
最佳答案

Hi,

you should both comment the line and remove the constraint from Postgre.

Have a look at: https://www.odoo.com/forum/help-1/question/remove-sql-constraints-5431

Alternatively you may redefine this sql contsraint in your Python class:

class stock_production_lot(models.Model):    
    _inherit = "stock.production.lot"
    _sql_constraints = [('name_ref_inique', 'check(1=1)', 'No error'),]
形象
丢弃
0
形象
odoo
最佳答案

Hi, 
Just remove the contsraint manually from your python file and from the database. 

try this : 
ALTER TABLE Your_table_name DROP CONSTRAINT Your_constraint_name;

形象
丢弃
0
形象
odoo
最佳答案

Thank you for your answers I did not try them because it turned out that we could solve the problem by ticking an option in the settings of the operation "receipt", field "use_existing_lots" in stock.picking.type.

I am glad that I do not have to alter the database by hand.

形象
丢弃