Merge lp:~camptocamp/openerp-rma/7.0-crm_claim_rma_auto_set_warranty-rde into lp:~openerprma/openerp-rma/7.0

Proposed by Romain Deheele - Camptocamp
Status: Merged
Approved by: Leonardo Pistone
Approved revision: 81
Merged at revision: 80
Proposed branch: lp:~camptocamp/openerp-rma/7.0-crm_claim_rma_auto_set_warranty-rde
Merge into: lp:~openerprma/openerp-rma/7.0
Diff against target: 33 lines (+12/-0)
2 files modified
crm_claim_rma/crm_claim_rma.py (+9/-0)
crm_claim_rma/wizard/claim_make_picking.py (+3/-0)
To merge this branch: bzr merge lp:~camptocamp/openerp-rma/7.0-crm_claim_rma_auto_set_warranty-rde
Reviewer Review Type Date Requested Status
Lionel Sausin - Initiatives/Numérigraphe (community) code review, not test Approve
Leonardo Pistone code review Approve
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Benoit Guillot - http://www.akretion.com Approve
Review via email: mp+218666@code.launchpad.net

Description of the change

Hello,

It adds a _auto_set_warranty function.
For each claim line, if the user has not pressed himself on 'calculate warranty state', it sets warranties automatically for him.

Regards,

Romain

To post a comment you must log in.
Revision history for this message
Benoit Guillot - http://www.akretion.com (benoit-guillot-z) wrote :

Hello Romain,

I have tested it, it works fine.

Thank you!

One thing, we can maybe put the method _auto_set_warranty() in the model of claim lines and don't use it as a private method ?
=> def auto_set_warranty(self, cr, uid, ids, context):

So it can be call from somthing else (a button for instance).

I'm not sure it is useful but I share my thought :)

What do you think ?

review: Approve
80. By Romain Deheele - Camptocamp

[UPD] move auto_set_warranty method on claim.line model as suggested by Benoit Guillot

Revision history for this message
Romain Deheele - Camptocamp (romaindeheele) wrote :

Hi Benoit,

I'm 100% ok with you, I changed it.

Thanks for the suggestion.

Romain

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) :
review: Approve (code review, no tests)
Revision history for this message
Leonardo Pistone (lepistone) wrote :

ok, thanks

review: Approve (code review)
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Looks good from code point of view, not tested because I don't use this module.
Now for the nitpicking:
- multiline docstrings should have the short description on the first line, and the details in the following lines. This lets IDEs show the first line as a quick help.
- please don't initialize the context if you don't use it - it's ok to pass None to other methods.

review: Needs Fixing (nitpicking)
81. By Romain Deheele - Camptocamp

[UPD] commit nits

Revision history for this message
Romain Deheele - Camptocamp (romaindeheele) wrote :

Thanks Lionel, I updated it.

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) :
review: Approve (code review, not test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'crm_claim_rma/crm_claim_rma.py'
--- crm_claim_rma/crm_claim_rma.py 2014-04-23 07:07:52 +0000
+++ crm_claim_rma/crm_claim_rma.py 2014-05-16 12:29:24 +0000
@@ -254,6 +254,15 @@
254 context=context)254 context=context)
255 return True255 return True
256256
257 def auto_set_warranty(self, cr, uid, ids, context):
258 """ Set warranty automatically
259 if the user has not himself pressed on 'Calculate warranty state'
260 button, it sets warranty for him"""
261 for line in self.browse(cr, uid, ids, context=context):
262 if not line.warning:
263 self.set_warranty(cr, uid, [line.id], context=context)
264 return True
265
257 def get_destination_location(self, cr, uid, product_id,266 def get_destination_location(self, cr, uid, product_id,
258 warehouse_id, context=None):267 warehouse_id, context=None):
259 """Compute and return the destination location ID to take268 """Compute and return the destination location ID to take
260269
=== modified file 'crm_claim_rma/wizard/claim_make_picking.py'
--- crm_claim_rma/wizard/claim_make_picking.py 2014-04-08 19:41:50 +0000
+++ crm_claim_rma/wizard/claim_make_picking.py 2014-05-16 12:29:24 +0000
@@ -194,6 +194,9 @@
194 _('A product return cannot be created for various '194 _('A product return cannot be created for various '
195 'destination locations, please choose line with a '195 'destination locations, please choose line with a '
196 'same destination location.'))196 'same destination location.'))
197 self.pool.get('claim.line').auto_set_warranty(cr, uid,
198 line_ids,
199 context=context)
197 common_dest_partner_id = self._get_common_partner_from_line(200 common_dest_partner_id = self._get_common_partner_from_line(
198 cr, uid, line_ids, context=context)201 cr, uid, line_ids, context=context)
199 if not common_dest_partner_id:202 if not common_dest_partner_id:

Subscribers

People subscribed via source and target branches