Help

欢迎!

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


0

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

Avatar
odoo
Avatar
Discard
3 Answers
0
Avatar
odoo
Best Answer

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'),]
Avatar
Discard
0
Avatar
odoo
Best Answer

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;

Avatar
Discard
0
Avatar
odoo
Best Answer

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.

Avatar
Discard