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
1=== modified file 'crm_claim_rma/crm_claim_rma.py'
2--- crm_claim_rma/crm_claim_rma.py 2014-04-23 07:07:52 +0000
3+++ crm_claim_rma/crm_claim_rma.py 2014-05-16 12:29:24 +0000
4@@ -254,6 +254,15 @@
5 context=context)
6 return True
7
8+ def auto_set_warranty(self, cr, uid, ids, context):
9+ """ Set warranty automatically
10+ if the user has not himself pressed on 'Calculate warranty state'
11+ button, it sets warranty for him"""
12+ for line in self.browse(cr, uid, ids, context=context):
13+ if not line.warning:
14+ self.set_warranty(cr, uid, [line.id], context=context)
15+ return True
16+
17 def get_destination_location(self, cr, uid, product_id,
18 warehouse_id, context=None):
19 """Compute and return the destination location ID to take
20
21=== modified file 'crm_claim_rma/wizard/claim_make_picking.py'
22--- crm_claim_rma/wizard/claim_make_picking.py 2014-04-08 19:41:50 +0000
23+++ crm_claim_rma/wizard/claim_make_picking.py 2014-05-16 12:29:24 +0000
24@@ -194,6 +194,9 @@
25 _('A product return cannot be created for various '
26 'destination locations, please choose line with a '
27 'same destination location.'))
28+ self.pool.get('claim.line').auto_set_warranty(cr, uid,
29+ line_ids,
30+ context=context)
31 common_dest_partner_id = self._get_common_partner_from_line(
32 cr, uid, line_ids, context=context)
33 if not common_dest_partner_id:

Subscribers

People subscribed via source and target branches