[trunk] impossible to delete a product category, even empty, if it contained products previously

Bug #698023 reported by mrshelly
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 2

Bug Description

In product management module. Add a product, and remove it.
but, It raise an exception when I remove the product's category.

The Exception's text:
null value in column "categ_id" violates not-null constraint
CONTEXT: SQL statement "UPDATE ONLY "public"."product_template" SET "categ_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "categ_id""

I get some information from the PostgreSQL... the product.template object 's data is not be removed when the product.product object removed.

Related branches

mrshelly (mrshelly)
description: updated
Revision history for this message
Azazahmed Saiyed (OpenERP) (saz-openerp) wrote :

Hello,

The traceback comes at server log every time the integrity error comes in the system.

Thanks.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Yogesh (SerpentCS) (yogesh-serpentcs) wrote :

Hello,

It has been fixed into https://code.launchpad.net/~openerp-dev/openobject-server/ysa-trunk-server branch by:
Revision ID: <email address hidden>
Revno: 3209

Thanks.

Changed in openobject-server:
status: In Progress → Fix Released
Changed in openobject-server:
milestone: none → 6.0
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello everyone,

The problem here is not the fact that there is an error message in the server console, which is totally normal and in fact helps to understand the issue.
The problem is that even after deleting all products in a given category, the category cannot be deleted because the product.templates have not been deleted and still reference it.

This needs to be fixed in the product module, for example with a custom unlink() of the product.product object, which unlink() the product.template as well if the last product.product for this template is being deleted. This way when all products in a category have been deleted, the category can be deleted too.

Workaround: create a menu to open the list of product.templates and cleanup the templates directly from there: open the product.template object via Administration>Customization>Database structure>Objects, and click on 'Create a menu'

Changed in openobject-server:
assignee: OpenERP's Framework R&D (openerp-dev-framework) → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
status: Fix Released → Confirmed
affects: openobject-server → openobject-addons
Changed in openobject-addons:
milestone: 6.0 → none
summary: - null value in column "categ_id" violates
+ [trunk] impossible to delete a product category, even empty, if it
+ contained products previously
Changed in openobject-addons:
milestone: none → 6.0
Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 1 (openerp-dev-addons1) → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
Revision history for this message
Atik Agewan(OpenERP) (aag-openerp) wrote :

Hello mrshelly,

Thanks for reporting,
It has been fixed in lp:~openerp-commiter/openobject-addons/trunk-addons-aag
Revision ID: <email address hidden>
Revision num:5065.
It will be available in trunk soon,

Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.