Merge lp:~wiz-keed/ocb-addons/ocb-7.0-fix-mrp-subproduct-unkink into lp:ocb-addons

Proposed by Paul Catinean
Status: Merged
Approved by: Holger Brunn (Therp)
Approved revision: 10050
Merged at revision: 10077
Proposed branch: lp:~wiz-keed/ocb-addons/ocb-7.0-fix-mrp-subproduct-unkink
Merge into: lp:ocb-addons
Diff against target: 12 lines (+1/-1)
1 file modified
mrp_byproduct/ (+1/-1)
To merge this branch: bzr merge lp:~wiz-keed/ocb-addons/ocb-7.0-fix-mrp-subproduct-unkink
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Pedro Manuel Baeza code review Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Raphaël Valyi - Approve
Review via email:

Description of the change

Port to OCB of the following fix:

[FIX] Added ondelete='cascade' to mrp.subproduct when attatched bom is unlinked

To post a comment you must log in.
Revision history for this message
Raphaël Valyi - (rvalyi) wrote :

LGTM, thanks!

review: Approve
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

This change is touchy, as it modifies the underlying database schema. Probably not OK for standard addons.

I'd be OK for having this in OCB, though.

Having an automated test showing the bug is fixed would be sooooooo nice.

review: Approve (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Do you think it's better to have cascade instead of restricted, because with this change, we will have records missed when we delete BoMs.


review: Needs Information
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Sorry, I didn't see context of the cascade. Now I see that it makes sense, so I approve it.

IMHO a test for this is excessive, where we only have to set an attribute that it's not going to be missed again, but...


review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
Revision history for this message
Paul Catinean (wiz-keed) wrote :

Apologies, I have replied in the email client instead of writing comments here:

1st reply @rvalyi:

Glad to help out!

A local test showed no impact on a database that already had boms and mrp.subproducts created, automated tests would be more tedious instead of my isolated case though

2nd reply @pedro.baeza:

I kinda feel the same way to be honest since it's not a constraint that might be blocked by preexisting records.It will only affect delete statements after it has been placed on the table, and local tests show no problems

Up to you guys, cheers!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp_byproduct/'
2--- mrp_byproduct/ 2014-03-10 08:54:20 +0000
3+++ mrp_byproduct/ 2014-03-27 15:11:23 +0000
4@@ -35,7 +35,7 @@
5 'Fixed' depicts a situation where the quantity of created byproduct is always equal to the quantity set on the BoM, regardless of how many are created in the production order.\
6 By opposition, 'Variable' means that the quantity will be computed as\
7 '(quantity of byproduct set on the BoM / quantity of manufactured product set on the BoM * quantity of manufactured product in the production order.)'"),
8- 'bom_id': fields.many2one('', 'BoM'),
9+ 'bom_id': fields.many2one('', 'BoM', ondelete='cascade'),
10 }
11 _defaults={
12 'subproduct_type': 'variable',