From b67c51749708ea411a780f062aae8e5e0032f2f1 Mon Sep 17 00:00:00 2001 From: "olt@tinyerp.com" <> Date: Thu, 4 Feb 2010 08:12:40 +0100 Subject: [PATCH] [FIX] product: pricelist: ondelete cascade to avoid errors when deleting pricelists and versions ('null value in column "price_version_id" violates not-null constraint') bzr revid: olt@tinyerp.com-20100204071240-gvxzu0hu1utz7jgy --- addons/product/pricelist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index d10c7562692..be413273ebd 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -261,7 +261,7 @@ class product_pricelist_version(osv.osv): _description = "Pricelist Version" _columns = { 'pricelist_id': fields.many2one('product.pricelist', 'Price List', - required=True, select=True), + required=True, select=True, ondelete='cascade'), 'name': fields.char('Name', size=64, required=True, translate=True), 'active': fields.boolean('Active', help="When a version is duplicated it is set to non active, so that the " \ @@ -344,7 +344,7 @@ class product_pricelist_item(osv.osv): _columns = { 'name': fields.char('Rule Name', size=64, help="Explicit rule name for this pricelist line."), - 'price_version_id': fields.many2one('product.pricelist.version', 'Price List Version', required=True, select=True), + 'price_version_id': fields.many2one('product.pricelist.version', 'Price List Version', required=True, select=True, ondelete='cascade'), 'product_tmpl_id': fields.many2one('product.template', 'Product Template', ondelete='cascade', help="Set a template if this rule only apply to a template of product. Keep empty for all products"), 'product_id': fields.many2one('product.product', 'Product', ondelete='cascade', help="Set a product if this rule only apply to one product. Keep empty for all products"), 'categ_id': fields.many2one('product.category', 'Product Category', ondelete='cascade', help="Set a category of product if this rule only apply to products of a category and his childs. Keep empty for all products"),