usability: deleting product would better cascade delete related order point rules

Bug #526081 reported by Raphaël Valyi - http://www.akretion.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
gpa(OpenERP)

Bug Description

Hello,

In the mrp module, in mrp.py file, in the stock.warehouse.orderpoint object definition, I think it would be more user friendly to add a delete cascade on the product_id key, so that when the user delete a product, it will also delete associated order point rules rather than break into that ugly exception:
"
Integrity Error
null value in column "product_id" violates not-null constraint
CONTEXT: SQL statement "UPDATE ONLY "public"."stock_warehouse_orderpoint" SET "product_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "product_id""
"

So if you think that's all right, please apply to provided patch; seems to work well for me.

Hope this helps

Related branches

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :
Revision history for this message
gpa(OpenERP) (gpa-openerp) wrote :

Hello Raphel,

I agree completely for product_id to have ondelete='cascade'.
I would like know whether its also useful o apply ondelete cascade to warehouse and location too?

Thanks

Changed in openobject-addons:
assignee: nobody → gpa(Open ERP) (gpa-openerp)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : Re: [Bug 526081] Re: usability: deleting product would better cascade delete related order point rules

Hello gpa,

not sure for warehouse and location. I would say yes, but not 100% sure. And
by the way, it's really more exceptional you remove a warehouse or a
location so manual intervention in those cases is more tolerable. So I mean
please to it for products, would be nice in 5.0.7, as for warehouse and
location, do it if you gain more confidence, I'm launching the manufacturing
experts on it right now.

Thanks

On Fri, Feb 26, 2010 at 7:18 AM, gpa(Open ERP) <email address hidden> wrote:

> Hello Raphel,
>
> I agree completely for product_id to have ondelete='cascade'.
> I would like know whether its also useful o apply ondelete cascade to
> warehouse and location too?
>
> Thanks
>
> ** Changed in: openobject-addons
> Assignee: (unassigned) => gpa(Open ERP) (gpa-openerp)
>
> --
> usability: deleting product would better cascade delete related order point
> rules
> https://bugs.launchpad.net/bugs/526081
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in OpenObject Addons Modules: New
>
> Bug description:
> Hello,
>
> In the mrp module, in mrp.py file, in the stock.warehouse.orderpoint object
> definition, I think it would be more user friendly to add a delete cascade
> on the product_id key, so that when the user delete a product, it will also
> delete associated order point rules rather than break into that ugly
> exception:
> "
> Integrity Error
> null value in column "product_id" violates not-null constraint
> CONTEXT: SQL statement "UPDATE ONLY "public"."stock_warehouse_orderpoint"
> SET "product_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "product_id""
> "
>
> So if you think that's all right, please apply to provided patch; seems to
> work well for me.
>
> Hope this helps
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/openobject-addons/+bug/526081/+subscribe
>

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello gpa,

As you can read in the manufacturing expert mailing list
https://lists.launchpad.net/openerp-expert-production/ , the experts agree
upon the cascade delete I suggested with product, but do not advise to add
such a cascade for warehouse and locations, so I suggest for now you apply
the patch I suggest and only this one.

Thank you in advance, BTW, I have a customer that would be happy to have
that in prod in 5.0.7.

Raphaël Valyi
http://www.akretion.com

2010/2/26 Raphaël Valyi <email address hidden>

> Hello gpa,
>
> not sure for warehouse and location. I would say yes, but not 100% sure.
> And by the way, it's really more exceptional you remove a warehouse or a
> location so manual intervention in those cases is more tolerable. So I mean
> please to it for products, would be nice in 5.0.7, as for warehouse and
> location, do it if you gain more confidence, I'm launching the manufacturing
> experts on it right now.
>
> Thanks
>
>
> On Fri, Feb 26, 2010 at 7:18 AM, gpa(Open ERP) <email address hidden> wrote:
>
>> Hello Raphel,
>>
>> I agree completely for product_id to have ondelete='cascade'.
>> I would like know whether its also useful o apply ondelete cascade to
>> warehouse and location too?
>>
>> Thanks
>>
>> ** Changed in: openobject-addons
>> Assignee: (unassigned) => gpa(Open ERP) (gpa-openerp)
>>
>> --
>> usability: deleting product would better cascade delete related order
>> point rules
>> https://bugs.launchpad.net/bugs/526081
>> You received this bug notification because you are a direct subscriber
>> of the bug.
>>
>> Status in OpenObject Addons Modules: New
>>
>> Bug description:
>> Hello,
>>
>> In the mrp module, in mrp.py file, in the stock.warehouse.orderpoint
>> object definition, I think it would be more user friendly to add a delete
>> cascade on the product_id key, so that when the user delete a product, it
>> will also delete associated order point rules rather than break into that
>> ugly exception:
>> "
>> Integrity Error
>> null value in column "product_id" violates not-null constraint
>> CONTEXT: SQL statement "UPDATE ONLY "public"."stock_warehouse_orderpoint"
>> SET "product_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "product_id""
>> "
>>
>> So if you think that's all right, please apply to provided patch; seems to
>> work well for me.
>>
>> Hope this helps
>>
>> To unsubscribe from this bug, go to:
>> https://bugs.launchpad.net/openobject-addons/+bug/526081/+subscribe
>>
>
>

Revision history for this message
Ana Juaristi Olalde (ajuaristio) wrote :

Sorry, unintentionally I sent my answer only to Grzegorz Grzelak (Cirrus), just because I pushed replay instead or doing directly from bug or discussion thread. Thank you Cirrus for advertising :)

Here is my point of view if it is usefull:

 I agree in product case it is evident.

On location, I'm not so sure but it is right if you delete a location, it's no sense having order rules for that location since it doesn't exists. Another point is that if you really want to delete a location, it can be hard deleting all related order rules one by one, so maybe it could be good idea deleting cascade also in location.

About having order rules by location and not by warehouse, I don't think so it is so bad because a product could be located on different warehouse locations and maybe you need controlling each one of them. Imaging you have got a very big warehouse with manufacturing chaine, and you have different location on it containing same products... it could be the case. That case is covered now, but if stock rules are defined by warehouse, you should need defining diferent warehouses for each location if you want controll stock rules on each of them. I don't know if we would be wining or loosing some functionality here. I think it needs more discussion.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Guys,

I agree that more discussion may be needed.

But for the sake of simplicity, we have added ondelete cascade to product,location and warehouse so that removal of them does not affect badly on stock.warehouse.orderpoint.

Corrections made by revision 2626 <email address hidden>.

Thanks.

Changed in openobject-addons:
status: New → Fix Released
milestone: none → 5.0.8
Changed in openobject-addons:
importance: Undecided → Medium
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.