Merge lp:~akretion-team/openerp-rma/rma-cleanup-cleanup-cleanup into lp:~openerprma/openerp-rma/7.0

Proposed by Alexis de Lattre
Status: Work in progress
Proposed branch: lp:~akretion-team/openerp-rma/rma-cleanup-cleanup-cleanup
Merge into: lp:~openerprma/openerp-rma/7.0
Diff against target: 1732 lines (+649/-428) (has conflicts)
20 files modified
crm_claim_rma/__openerp__.py (+4/-2)
crm_claim_rma/crm_claim_rma.py (+176/-44)
crm_claim_rma/crm_claim_rma_data.xml (+93/-101)
crm_claim_rma/crm_claim_rma_view.xml (+139/-114)
crm_claim_rma/security/ir.model.access.csv (+14/-7)
crm_claim_rma/security/rma_group.xml (+30/-0)
crm_claim_rma/stock_view.xml (+8/-4)
crm_claim_rma/wizard/claim_make_picking_view.xml (+8/-8)
crm_rma_advance_location/__openerp__.py (+3/-3)
crm_rma_advance_location/claim_rma_view.xml (+19/-17)
crm_rma_advance_location/stock.py (+1/-1)
crm_rma_advance_location/stock_view.xml (+2/-3)
crm_rma_advance_location/wizard/__init__.py (+2/-2)
crm_rma_advance_location/wizard/claim_make_picking.py (+38/-32)
crm_rma_advance_location/wizard/claim_make_picking_from_picking.py (+44/-42)
crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml (+15/-19)
crm_rma_advance_location/wizard/claim_make_picking_view.xml (+0/-3)
product_warranty/__openerp__.py (+1/-1)
product_warranty/product_warranty.py (+48/-19)
product_warranty/res_company_view.xml (+4/-6)
Text conflict in crm_claim_rma/crm_claim_rma.py
Text conflict in crm_claim_rma/crm_claim_rma_view.xml
Text conflict in crm_claim_rma/stock_view.xml
To merge this branch: bzr merge lp:~akretion-team/openerp-rma/rma-cleanup-cleanup-cleanup
Reviewer Review Type Date Requested Status
Romain Deheele - Camptocamp (community) code review, test Needs Fixing
Joël Grand-Guillaume @ camptocamp code review, no tests Needs Fixing
Review via email: mp+215970@code.launchpad.net

Description of the change

The main changes of this MPs are :

1) Create 2 groups for RMA : User and Manager (by default, RMAs i.e. crm.claim can be used by salesman... but do you know a company where RMAs are handled by salesman ??)

2) Clean-up presentation in copyright headers and update licence to AGPL when needed

3) Update views to v7.0 style

4) CLEAN UP CODE (and there is still A LOT to do in this area ! A LOT !). Remove dead code. I mean, this project, in the current state of the code, doesn't deserve to be an OCA project and doesn't meet the quality standards of OCA. This is just a start to try and clean a number of dirty stuff, but there is still a lot to do in this area. For example, a number of fields should be renamed, but this would have to be done in another merge proposal (I haven't changed any field name in this MP).

5) Small changes to prepare the arrival of the modules crm_claim_rma_repair, crm_claim_rma_serial and product_serial_warranty (will be part of another MP)

To post a comment you must log in.
72. By Alexandre Fayolle - camptocamp

[i18n] french translation typo

73. By alexis-via

[MERGE] lp:~akretion-team/openerp-rma/rma-cleanup-cleanup-cleanup

74. By Raphaël Valyi - http://www.akretion.com

[FIX] ensure security group is defined before being used

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Just adding a small comment to say that Raphaël Valyi discovered a bug when doing a "-u crm_claim_rma" with that branch (it breaks on the duplicate constraint). We started digging to find a solution, but we didn't had time to implement it yet.

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Thanks for improving the module. I may not have the time to read all carefully, just what I saw in a few minutes here:

 * L269 : For the method "_get_default_warehouse", I prefer to get the WH through the user because take one from get_object_reference with stock0 will never work in a multi company. Taking the first WH of the user's company seems better to me.

 * L910-1010 : Removing all link and button to access the related partner's document is a bit sad don't you think ? Our customer love that. But you may have move that somewhere else and I missed it ?

Regards,

Joël

review: Needs Fixing (code review, no tests)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

following the comment by Alexis on 23/04/2014 I'm setting this MP as "work in progress"

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

Hello Alexis,

I think that the duplicate constraint problem (sequence management) is solved with :
http://bazaar.launchpad.net/~openerprma/openerp-rma/7.0/revision/75 (merged yesterday)

Romain

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

on_change_invoice_id function uses company_id in parameters,
you need to add the field company_id in the crm.claim view "crm_case_claims_form_view".

Regards,

Romain

review: Needs Fixing (code review, test)
75. By Alexis de Lattre

Avoid double increment of RMA number

Unmerged revisions

75. By Alexis de Lattre

Avoid double increment of RMA number

74. By Raphaël Valyi - http://www.akretion.com

[FIX] ensure security group is defined before being used

73. By alexis-via

[MERGE] lp:~akretion-team/openerp-rma/rma-cleanup-cleanup-cleanup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'crm_claim_rma/__openerp__.py'
--- crm_claim_rma/__openerp__.py 2014-04-23 15:08:04 +0000
+++ crm_claim_rma/__openerp__.py 2015-11-20 10:22:38 +0000
@@ -75,9 +75,11 @@
75 'crm_claim',75 'crm_claim',
76 'product_warranty',76 'product_warranty',
77 ],77 ],
78 'data': ['wizard/claim_make_picking_view.xml',78 'data': [
79 'security/rma_group.xml',
80 'security/ir.model.access.csv',
81 'wizard/claim_make_picking_view.xml',
79 'crm_claim_rma_view.xml',82 'crm_claim_rma_view.xml',
80 'security/ir.model.access.csv',
81 'account_invoice_view.xml',83 'account_invoice_view.xml',
82 'stock_view.xml',84 'stock_view.xml',
83 'res_partner_view.xml',85 'res_partner_view.xml',
8486
=== modified file 'crm_claim_rma/crm_claim_rma.py'
--- crm_claim_rma/crm_claim_rma.py 2014-05-16 12:28:51 +0000
+++ crm_claim_rma/crm_claim_rma.py 2015-11-20 10:22:38 +0000
@@ -1,8 +1,8 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# Copyright 2013 Camptocamp4# Copyright 2013-2014 Camptocamp
5# Copyright 2009-2013 Akretion,5# Copyright 2009-2014 Akretion,
6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
7# Benoît Guillot, Joel Grand-Guillaume7# Benoît Guillot, Joel Grand-Guillaume
8#8#
@@ -21,9 +21,13 @@
21#21#
22##############################################################################22##############################################################################
2323
24<<<<<<< TREE
24import calendar25import calendar
25import math26import math
26from openerp.osv import fields, orm, osv27from openerp.osv import fields, orm, osv
28=======
29from openerp.osv import fields, orm
30>>>>>>> MERGE-SOURCE
27from datetime import datetime31from datetime import datetime
28from dateutil.relativedelta import relativedelta32from dateutil.relativedelta import relativedelta
29from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,33from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,
@@ -37,7 +41,7 @@
37 _name = "substate.substate"41 _name = "substate.substate"
38 _description = "substate that precise a given state"42 _description = "substate that precise a given state"
39 _columns = {43 _columns = {
40 'name': fields.char('Sub state', required=True),44 'name': fields.char('Sub State', required=True),
41 'substate_descr': fields.text(45 'substate_descr': fields.text(
42 'Description',46 'Description',
43 help="To give more information about the sub state"),47 help="To give more information about the sub state"),
@@ -51,11 +55,41 @@
51 _name = "claim.line"55 _name = "claim.line"
52 _description = "List of product to return"56 _description = "List of product to return"
5357
54 # Comment written in a claim.line to know about the warranty status58 def prodlot_id_change(
55 WARRANT_COMMENT = {59 self, cr, uid, ids, prodlot_id, company_id, warehouse_id,
56 'valid': "Valid",60 context=None):
57 'expired': "Expired",61 res = {'value': {}}
58 'not_define': "Not Defined"}62 if prodlot_id:
63 prodlot = self.pool['stock.production.lot'].browse(
64 cr, uid, prodlot_id, context=context)
65 return_address_id, return_type = \
66 self.pool['crm.claim']._get_return_info_from_product(
67 cr, uid, prodlot.product_id, company_id,
68 context=context)
69
70 res['value'].update({
71 'product_id': prodlot.product_id.id,
72 'product_returned_quantity': 1,
73 'return_address_id': return_address_id,
74 'return_type': return_type,
75 })
76 else:
77 res['value'].update({
78 'product_id': False,
79 'product_returned_quantity': 0,
80 'return_address_id': False,
81 'return_type': False,
82 })
83 return res
84
85 def product_id_change(
86 self, cr, uid, ids, product_id, company_id, context=None):
87 res = {'domain': {}}
88 if product_id:
89 res['domain']['prodlot_id'] = "[('product_id', '=', product_id)]"
90 else:
91 res['domain']['prodlot_id'] = "[]"
92 return res
5993
60 # Method to calculate total amount of the line : qty*UP94 # Method to calculate total amount of the line : qty*UP
61 def _line_total_amount(self, cr, uid, ids, field_name, arg, context=None):95 def _line_total_amount(self, cr, uid, ids, field_name, arg, context=None):
@@ -118,8 +152,8 @@
118 help="Quantity returned * Unit sold price",),152 help="Quantity returned * Unit sold price",),
119 'prodlot_id': fields.many2one(153 'prodlot_id': fields.many2one(
120 'stock.production.lot',154 'stock.production.lot',
121 string='Serial/Lot n°',155 string='Serial Number',
122 help="The serial/lot of the returned product"),156 help="The serial number of the returned product"),
123 'applicable_guarantee': fields.selection(157 'applicable_guarantee': fields.selection(
124 [('us', 'Company'),158 [('us', 'Company'),
125 ('supplier', 'Supplier'),159 ('supplier', 'Supplier'),
@@ -127,16 +161,18 @@
127 'Warranty type'),161 'Warranty type'),
128 'guarantee_limit': fields.date(162 'guarantee_limit': fields.date(
129 'Warranty limit',163 'Warranty limit',
130 readonly=True,
131 help="The warranty limit is computed as: invoice date + warranty "164 help="The warranty limit is computed as: invoice date + warranty "
132 "defined on selected product."),165 "defined on selected product."),
133 'warning': fields.char(166 'warning': fields.selection([
134 'Warranty',167 ('valid', "Valid"),
135 readonly=True,168 ('expired', "Expired"),
169 ('not_define', "Not Defined"),
170 ], 'Warranty',
136 help="If warranty has expired"),171 help="If warranty has expired"),
137 'warranty_type': fields.selection(172 'warranty_type': fields.selection(
138 get_warranty_return_partner,173 get_warranty_return_partner,
139 'Warranty type',174 'Warranty type',
175<<<<<<< TREE
140 readonly=True,176 readonly=True,
141 help="Who is in charge of the warranty return treatment towards "177 help="Who is in charge of the warranty return treatment towards "
142 "the end customer. Company will use the current company "178 "the end customer. Company will use the current company "
@@ -145,13 +181,28 @@
145 "to be applied is the one of the return partner (ie: can be "181 "to be applied is the one of the return partner (ie: can be "
146 "returned to the company and be under the brand warranty"),182 "returned to the company and be under the brand warranty"),
147 'warranty_return_partner': fields.many2one(183 'warranty_return_partner': fields.many2one(
184=======
185 help="Who is in charge of the warranty return treatment towards the end customer. "
186 "Company will use the current company delivery or default address and so on for "
187 "supplier and brand manufacturer. Does not necessarily mean that the warranty to be "
188 "applied is the one of the return partner (ie: can be returned to the company and "
189 "be under the brand warranty"),
190 "warranty_return_partner" : fields.many2one(
191>>>>>>> MERGE-SOURCE
148 'res.partner',192 'res.partner',
149 string='Warranty Address',193 string='Warranty Address',
150 help="Where the customer has to send back the product(s)"),194 help="Where the customer has to send back the product(s)"),
151 'claim_id': fields.many2one(195 'claim_id': fields.many2one(
152 'crm.claim', string='Related claim',196 'crm.claim', string='Related claim',
153 help="To link to the case.claim object"),197 help="To link to the case.claim object"),
198<<<<<<< TREE
154 'state': fields.selection(199 'state': fields.selection(
200=======
201 'company_id': fields.related(
202 'claim_id', 'company_id', type="many2one",
203 relation="res.company", string="Company"),
204 'state' : fields.selection(
205>>>>>>> MERGE-SOURCE
155 [('draft', 'Draft'),206 [('draft', 'Draft'),
156 ('refused', 'Refused'),207 ('refused', 'Refused'),
157 ('confirmed', 'Confirmed, waiting for product'),208 ('confirmed', 'Confirmed, waiting for product'),
@@ -196,6 +247,7 @@
196 'name': 'none',247 'name': 'none',
197 }248 }
198249
250<<<<<<< TREE
199 @staticmethod251 @staticmethod
200 def warranty_limit(start, warranty_duration):252 def warranty_limit(start, warranty_duration):
201 """ Take a duration in float, return the duration in relativedelta253 """ Take a duration in float, return the duration in relativedelta
@@ -263,6 +315,8 @@
263 self.set_warranty(cr, uid, [line.id], context=context)315 self.set_warranty(cr, uid, [line.id], context=context)
264 return True316 return True
265317
318=======
319>>>>>>> MERGE-SOURCE
266 def get_destination_location(self, cr, uid, product_id,320 def get_destination_location(self, cr, uid, product_id,
267 warehouse_id, context=None):321 warehouse_id, context=None):
268 """Compute and return the destination location ID to take322 """Compute and return the destination location ID to take
@@ -281,6 +335,7 @@
281 location_dest_id = seller.name.property_stock_supplier.id335 location_dest_id = seller.name.property_stock_supplier.id
282 return location_dest_id336 return location_dest_id
283337
338<<<<<<< TREE
284 # Method to calculate warranty return address339 # Method to calculate warranty return address
285 def set_warranty_return_address(self, cr, uid, ids, claim_line,340 def set_warranty_return_address(self, cr, uid, ids, claim_line,
286 context=None):341 context=None):
@@ -330,40 +385,35 @@
330 claim_line, context=context)385 claim_line, context=context)
331 return True386 return True
332387
388=======
389>>>>>>> MERGE-SOURCE
333390
334#TODO add the option to split the claim_line in order to manage the same391#TODO add the option to split the claim_line in order to manage the same
335# product separately392# product separately
336class crm_claim(orm.Model):393class crm_claim(orm.Model):
337 _inherit = 'crm.claim'394 _inherit = 'crm.claim'
338395 _order = 'number desc'
339 def _get_sequence_number(self, cr, uid, context=None):
340 seq_obj = self.pool.get('ir.sequence')
341 res = seq_obj.get(cr, uid, 'crm.claim.rma', context=context) or '/'
342 return res
343396
344 def _get_default_warehouse(self, cr, uid, context=None):397 def _get_default_warehouse(self, cr, uid, context=None):
345 user_obj = self.pool.get('res.users')398 warehouse_model, warehouse_id = self.pool['ir.model.data'].\
346 user = user_obj.browse(cr, uid, uid, context=context)399 get_object_reference(cr, uid, 'stock', 'warehouse0')
347 company_id = user.company_id.id400 assert warehouse_model == 'stock.warehouse', 'Wrong model !'
348 wh_obj = self.pool.get('stock.warehouse')401 return warehouse_id
349 wh_ids = wh_obj.search(cr, uid,
350 [('company_id', '=', company_id)],
351 context=context)
352 if not wh_ids:
353 raise orm.except_orm(
354 _('Error!'),
355 _('There is no warehouse for the current user\'s company.'))
356 return wh_ids[0]
357402
358 def name_get(self, cr, uid, ids, context=None):403 def name_get(self, cr, uid, ids, context=None):
359 res = []404 res = []
360 if isinstance(ids, (int, long)):405 if isinstance(ids, (int, long)):
361 ids = [ids]406 ids = [ids]
362 for claim in self.browse(cr, uid, ids, context=context):407 for claim in self.browse(cr, uid, ids, context=context):
408<<<<<<< TREE
363 number = claim.number and str(claim.number) or ''409 number = claim.number and str(claim.number) or ''
364 res.append((claim.id, '[' + number + '] ' + claim.name))410 res.append((claim.id, '[' + number + '] ' + claim.name))
411=======
412 res.append((claim.id, '[%s] %s' % (claim.number, claim.name)))
413>>>>>>> MERGE-SOURCE
365 return res414 return res
366415
416<<<<<<< TREE
367 def create(self, cr, uid, vals, context=None):417 def create(self, cr, uid, vals, context=None):
368 if ('number' not in vals) or (vals.get('number') == '/'):418 if ('number' not in vals) or (vals.get('number') == '/'):
369 vals['number'] = self._get_sequence_number(cr, uid,419 vals['number'] = self._get_sequence_number(cr, uid,
@@ -372,22 +422,22 @@
372 return new_id422 return new_id
373423
374 def copy_data(self, cr, uid, id, default=None, context=None):424 def copy_data(self, cr, uid, id, default=None, context=None):
425=======
426 def copy(self, cr, uid, id, default=None, context=None):
427>>>>>>> MERGE-SOURCE
375 if default is None:428 if default is None:
376 default = {}429 default = {}
377 std_default = {430 default.update({
378 'invoice_ids': False,431 'invoice_ids': False,
379 'picking_ids': False,432 'picking_ids': False,
380 'number': self._get_sequence_number(cr, uid, context=context),433 'number': self.pool['ir.sequence'].get(cr, uid, 'crm.claim.rma'),
381 }434 })
382 std_default.update(default)435 return super(crm_claim, self).copy(
383 return super(crm_claim, self).copy_data(436 cr, uid, id, default=default, context=context)
384 cr, uid, id, default=std_default, context=context)
385437
386 _columns = {438 _columns = {
387 'number': fields.char(439 'number': fields.char(
388 'Number', readonly=True,440 'Number', readonly=True,
389 states={'draft': [('readonly', False)]},
390 required=True,
391 select=True,441 select=True,
392 help="Company internal claim unique number"),442 help="Company internal claim unique number"),
393 'claim_type': fields.selection(443 'claim_type': fields.selection(
@@ -396,6 +446,7 @@
396 ('other', 'Other')],446 ('other', 'Other')],
397 string='Claim type',447 string='Claim type',
398 required=True,448 required=True,
449 track_visibility='onchange',
399 help="Customer: from customer to company.\n "450 help="Customer: from customer to company.\n "
400 "Supplier: from company to supplier."),451 "Supplier: from company to supplier."),
401 'claim_line_ids': fields.one2many(452 'claim_line_ids': fields.one2many(
@@ -409,19 +460,23 @@
409 'account.invoice', 'claim_id', 'Refunds'),460 'account.invoice', 'claim_id', 'Refunds'),
410 'picking_ids': fields.one2many('stock.picking', 'claim_id', 'RMA'),461 'picking_ids': fields.one2many('stock.picking', 'claim_id', 'RMA'),
411 'invoice_id': fields.many2one(462 'invoice_id': fields.many2one(
463<<<<<<< TREE
412 'account.invoice', string='Invoice',464 'account.invoice', string='Invoice',
413 help='Related original Cusotmer invoice'),465 help='Related original Cusotmer invoice'),
414 'delivery_address_id': fields.many2one(466 'delivery_address_id': fields.many2one(
415 'res.partner', string='Partner delivery address',467 'res.partner', string='Partner delivery address',
416 help="This address will be used to deliver repaired or replacement"468 help="This address will be used to deliver repaired or replacement"
417 "products."),469 "products."),
470=======
471 'account.invoice', string='Customer Invoice',
472 help='Related original Customer invoice'),
473>>>>>>> MERGE-SOURCE
418 'warehouse_id': fields.many2one(474 'warehouse_id': fields.many2one(
419 'stock.warehouse', string='Warehouse',475 'stock.warehouse', string='Warehouse',
420 required=True),476 required=True),
421 }477 }
422478
423 _defaults = {479 _defaults = {
424 'number': '/',
425 'claim_type': 'customer',480 'claim_type': 'customer',
426 'warehouse_id': _get_default_warehouse,481 'warehouse_id': _get_default_warehouse,
427 }482 }
@@ -431,11 +486,44 @@
431 'Number/Reference must be unique per Company!'),486 'Number/Reference must be unique per Company!'),
432 ]487 ]
433488
489<<<<<<< TREE
434 def onchange_partner_address_id(self, cr, uid, ids, add, email=False,490 def onchange_partner_address_id(self, cr, uid, ids, add, email=False,
435 context=None):491 context=None):
436 res = super(crm_claim, self492 res = super(crm_claim, self
437 ).onchange_partner_address_id(cr, uid, ids, add,493 ).onchange_partner_address_id(cr, uid, ids, add,
438 email=email)494 email=email)
495=======
496 def create(self, cr, uid, vals, context=None):
497 if not vals:
498 vals = {}
499 if not vals.get('number'):
500 vals['number'] = self.pool['ir.sequence'].next_by_code(
501 cr, uid, 'crm.claim.rma')
502 return super(crm_claim, self).create(cr, uid, vals, context=context)
503
504 def _get_return_info_from_product(
505 self, cr, uid, product, company_id, context=None):
506 seller = product.seller_info_id
507 if seller:
508 return_address_id = seller.warranty_return_address.id
509 return_type = seller.warranty_return_partner
510 else:
511 # when no supplier is configured, get the info from the company
512 if not company_id:
513 company_id = self.pool['res.company']._company_default_get(
514 cr, uid, 'claim.line', context=context)
515 company = self.pool['res.company'].browse(
516 cr, uid, company_id, context=context)
517 return_address_id = (company.crm_return_address_id.id or
518 company.partner_id.id)
519 return_type = 'company'
520 return (return_address_id, return_type)
521
522 def onchange_partner_address_id(
523 self, cr, uid, ids, add, email=False, context=None):
524 res = super(crm_claim, self).onchange_partner_address_id(
525 cr, uid, ids, add, email=email)
526>>>>>>> MERGE-SOURCE
439 if add:527 if add:
440 if (not res['value']['email_from']528 if (not res['value']['email_from']
441 or not res['value']['partner_phone']):529 or not res['value']['partner_phone']):
@@ -448,26 +536,66 @@
448 res['value']['partner_phone'] = other_add.phone536 res['value']['partner_phone'] = other_add.phone
449 return res537 return res
450538
539<<<<<<< TREE
451 def onchange_invoice_id(self, cr, uid, ids, invoice_id, warehouse_id,540 def onchange_invoice_id(self, cr, uid, ids, invoice_id, warehouse_id,
452 context=None):541 context=None):
542=======
543 def onchange_invoice_id(
544 self, cr, uid, ids, invoice_id, warehouse_id, claim_date,
545 company_id, context=None):
546>>>>>>> MERGE-SOURCE
453 invoice_line_obj = self.pool.get('account.invoice.line')547 invoice_line_obj = self.pool.get('account.invoice.line')
454 invoice_obj = self.pool.get('account.invoice')548 invoice_obj = self.pool.get('account.invoice')
455 claim_line_obj = self.pool.get('claim.line')549 claim_line_obj = self.pool.get('claim.line')
456 invoice_line_ids = invoice_line_obj.search(550 if not invoice_id:
457 cr, uid,551 return {}
458 [('invoice_id', '=', invoice_id)],552 invoice = self.pool['account.invoice'].browse(
459 context=context)553 cr, uid, invoice_id, context=context)
554
555 if not invoice.date_invoice:
556 raise orm.except_orm(
557 _('Error'),
558 _("The invoice %s doesn't have a date. "
559 "Must be a validated invoice." % invoice.number))
560 date_inv_dt = datetime.strptime(
561 invoice.date_invoice, DEFAULT_SERVER_DATE_FORMAT)
562
460 claim_lines = []563 claim_lines = []
461 value = {}564 value = {}
462 if not warehouse_id:565 if not warehouse_id:
566<<<<<<< TREE
463 warehouse_id = self._get_default_warehouse(cr, uid,567 warehouse_id = self._get_default_warehouse(cr, uid,
464 context=context)568 context=context)
465 invoice_lines = invoice_line_obj.browse(cr, uid, invoice_line_ids,569 invoice_lines = invoice_line_obj.browse(cr, uid, invoice_line_ids,
466 context=context)570 context=context)
467 for invoice_line in invoice_lines:571 for invoice_line in invoice_lines:
572=======
573 warehouse_id = self._get_default_warehouse(
574 cr, uid, context=context)
575
576 for invoice_line in invoice.invoice_line:
577>>>>>>> MERGE-SOURCE
468 location_dest_id = claim_line_obj.get_destination_location(578 location_dest_id = claim_line_obj.get_destination_location(
469 cr, uid, invoice_line.product_id.id,579 cr, uid, invoice_line.product_id.id,
470 warehouse_id, context=context)580 warehouse_id, context=context)
581
582 warning = 'not_define'
583 warranty_duration = invoice_line.product_id.warranty
584 limit = self.pool['product.product'].warranty_limit(
585 cr, uid, date_inv_dt, warranty_duration, context=context)
586 # If warranty period was defined
587 if warranty_duration > 0:
588 claim_date_dt = datetime.strptime(
589 claim_date, DEFAULT_SERVER_DATETIME_FORMAT)
590 if limit < claim_date_dt:
591 warning = 'expired'
592 else:
593 warning = 'valid'
594
595 return_address_id, return_type = \
596 self._get_return_info_from_product(
597 cr, uid, product, company_id, context=context)
598
471 claim_lines.append({599 claim_lines.append({
472 'name': invoice_line.name,600 'name': invoice_line.name,
473 'claim_origine': "none",601 'claim_origine': "none",
@@ -477,6 +605,10 @@
477 'unit_sale_price': invoice_line.price_unit,605 'unit_sale_price': invoice_line.price_unit,
478 'location_dest_id': location_dest_id,606 'location_dest_id': location_dest_id,
479 'state': 'draft',607 'state': 'draft',
608 'warranty_return_partner': return_address_id,
609 'warranty_type': return_type,
610 'guarantee_limit': limit.strftime(DEFAULT_SERVER_DATE_FORMAT),
611 'warning': warning,
480 })612 })
481 value = {'claim_line_ids': claim_lines}613 value = {'claim_line_ids': claim_lines}
482 delivery_address_id = False614 delivery_address_id = False
483615
=== modified file 'crm_claim_rma/crm_claim_rma_data.xml'
--- crm_claim_rma/crm_claim_rma_data.xml 2013-04-30 19:15:31 +0000
+++ crm_claim_rma/crm_claim_rma_data.xml 2015-11-20 10:22:38 +0000
@@ -1,104 +1,96 @@
1<?xml version="1.0"?>1<?xml version="1.0"?>
2<openerp>2<openerp>
3 <data noupdate="1">3<data noupdate="1">
4 <!-- Claims Sequence n° -->4
5 <record id="seq_type_claim" model="ir.sequence.type">5<!-- Claims Sequence n° -->
6 <field name="name">CRM Claim</field>6<record id="seq_type_claim" model="ir.sequence.type">
7 <field name="code">crm.claim.rma</field>7 <field name="name">CRM Claim</field>
8 </record>8 <field name="code">crm.claim.rma</field>
99</record>
10 <record id="seq_claim" model="ir.sequence">10
11 <field name="name">CRM Claim</field>11<record id="seq_claim" model="ir.sequence">
12 <field name="code">crm.claim.rma</field>12 <field name="name">CRM Claim</field>
13 <field eval="5" name="padding"/>13 <field name="code">crm.claim.rma</field>
14 <field name="prefix">RMA-%(year)s/</field>14 <field name="padding" eval="5"/>
15 </record>15 <field name="prefix">RMA-%(year)s/</field>
16 16</record>
17 <!--17
18 Claim sections18<!-- Claim sections -->
19 -->19
20 20<record model="crm.case.section" id="section_after_sales_service">
21 <record model="crm.case.section" id="section_after_sales_service">21 <field name="name">After Sales Service</field>
22 <field name="name">After Sales Service</field>22 <field name="code">ASV</field>
23 <field name="code">ASV</field>23 <field name="parent_id" ref="crm.section_sales_department"/>
24 <field name="parent_id" ref="crm.section_sales_department"/>24</record>
25 <!-- <field name="stage_ids" eval="[(4, ref('crm_claim.stage_claim1')), (4, ref('crm_claim.stage_claim2')), (4, ref('crm_claim.stage_claim3')), (4, ref('crm_claim.stage_claim5'))]"/> -->25
26 </record>26<!-- Claim categories -->
27 27
28 <!--28<record model="crm.case.categ" id="categ_claim10">
29 Claim categories29 <field name="name">No Inventory</field>
30 -->30 <field name="section_id" ref="section_after_sales_service"/>
31 31 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
32 <record model="crm.case.categ" id="categ_claim10">32</record>
33 <field name="name">No Inventory</field>33
34 <field name="section_id" ref="section_after_sales_service"/>34<record model="crm.case.categ" id="categ_claim11">
35 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 35 <field name="name">Customer Return</field>
36 </record>36 <field name="section_id" ref="section_after_sales_service"/>
37 37 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
38 <record model="crm.case.categ" id="categ_claim11">38</record>
39 <field name="name">Customer Return</field>39
40 <field name="section_id" ref="section_after_sales_service"/>40<record model="crm.case.categ" id="categ_claim12">
41 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 41 <field name="name">Cancelled by Customer</field>
42 </record>42 <field name="section_id" ref="section_after_sales_service"/>
43 43 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
44 <record model="crm.case.categ" id="categ_claim12">44</record>
45 <field name="name">Buyer Cancelled</field>45
46 <field name="section_id" ref="section_after_sales_service"/>46<record model="crm.case.categ" id="categ_claim13">
47 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 47 <field name="name">General Adjustement</field>
48 </record>48 <field name="section_id" ref="section_after_sales_service"/>
49 49 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
50 <record model="crm.case.categ" id="categ_claim13">50</record>
51 <field name="name">General Adjustement</field>51
52 <field name="section_id" ref="section_after_sales_service"/>52<record model="crm.case.categ" id="categ_claim14">
53 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 53 <field name="name">Could Not Ship</field>
54 </record>54 <field name="section_id" ref="section_after_sales_service"/>
55 55 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
56 <record model="crm.case.categ" id="categ_claim14">56</record>
57 <field name="name">Could Not Ship</field>57
58 <field name="section_id" ref="section_after_sales_service"/>58<record model="crm.case.categ" id="categ_claim15">
59 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 59 <field name="name">Different Item</field>
60 </record>60 <field name="section_id" ref="section_after_sales_service"/>
61 61 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
62 <record model="crm.case.categ" id="categ_claim15">62</record>
63 <field name="name">Different Item</field>63
64 <field name="section_id" ref="section_after_sales_service"/>64<record model="crm.case.categ" id="categ_claim16">
65 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 65 <field name="name">Merchandise Not Received</field>
66 </record>66 <field name="section_id" ref="section_after_sales_service"/>
67 67 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
68 <record model="crm.case.categ" id="categ_claim16">68</record>
69 <field name="name">Merchandise Not Received</field>69
70 <field name="section_id" ref="section_after_sales_service"/>70<record model="crm.case.categ" id="categ_claim17">
71 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 71 <field name="name">Merchandise Not As Described</field>
72 </record>72 <field name="section_id" ref="section_after_sales_service"/>
73 73 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
74 <record model="crm.case.categ" id="categ_claim17">74</record>
75 <field name="name">Merchandise Not As Described</field>75
76 <field name="section_id" ref="section_after_sales_service"/>76<record model="crm.case.categ" id="categ_claim18">
77 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 77 <field name="name">Price Error</field>
78 </record>78 <field name="section_id" ref="section_after_sales_service"/>
79 79 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
80 <record model="crm.case.categ" id="categ_claim18">80</record>
81 <field name="name">Pricing Error</field>81
82 <field name="section_id" ref="section_after_sales_service"/>82<record model="crm.case.categ" id="categ_claim19">
83 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 83 <field name="name">Shipping Address Undeliverable</field>
84 </record>84 <field name="section_id" ref="section_after_sales_service"/>
85 85 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
86 <record model="crm.case.categ" id="categ_claim19">86</record>
87 <field name="name">Shipping Address Undeliverable</field>87
88 <field name="section_id" ref="section_after_sales_service"/>88<record model="crm.case.categ" id="categ_claim20">
89 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 89 <field name="name">Delivered Late by Carrier</field>
90 </record>90 <field name="section_id" ref="section_after_sales_service"/>
91 91 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
92 <record model="crm.case.categ" id="categ_claim20">92</record>
93 <field name="name">Delivered Late by Carrier</field>93
94 <field name="section_id" ref="section_after_sales_service"/>94
95 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/> 95</data>
96 </record>
97
98 <record model="crm.case.categ" id="categ_claim21">
99 <field name="name">Missed Fulfilment Promise</field>
100 <field name="section_id" ref="section_after_sales_service"/>
101 <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
102 </record>
103 </data>
104</openerp>96</openerp>
10597
=== modified file 'crm_claim_rma/crm_claim_rma_view.xml'
--- crm_claim_rma/crm_claim_rma_view.xml 2014-04-23 07:07:52 +0000
+++ crm_claim_rma/crm_claim_rma_view.xml 2015-11-20 10:22:38 +0000
@@ -7,42 +7,29 @@
7 <field name="name">CRM - Claims Search</field>7 <field name="name">CRM - Claims Search</field>
8 <field name="model">claim.line</field>8 <field name="model">claim.line</field>
9 <field name="arch" type="xml">9 <field name="arch" type="xml">
10 <search string="Search Claims">10 <search string="Search Return Lines">
11 <filter icon="terp-check" string="Current" name="current"11 <filter string="Current" name="current"
12 domain="[('state','in',('draft', 'refused', 'treated'))]"12 domain="[('state', 'in', ('draft', 'refused', 'treated'))]"
13 separator="1" help="Draft and Open Claims" />13 help="Draft and Open Return Lines" />
14 <filter icon="terp-camera_test"14 <filter string="In Progress" name="in_progress"
15 string="In Progress"15 domain="[('state', 'in', ('confirmed', 'in_to_control', 'in_to_treate'))]"
16 domain="[('state','in',('confirmed','in_to_control','in_to_treate'))]"16 help="Return Lines In Progress"/>
17 separator="1" help="In Progress Claims"/>17 <field name="state"/>
18 <separator orientation="vertical"/>18 <field name="substate_id"/>
19 <field name="state" select='1'/>19 <field name="name"/>
20 <field name="substate_id" select='1'/>20 <field name="warning"/>
21 <field name="name" select='1'/>21 <field name="invoice_line_id"/>
22 <field name="warning" select='1'/>22 <field name="product_id"/>
23 <field name="invoice_line_id" select='1'/>23 <field name="prodlot_id"/>
24 <field name="product_id" select='1'/>24 <group string="Group By..." name="group_by">
25 <field name="prodlot_id" select='1'/>25 <filter string="Invoice"
26 <newline/>
27 <group expand="0" string="More">
28 <field name="last_state_change" select='1'/>
29 <field name="guarantee_limit" select='1'/>
30 <field name="return_value" select='1'/>
31 <field name="name" select='1'/>
32 </group>
33 <newline/>
34 <group expand="0" string="Group By...">
35 <filter string="Invoice" icon="terp-dolar"
36 domain="[]" help="Invoice"
37 context="{'group_by':'invoice_id'}" />26 context="{'group_by':'invoice_id'}" />
38 <filter string="Product" icon="terp-product"27 <filter string="Product"
39 domain="[]" help="Product"
40 context="{'group_by':'product_id'}" />28 context="{'group_by':'product_id'}" />
41 <separator orientation="vertical"/>29 <filter string="Substate"
42 <filter string="Substate" icon="terp-stage"30 context="{'group_by':'substate_id'}" />
43 domain="[]" context="{'group_by':'substate_id'}" />31 <filter string="Claim n°"
44 <filter string="Claim n°" icon="terp-emblem-documents"32 context="{'group_by':'claim_id'}" />
45 domain="[]" context="{'group_by':'claim_id'}" />
46 </group>33 </group>
47 </search>34 </search>
48 </field>35 </field>
@@ -54,16 +41,15 @@
54 <field name="model">claim.line</field>41 <field name="model">claim.line</field>
55 <field name="arch" type="xml">42 <field name="arch" type="xml">
56 <tree string="Returned lines">43 <tree string="Returned lines">
57 <field name="claim_id" invisible="1"/>44 <field name="claim_id" invisible="not context.get('claim_line_main_view')"/>
58 <field name="state"/>45 <field name="state"/>
59 <field name="substate_id"/>46 <field name="substate_id"/>
60 <field name="product_id"/>47 <field name="product_id"/>
61 <field name="name"/>48 <field name="name"/>
62 <field name="prodlot_id"/>49 <field name="prodlot_id"/>
63 <field name="warning"/> 50 <field name="warning"/>
64 <field name="warranty_type"/> 51 <field name="warranty_type"/>
65 <field name="warranty_return_partner"/> 52 <field name="warranty_return_partner"/>
66 <button name="set_warranty" string="Compute Waranty" type="object" icon="gtk-justify-fill"/>
67 <field name="product_returned_quantity"/>53 <field name="product_returned_quantity"/>
68 <field name="claim_origine"/>54 <field name="claim_origine"/>
69 <field name="refund_line_id"/>55 <field name="refund_line_id"/>
@@ -79,52 +65,50 @@
79 <field name="model">claim.line</field>65 <field name="model">claim.line</field>
80 <field name="arch" type="xml">66 <field name="arch" type="xml">
81 <form string="Claim Line" version="7.0">67 <form string="Claim Line" version="7.0">
82 <header>68 <sheet string="Claims">
83 <button name="set_warranty" string="Calculate warranty state" type="object" class="oe_highlight"/>69 <div class="oe_title">
84 </header>
85 <sheet string="Claims">
86 <div class="oe_title">
87 <group>70 <group>
88 <label for="name" class="oe_edit_only"/>71 <label for="name" class="oe_edit_only"/>
89 <h1><field name="name"/></h1>72 <h1><field name="name"/></h1>
90 </group>73 </group>
91 </div>74 </div>
92 <group>75 <group>
93 <group string="Returned good">76 <group string="Returned good">
94 <field name="product_returned_quantity"/>77 <field name="product_returned_quantity"/>
95 <field name="product_id"/> 78 <field name="product_id" on_change="product_id_change(product_id, company_id, context)"/>
96 <field name="prodlot_id"/>79 <field name="prodlot_id" on_change="prodlot_id_change(prodlot_id, company_id, parent.warehouse_id, context)"/>
97 <field name="unit_sale_price"/>80 <field name="unit_sale_price"/>
98 <field name="return_value"/>81 <field name="return_value"/>
99 </group>82 </group>
100 <group string="Linked Document">83 <group string="Linked Document">
101 <field name="claim_id" />84 <field name="claim_id" invisible="not context.get('claim_line_main_view')"/>
102 <field name="invoice_line_id"/>85 <field name="company_id" groups="base.group_multi_company"/>
103 <field name="refund_line_id"/>86 <field name="invoice_line_id"/>
104 <field name="move_in_id"/>87 <field name="refund_line_id"/>
105 <field name="move_out_id"/>88 <field name="move_in_id"/>
106 </group>89 <field name="move_out_id"/>
107 </group>90 </group>
108 <group>91 </group>
109 <group string="Problem">92 <group>
110 <field name="claim_origine" nolabel="1" colspan="4"/>93 <group string="Problem">
111 <field name="claim_descr" nolabel="1" colspan="4"/>94 <field name="claim_origine" nolabel="1" colspan="2"/>
112 </group>95 <field name="claim_descr" nolabel="1" colspan="2"/>
113 <group string="Warranty">96 </group>
114 <field name="guarantee_limit"/>97 <group string="Warranty">
115 <field name="warning"/>98 <field name="guarantee_limit"/>
116 <field name="warranty_return_partner"/>99 <field name="warning"/>
117 <field name="warranty_type"/>100 <field name="warranty_return_partner"/>
118 </group>101 <field name="warranty_type"/>
119 </group>102 </group>
120 <separator string="State" colspan="4"/>103 <group name="state" string="State">
121 <group col="6" colspan="4">104 <field name="state"/>
122 <field name="state"/>105 <field name="substate_id" widget="selection" />
123 <field name="substate_id" widget='selection' />106 <field name="location_dest_id"/>
124 <field name="last_state_change"/>107 <field name="last_state_change"/>
125 </group>108 </group>
126 </sheet>109 </group>
127 </form>110 </sheet>
111 </form>
128 </field>112 </field>
129 </record>113 </record>
130114
@@ -140,41 +124,48 @@
140 </field>124 </field>
141 <field name="name" position="before">125 <field name="name" position="before">
142 <field name="number" />126 <field name="number" />
127 <field name="claim_type" />
143 </field>128 </field>
144 </field>129 </field>
145 </record>130 </record>
146131
147 <record model="ir.ui.view" id="crm_case_claims_form_view_replace">132 <record id="crm_case_claims_form_view" model="ir.ui.view">
148 <field name="name">CRM - Claims Form</field>133 <field name="name">CRM RMA - Claims Form</field>
149 <field name="model">crm.claim</field>
150 <field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
151 <field name="arch" type="xml">
152 <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]" position="replace">
153 <field name="categ_id" />
154 </field>
155 </field>
156 </record>
157
158 <record model="ir.ui.view" id="crm_claim_rma_form_view">
159 <field name="name">CRM - Claim product return Form</field>
160 <field name="model">crm.claim</field>134 <field name="model">crm.claim</field>
161 <field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>135 <field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
162 <field name="arch" type="xml">136 <field name="arch" type="xml">
163 <page string="Follow Up" position="before">137 <xpath expr="//sheet/group" position="before">
138 <group name="number">
139 <div class="oe_title">
140 <label for="number" class="oe_edit_only"/>
141 <h1><field name="number"/></h1>
142 </div>
143 </group>
144 </xpath>
145 <field name="date_deadline" position="after">
146 <field name="claim_type"/>
147 <field name="warehouse_id" />
148 </field>
149 <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]" position="replace">
150 <field name="categ_id" />
151 </field>
152 <notebook position="inside">
164 <page string="Product Return">153 <page string="Product Return">
165 <group name="Product Return">154 <group name="Product Return" string="Product Returns">
166 <separator string="Product Return" colspan="4"/>
167 <group>155 <group>
156<<<<<<< TREE
168 <field name="invoice_id" on_change="onchange_invoice_id(invoice_id,warehouse_id,context)" domain="['|',('commercial_partner_id','=',partner_id),('partner_id','=',partner_id)]" />157 <field name="invoice_id" on_change="onchange_invoice_id(invoice_id,warehouse_id,context)" domain="['|',('commercial_partner_id','=',partner_id),('partner_id','=',partner_id)]" />
169 <field name="delivery_address_id" context="{'tree_view_ref': 'crm_claim_rma.view_partner_contact_tree', 'search_default_parent_id': partner_id}"/>158 <field name="delivery_address_id" context="{'tree_view_ref': 'crm_claim_rma.view_partner_contact_tree', 'search_default_parent_id': partner_id}"/>
159=======
160 <field name="invoice_id" on_change="onchange_invoice_id(invoice_id, warehouse_id, date, company_id, context)" domain="['|', ('commercial_partner_id', '=', partner_id), ('partner_id', '=', partner_id), ('type', '=', 'out_invoice'), ('state', 'in', ('open', 'paid'))]" context="{'form_view_ref': 'account.invoice_form'}"/>
161>>>>>>> MERGE-SOURCE
170 </group>162 </group>
171 <group>163 <group>
172 <!-- Place for mass return button from crm_rma_lot_mass_return -->164 <!-- Place for mass return button from crm_rma_lot_mass_return -->
173 </group>165 </group>
174 <field name="claim_line_ids" nolabel="1" colspan="4" editable="top"/>166 <field name="claim_line_ids" nolabel="1" colspan="4" editable="top"/>
175 </group>167 </group>
176 <group col="4" colspan="4" attrs="{'invisible':[('state', '&lt;&gt;','open')]}">168 <group attrs="{'invisible':[('state', '&lt;&gt;','open')]}" string="Actions on Product Returns" name="actions">
177 <separator string="Action" colspan="4" />
178 <button name="%(action_claim_picking_in)d"169 <button name="%(action_claim_picking_in)d"
179 string="New Products Return" states="open"170 string="New Products Return" states="open"
180 type="action" target="new"171 type="action" target="new"
@@ -189,7 +180,7 @@
189180
190 <button name="%(account.action_account_invoice_refund)d"181 <button name="%(account.action_account_invoice_refund)d"
191 type='action' string='New Refund'182 type='action' string='New Refund'
192 states='open' icon="gtk-execute"183 states='open'
193 context="{184 context="{
194 'invoice_ids': [invoice_id],185 'invoice_ids': [invoice_id],
195 'claim_line_ids': claim_line_ids,186 'claim_line_ids': claim_line_ids,
@@ -199,16 +190,19 @@
199 </group>190 </group>
200 </page>191 </page>
201 <page string="Generated Documents">192 <page string="Generated Documents">
202 <separator colspan="2" string="Refunds"/>193 <group name="refunds" string="Refunds">
203 <field name="invoice_ids" colspan="4" readonly="1"/>194 <field name="invoice_ids" readonly="1" nolabel="1"/>
204 <separator colspan="2" string="Receptions / Deliveries"/>195 </group>
205 <field name="picking_ids" colspan="4" readonly="1"/>196 <group name="picking" string="Receptions / Deliveries">
197 <field name="picking_ids" readonly="1" nolabel="1"/>
198 </group>
206 </page>199 </page>
207 </page>200 </notebook>
208 </field>201 </field>
209 </record>202 </record>
210203
211204
205<<<<<<< TREE
212<!-- Right side link to orders -->206<!-- Right side link to orders -->
213 <act_window 207 <act_window
214 id="act_crm_claim_rma_sale_orders" 208 id="act_crm_claim_rma_sale_orders"
@@ -321,6 +315,8 @@
321 </field>315 </field>
322 </record>316 </record>
323317
318=======
319>>>>>>> MERGE-SOURCE
324 <!-- Crm claim Search view -->320 <!-- Crm claim Search view -->
325 <record id="view_crm_case_claims_filter" model="ir.ui.view">321 <record id="view_crm_case_claims_filter" model="ir.ui.view">
326 <field name="name">CRM - Claims Search</field>322 <field name="name">CRM - Claims Search</field>
@@ -330,13 +326,37 @@
330 <field name="name" string="Claims" position="before">326 <field name="name" string="Claims" position="before">
331 <field name="number"/>327 <field name="number"/>
332 </field>328 </field>
333 <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" position="before">329 <filter string="Stage" context="{'group_by':'stage_id'}" position="before">
334 <filter string="Sales Team" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'section_id'}"/>330 <filter string="Sales Team" name="section_id_groupby" context="{'group_by':'section_id'}"/>
331 <filter string="Claim Type" name="claim_type_groupby" context="{'group_by':'claim_type'}"/>
335 </filter>332 </filter>
336 </field>333 </field>
337 </record>334 </record>
338335
339 336 <record id="substate_substate_form" model="ir.ui.view">
337 <field name="name">substate.substate.form</field>
338 <field name="model">substate.substate</field>
339 <field name="arch" type="xml">
340 <form string="Return Line Substates" version="7.0">
341 <group name="main">
342 <field name="name"/>
343 <field name="substate_descr"/>
344 </group>
345 </form>
346 </field>
347 </record>
348
349 <record id="substate_substate_tree" model="ir.ui.view">
350 <field name="name">substate.substate.tree</field>
351 <field name="model">substate.substate</field>
352 <field name="arch" type="xml">
353 <tree string="Return Line Substates">
354 <field name="name"/>
355 </tree>
356 </field>
357 </record>
358
359
340<!-- Menu -->360<!-- Menu -->
341 <record model="ir.actions.act_window" id="crm_claim.crm_case_categ_claim0">361 <record model="ir.actions.act_window" id="crm_claim.crm_case_categ_claim0">
342 <field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field>362 <field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field>
@@ -344,23 +364,28 @@
344364
345 <!-- return lines action -->365 <!-- return lines action -->
346 <record model="ir.actions.act_window" id="act_crm_case_claim_lines">366 <record model="ir.actions.act_window" id="act_crm_case_claim_lines">
347 <field name="name">Claim lines</field>367 <field name="name">Return Lines</field>
348 <field name="res_model">claim.line</field>368 <field name="res_model">claim.line</field>
349 <field name="view_type">form</field>369 <field name="view_type">form</field>
350 <field name="view_mode">tree,form</field>370 <field name="view_mode">tree,form</field>
351 <field name="view_id" ref="crm_claim_line_tree_view"/>371 <field name="context">{'claim_line_main_view': True}</field>
352 <field name="search_view_id" ref="view_crm_claim_lines_filter"/>
353 </record>372 </record>
354 <!-- substates action -->373 <!-- substates action -->
355 <record id="act_crm_claim_substates" model="ir.actions.act_window">374 <record id="act_crm_claim_substates" model="ir.actions.act_window">
356 <field name="name">Claim line substates</field>375 <field name="name">Return Line Substates</field>
357 <field name="res_model">substate.substate</field>376 <field name="res_model">substate.substate</field>
358 <field name="view_type">form</field>377 <field name="view_type">form</field>
378 <field name="view_mode">tree,form</field>
359 </record>379 </record>
360 <!-- Menu -->380 <!-- Menu -->
361 <menuitem name="Return lines" id="menu_crm_case_claims_claim_lines"381 <menuitem id="menu_crm_case_claims_claim_lines"
362 parent="base.menu_aftersale" action="act_crm_case_claim_lines" sequence="2"/>382 parent="base.menu_aftersale" action="act_crm_case_claim_lines" sequence="2"/>
363 <menuitem name="Returned line substates" id="menu_crm_case_claims_claim_line_substates"383 <menuitem id="menu_crm_case_claims_claim_line_substates"
364 parent="crm_claim.menu_config_claim" action="act_crm_claim_substates" sequence="2"/>384 parent="crm_claim.menu_config_claim" action="act_crm_claim_substates" sequence="2"/>
385
386 <!-- Add group RMA User to menu entry "After-Sale Services" -->
387 <record id="base.menu_aftersale" model="ir.ui.menu">
388 <field name="groups_id" eval="[(4, ref('group_rma_user'))]"/>
389 </record>
365 </data>390 </data>
366</openerp>391</openerp>
367392
=== modified file 'crm_claim_rma/security/ir.model.access.csv'
--- crm_claim_rma/security/ir.model.access.csv 2013-02-11 14:26:42 +0000
+++ crm_claim_rma/security/ir.model.access.csv 2015-11-20 10:22:38 +0000
@@ -1,7 +1,14 @@
1"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2"access_substate_user","substate.substate.user","model_substate_substate","base.group_sale_salesman_all_leads","True","True","True",2access_substate_user,Read access on substate.substate to Sale User,model_substate_substate,base.group_sale_salesman,1,0,0,0
3"access_claim_line_user","claim.line.user","model_claim_line","base.group_sale_salesman_all_leads","True","True","True",3access_substate_manager,substate.substate.manager,model_substate_substate,base.group_sale_manager,1,1,1,1
4"access_substate_manager","substate.substate.manager","model_substate_substate","base.group_sale_manager","True","True","True","True"4access_substate_rma_user,Read access on substate.substate to RMA User,model_substate_substate,group_rma_user,1,0,0,0
5"access_claim_line_manager","claim.line.manager","model_claim_line","base.group_sale_manager","True","True","True","True"5access_substate_rma_manager,Full access on substate.substate to RMA Manager,model_substate_substate,group_rma_manager,1,1,1,1
6"access_substate_user","substate.substate.user","model_substate_substate","base.group_sale_salesman","True","True","True",6access_claim_line_user,claim.line.user,model_claim_line,base.group_sale_salesman,1,1,1,0
7"access_claim_line_user","claim.line.user","model_claim_line","base.group_sale_salesman","True","True","True",7access_claim_line_manager,claim.line.manager,model_claim_line,base.group_sale_manager,1,1,1,1
8access_claim_line_rma_user,Access on claim.line to RMA User,model_claim_line,group_rma_user,1,1,1,0
9access_claim_line_rma_manager,Full Access on claim.line to RMA Manager,model_claim_line,group_rma_manager,1,1,1,1
10access_crm_claim_rma_user,Access on crm.claim to RMA User,crm_claim.model_crm_claim,group_rma_user,1,1,1,0
11access_crm_claim_rma_manager,Access on crm.claim to RMA Manager,crm_claim.model_crm_claim,group_rma_manager,1,1,1,1
12access_crm_claim_stage_rma_user,Access on crm.claim.stage to RMA User,crm_claim.model_crm_claim_stage,group_rma_user,1,0,0,0
13access_crm_claim_stage_rma_manager,Full access on crm.claim.stage to RMA Manager,crm_claim.model_crm_claim_stage,group_rma_manager,1,1,1,1
14access_crm_claim_report_rma_manager,Full access on crm.claim.report to RMA Manager,crm_claim.model_crm_claim_report,group_rma_manager,1,1,1,1
815
=== added file 'crm_claim_rma/security/rma_group.xml'
--- crm_claim_rma/security/rma_group.xml 1970-01-01 00:00:00 +0000
+++ crm_claim_rma/security/rma_group.xml 2015-11-20 10:22:38 +0000
@@ -0,0 +1,30 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 Copyright (C) 2014 Akretion (http://www.akretion.com/)
4 @author: Alexis de Lattre <alexis.delattre@akretion.com>
5 The licence is in the file __openerp__.py
6-->
7
8<openerp>
9<data noupdate="1">
10
11
12<record id="module_category_rma" model="ir.module.category">
13 <field name="name">RMA</field>
14 <field name="sequence">30</field>
15</record>
16
17<record id="group_rma_user" model="res.groups">
18 <field name="name">User</field>
19 <field name="category_id" ref="module_category_rma"/>
20</record>
21
22<record id="group_rma_manager" model="res.groups">
23 <field name="name">Manager</field>
24 <field name="category_id" ref="module_category_rma"/>
25 <field name="implied_ids" eval="[(4, ref('group_rma_user'))]"/>
26</record>
27
28
29</data>
30</openerp>
031
=== modified file 'crm_claim_rma/stock_view.xml'
--- crm_claim_rma/stock_view.xml 2014-02-26 11:11:38 +0000
+++ crm_claim_rma/stock_view.xml 2015-11-20 10:22:38 +0000
@@ -24,16 +24,20 @@
24 </xpath>24 </xpath>
25 </field>25 </field>
26 </record>26 </record>
27 27
28 <record id="view_picking_in_search" model="ir.ui.view">28 <record id="view_picking_in_search" model="ir.ui.view">
29 <field name="name">crm_claim_rma.picking_in_search</field>29 <field name="name">crm_claim_rma.picking_in_search</field>
30 <field name="model">stock.picking.in</field>30 <field name="model">stock.picking.in</field>
31 <field name="inherit_id" ref="stock.view_picking_in_search" />31 <field name="inherit_id" ref="stock.view_picking_in_search" />
32 <field name="arch" type="xml">32 <field name="arch" type="xml">
33 <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]" position="after">33 <filter string="To Invoice" name="to_invoice" position="after">
34 <separator/>34 <separator/>
35<<<<<<< TREE
35 <filter string="RMA" icon="terp-accessories-archiver-minus" domain="[('claim_id', '!=', 'False')]" />36 <filter string="RMA" icon="terp-accessories-archiver-minus" domain="[('claim_id', '!=', 'False')]" />
36 <field name="claim_id" string="RMA" invisible="True"/>37 <field name="claim_id" string="RMA" invisible="True"/>
38=======
39 <filter string="RMA" domain="[('claim_id', '!=', 'False')]" />
40>>>>>>> MERGE-SOURCE
37 </filter>41 </filter>
38 </field>42 </field>
39 </record>43 </record>
@@ -43,9 +47,9 @@
43 <field name="model">stock.picking.out</field>47 <field name="model">stock.picking.out</field>
44 <field name="inherit_id" ref="stock.view_picking_out_search" />48 <field name="inherit_id" ref="stock.view_picking_out_search" />
45 <field name="arch" type="xml">49 <field name="arch" type="xml">
46 <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Delivery orders to invoice" position="after">50 <filter name="to_invoice" string="To Invoice" position="after">
47 <separator/>51 <separator/>
48 <filter string="RMA" icon="terp-accessories-archiver-minus" domain="[('claim_id', '!=', 'False')]" />52 <filter string="RMA" domain="[('claim_id', '!=', 'False')]" />
49 </filter>53 </filter>
50 </field>54 </field>
51 </record>55 </record>
5256
=== modified file 'crm_claim_rma/wizard/claim_make_picking_view.xml'
--- crm_claim_rma/wizard/claim_make_picking_view.xml 2013-12-20 14:31:15 +0000
+++ crm_claim_rma/wizard/claim_make_picking_view.xml 2015-11-20 10:22:38 +0000
@@ -12,13 +12,15 @@
12 <field name="model">claim_make_picking.wizard</field>12 <field name="model">claim_make_picking.wizard</field>
13 <field name="arch" type="xml">13 <field name="arch" type="xml">
14 <form string="Select exchange lines to add in picking" version="7.0">14 <form string="Select exchange lines to add in picking" version="7.0">
15 <separator string="Locations" colspan="4"/>15 <group name="locations" string="Locations">
16 <field name="claim_line_source_location" nolabel="1" />16 <field name="claim_line_source_location" />
17 <field name="claim_line_dest_location" nolabel="1" />17 <field name="claim_line_dest_location" />
18 <separator string="Select lines for picking" colspan="4"/>18 </group>
19 <field name="claim_line_ids" nolabel="1" colspan="4"/>19 <group name="lines" string="Select Lines for Picking">
20 <field name="claim_line_ids" nolabel="1"/>
21 </group>
20 <footer>22 <footer>
21 <button name="action_create_picking" string="Create picking" type="object" class="oe_highlight"/>23 <button name="action_create_picking" string="Create Picking" type="object" class="oe_highlight"/>
22 or24 or
23 <button string="Cancel" class="oe_link" special="cancel" />25 <button string="Cancel" class="oe_link" special="cancel" />
24 </footer>26 </footer>
@@ -28,7 +30,6 @@
2830
29 <record id="action_claim_picking_in" model="ir.actions.act_window">31 <record id="action_claim_picking_in" model="ir.actions.act_window">
30 <field name="name">Return Products</field>32 <field name="name">Return Products</field>
31 <field name="type">ir.actions.act_window</field>
32 <field name="res_model">claim_make_picking.wizard</field>33 <field name="res_model">claim_make_picking.wizard</field>
33 <field name="src_model">crm.claim</field>34 <field name="src_model">crm.claim</field>
34 <field name="view_type">form</field>35 <field name="view_type">form</field>
@@ -39,7 +40,6 @@
3940
40 <record id="action_claim_picking_out" model="ir.actions.act_window">41 <record id="action_claim_picking_out" model="ir.actions.act_window">
41 <field name="name">Create Outgoing Shipments</field>42 <field name="name">Create Outgoing Shipments</field>
42 <field name="type">ir.actions.act_window</field>
43 <field name="res_model">claim_make_picking.wizard</field>43 <field name="res_model">claim_make_picking.wizard</field>
44 <field name="src_model">crm.claim</field>44 <field name="src_model">crm.claim</field>
45 <field name="view_type">form</field>45 <field name="view_type">form</field>
4646
=== modified file 'crm_rma_advance_location/__openerp__.py'
--- crm_rma_advance_location/__openerp__.py 2013-11-15 13:24:39 +0000
+++ crm_rma_advance_location/__openerp__.py 2015-11-20 10:22:38 +0000
@@ -2,7 +2,7 @@
2##############################################################################2##############################################################################
3#3#
4# Copyright 2013 Camptocamp4# Copyright 2013 Camptocamp
5# Copyright 2009-2013 Akretion, 5# Copyright 2009-2013 Akretion
6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
7#7#
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
@@ -40,10 +40,10 @@
40 * Refurbish40 * Refurbish
41 * Mistake Loss41 * Mistake Loss
4242
43And also various wizards on icoming deliveries that allow you to move your goods easily in those43And also various wizards on incoming deliveries that allow you to move your goods easily to those
44new locations from a done reception.44new locations from a done reception.
4545
46Using this module make the logistic flow of return a bit more complexe:46Using this module make the logistic flow of return a bit more complex:
4747
48 * Returning product goes into RMA location with a incoming shipment48 * Returning product goes into RMA location with a incoming shipment
49 * From the incoming shipment, forward them to another places (stock, loss,...)49 * From the incoming shipment, forward them to another places (stock, loss,...)
5050
=== modified file 'crm_rma_advance_location/claim_rma_view.xml'
--- crm_rma_advance_location/claim_rma_view.xml 2013-11-15 13:24:39 +0000
+++ crm_rma_advance_location/claim_rma_view.xml 2015-11-20 10:22:38 +0000
@@ -1,20 +1,22 @@
1<?xml version="1.0"?>1<?xml version="1.0"?>
2<openerp>2<openerp>
3 <data>3<data>
4 <record model="ir.ui.view" id="crm_claim_rma_form_view">4
5 <field name="name">CRM - Claim product return Form</field>5<record id="crm_claim_rma_form_view" model="ir.ui.view">
6 <field name="model">crm.claim</field>6 <field name="name">CRM - Claim product return Form</field>
7 <field name="inherit_id" ref="crm_claim_rma.crm_claim_rma_form_view"/>7 <field name="model">crm.claim</field>
8 <field name="arch" type="xml">8 <field name="inherit_id" ref="crm_claim_rma.crm_case_claims_form_view"/>
9 <xpath expr="//button[@string='New Delivery']" position="after">9 <field name="arch" type="xml">
10 <button name="%(action_claim_picking_loss)d"10 <xpath expr="//button[@string='New Delivery']" position="after">
11 string="New Product Loss" states="open"11 <button name="%(action_claim_picking_loss)d"
12 type="action" target="new"12 string="New Product Loss" states="open"
13 context="{'warehouse_id': warehouse_id,13 type="action" target="new"
14 'partner_id': partner_id}"/>14 context="{'warehouse_id': warehouse_id,
15 </xpath>15 'partner_id': partner_id}"/>
16 </field>16 </xpath>
17 </record>17 </field>
1818</record>
19 </data>19
20
21</data>
20</openerp>22</openerp>
2123
=== modified file 'crm_rma_advance_location/stock.py'
--- crm_rma_advance_location/stock.py 2013-12-03 10:27:02 +0000
+++ crm_rma_advance_location/stock.py 2015-11-20 10:22:38 +0000
@@ -2,7 +2,7 @@
2##############################################################################2##############################################################################
3#3#
4# Copyright 2013 Camptocamp4# Copyright 2013 Camptocamp
5# Copyright 2009-2013 Akretion, 5# Copyright 2009-2013 Akretion
6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
7#7#
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
99
=== modified file 'crm_rma_advance_location/stock_view.xml'
--- crm_rma_advance_location/stock_view.xml 2013-11-14 10:07:54 +0000
+++ crm_rma_advance_location/stock_view.xml 2015-11-20 10:22:38 +0000
@@ -11,7 +11,7 @@
11 <!-- Those wizard aren't working yet -->11 <!-- Those wizard aren't working yet -->
12 <xpath expr="/form/header/button[@string='Return Products']" position="after">12 <xpath expr="/form/header/button[@string='Return Products']" position="after">
13 <button name="%(action_stock_picking_from_claim_picking)d" 13 <button name="%(action_stock_picking_from_claim_picking)d"
14 string="Product to stock" type="action"14 string="Product to Stock" type="action"
15 attrs="{'invisible':['|',15 attrs="{'invisible':['|',
16 ('state','&lt;&gt;','done'),16 ('state','&lt;&gt;','done'),
17 ('claim_id', '=', False)]}"/>17 ('claim_id', '=', False)]}"/>
@@ -21,7 +21,7 @@
21 ('state','&lt;&gt;','done'),21 ('state','&lt;&gt;','done'),
22 ('claim_id', '=', False)]}"/>22 ('claim_id', '=', False)]}"/>
23 <button name="%(action_used_picking_from_claim_picking)d" 23 <button name="%(action_used_picking_from_claim_picking)d"
24 string="Product to refurbish stock" type="action"24 string="Product to Refurbish" type="action"
25 attrs="{'invisible':['|',25 attrs="{'invisible':['|',
26 ('state','&lt;&gt;','done'),26 ('state','&lt;&gt;','done'),
27 ('claim_id', '=', False)]}"/>27 ('claim_id', '=', False)]}"/>
@@ -42,7 +42,6 @@
42 </xpath>42 </xpath>
43 </field>43 </field>
44 </record>44 </record>
45
4645
47 </data>46 </data>
48</openerp>47</openerp>
4948
=== modified file 'crm_rma_advance_location/wizard/__init__.py'
--- crm_rma_advance_location/wizard/__init__.py 2013-11-14 10:07:54 +0000
+++ crm_rma_advance_location/wizard/__init__.py 2015-11-20 10:22:38 +0000
@@ -2,7 +2,7 @@
2##############################################################################2##############################################################################
3#3#
4# Copyright 2013 Camptocamp4# Copyright 2013 Camptocamp
5# Copyright 2009-2013 Akretion, 5# Copyright 2009-2013 Akretion
6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume6# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
7#7#
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
@@ -20,4 +20,4 @@
20#20#
21##############################################################################21##############################################################################
22from . import claim_make_picking_from_picking22from . import claim_make_picking_from_picking
23from . import claim_make_picking
24\ No newline at end of file23\ No newline at end of file
24from . import claim_make_picking
2525
=== modified file 'crm_rma_advance_location/wizard/claim_make_picking.py'
--- crm_rma_advance_location/wizard/claim_make_picking.py 2013-12-03 10:33:50 +0000
+++ crm_rma_advance_location/wizard/claim_make_picking.py 2015-11-20 10:22:38 +0000
@@ -1,26 +1,28 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2#########################################################################2#########################################################################
3# #3#
4# #4# crm_claim_rma_advance_location for OpenERP
5#########################################################################5# Copyright (C) 2009-2014 Emmanuel Samyn
6# #6# Copyright (C) 2009-2014 Akretion (http://www.akretion.com)
7# crm_claim_rma for OpenERP #7# Authors: Emmanuel Samyn, Benoît GUILLOT <benoit.guillot@akretion.com>
8# Copyright (C) 2009-2012 Akretion, Emmanuel Samyn, #8#
9# Benoît GUILLOT <benoit.guillot@akretion.com> #9# This program is free software: you can redistribute it and/or modify
10#This program is free software: you can redistribute it and/or modify #10# it under the terms of the GNU Affero General Public License as
11#it under the terms of the GNU General Public License as published by #11# published by the Free Software Foundation, either version 3 of the
12#the Free Software Foundation, either version 3 of the License, or #12# License, or (at your option) any later version.
13#(at your option) any later version. #13#
14# #14# This program is distributed in the hope that it will be useful,
15#This program is distributed in the hope that it will be useful, #15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16#but WITHOUT ANY WARRANTY; without even the implied warranty of #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #17# GNU Affero General Public License for more details.
18#GNU General Public License for more details. #18#
19# #19# You should have received a copy of the GNU Affero General Public License
20#You should have received a copy of the GNU General Public License #20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#along with this program. If not, see <http://www.gnu.org/licenses/>. #21#
22#########################################################################22#########################################################################
23
23from openerp.osv import orm24from openerp.osv import orm
25from openerp.tools.translate import _
2426
2527
26class claim_make_picking(orm.TransientModel):28class claim_make_picking(orm.TransientModel):
@@ -29,23 +31,27 @@
2931
30 def _get_dest_loc(self, cr, uid, context=None):32 def _get_dest_loc(self, cr, uid, context=None):
31 """ Get default destination location """33 """ Get default destination location """
32 loc_id = super(claim_make_picking, self)._get_dest_loc(cr, uid, context=context)
33 if context is None:34 if context is None:
34 context = {}35 context = {}
35 warehouse_obj = self.pool.get('stock.warehouse')36 loc_id = super(claim_make_picking, self)._get_dest_loc(
37 cr, uid, context=context)
36 warehouse_id = context.get('warehouse_id')38 warehouse_id = context.get('warehouse_id')
39 warehouse = self.pool['stock.warehouse'].browse(
40 cr, uid, warehouse_id, context=context)
37 if context.get('picking_type') == 'in':41 if context.get('picking_type') == 'in':
38 loc_id = warehouse_obj.read(42 loc_id = warehouse.lot_rma_id.id or False
39 cr, uid,43 if not loc_id:
40 warehouse_id,44 raise orm.except_orm(
41 ['lot_rma_id'],45 _('Error:'),
42 context=context)['lot_rma_id'][0]46 _("Missing RMA stock location on warehouse '%s'")
47 % warehouse.name)
43 elif context.get('picking_type') == 'loss':48 elif context.get('picking_type') == 'loss':
44 loc_id = warehouse_obj.read(49 loc_id = warehouse.lot_carrier_loss_id.id or False
45 cr, uid,50 if not loc_id:
46 warehouse_id,51 raise orm.except_orm(
47 ['lot_carrier_loss_id'],52 _('Error:'),
48 context=context)['lot_carrier_loss_id'][0]53 _("Missing Carrier Loss stock location on warehouse '%s'")
54 % warehouse.name)
49 return loc_id55 return loc_id
5056
51 _defaults = {57 _defaults = {
5258
=== modified file 'crm_rma_advance_location/wizard/claim_make_picking_from_picking.py'
--- crm_rma_advance_location/wizard/claim_make_picking_from_picking.py 2013-11-21 15:41:37 +0000
+++ crm_rma_advance_location/wizard/claim_make_picking_from_picking.py 2015-11-20 10:22:38 +0000
@@ -1,27 +1,28 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2#########################################################################2#########################################################################
3# #3#
4# #4# crm_claim_rma_advance_location for OpenERP
5#########################################################################5# Copyright (C) 2009-2014 Emmanuel Samyn
6# #6# Copyright (C) 2009-2014 Akretion (http://www.akretion.com)
7# crm_claim_rma for OpenERP #7# Authors: Emmanuel Samyn, Benoît GUILLOT <benoit.guillot@akretion.com>
8# Copyright (C) 2009-2012 Akretion, Emmanuel Samyn, #8#
9# Benoît GUILLOT <benoit.guillot@akretion.com> #9# This program is free software: you can redistribute it and/or modify
10#This program is free software: you can redistribute it and/or modify #10# it under the terms of the GNU Affero General Public License as
11#it under the terms of the GNU General Public License as published by #11# published by the Free Software Foundation, either version 3 of the
12#the Free Software Foundation, either version 3 of the License, or #12# License, or (at your option) any later version.
13#(at your option) any later version. #13#
14# #14# This program is distributed in the hope that it will be useful,
15#This program is distributed in the hope that it will be useful, #15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16#but WITHOUT ANY WARRANTY; without even the implied warranty of #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #17# GNU Affero General Public License for more details.
18#GNU General Public License for more details. #18#
19# #19# You should have received a copy of the GNU Affero General Public License
20#You should have received a copy of the GNU General Public License #20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#along with this program. If not, see <http://www.gnu.org/licenses/>. #21#
22#########################################################################22#########################################################################
23
23from openerp.osv import fields, orm24from openerp.osv import fields, orm
24from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT25from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
25from openerp import netsvc26from openerp import netsvc
26import time27import time
2728
@@ -31,15 +32,16 @@
31 _name = 'claim_make_picking_from_picking.wizard'32 _name = 'claim_make_picking_from_picking.wizard'
32 _description = 'Wizard to create pickings from picking lines'33 _description = 'Wizard to create pickings from picking lines'
33 _columns = {34 _columns = {
34 'picking_line_source_location': fields.many2one('stock.location',35 'picking_line_source_location': fields.many2one(
35 'Source Location',36 'stock.location', 'Source Location',
36 help="Location where the returned products are from.",37 help="Location where the returned products are from.",
37 required=True),38 required=True),
38 'picking_line_dest_location': fields.many2one('stock.location',39 'picking_line_dest_location': fields.many2one(
39 'Dest. Location',40 'stock.location', 'Dest. Location',
40 help="Location where the system will stock the returned products.",41 help="Location where the system will stock the returned products.",
41 required=True),42 required=True),
42 'picking_line_ids': fields.many2many('stock.move',43 'picking_line_ids': fields.many2many(
44 'stock.move',
43 'claim_picking_line_picking',45 'claim_picking_line_picking',
44 'claim_picking_id',46 'claim_picking_id',
45 'picking_line_id',47 'picking_line_id',
@@ -47,31 +49,36 @@
47 }49 }
4850
49 def _get_default_warehouse(self, cr, uid, context=None):51 def _get_default_warehouse(self, cr, uid, context=None):
50 warehouse_id=self.pool.get('crm.claim')._get_default_warehouse(cr, uid, context=context)52 warehouse_id = self.pool['crm.claim']._get_default_warehouse(
53 cr, uid, context=context)
51 return warehouse_id54 return warehouse_id
5255
53 def _get_picking_lines(self, cr, uid, context):56 def _get_picking_lines(self, cr, uid, context):
54 return self.pool.get('stock.picking').read(cr, uid,57 return self.pool.get('stock.picking').read(
55 context['active_id'], ['move_lines'], context=context)['move_lines']58 cr, uid, context['active_id'], ['move_lines'],
59 context=context)['move_lines']
5660
57 # Get default source location61 # Get default source location
58 def _get_source_loc(self, cr, uid, context):62 def _get_source_loc(self, cr, uid, context):
59 if context is None: context = {}63 if context is None:
64 context = {}
60 warehouse_obj = self.pool.get('stock.warehouse')65 warehouse_obj = self.pool.get('stock.warehouse')
61 warehouse_id = self._get_default_warehouse(cr, uid, context=context)66 warehouse_id = self._get_default_warehouse(cr, uid, context=context)
62 return warehouse_obj.read(cr, uid,67 return warehouse_obj.read(
63 warehouse_id, ['lot_rma_id'], context=context)['lot_rma_id'][0]68 cr, uid, warehouse_id, ['lot_rma_id'],
69 context=context)['lot_rma_id'][0]
6470
65 # Get default destination location71 # Get default destination location
66 def _get_dest_loc(self, cr, uid, context):72 def _get_dest_loc(self, cr, uid, context):
67 if context is None: context = {}73 if context is None:
74 context = {}
68 warehouse_id = self._get_default_warehouse(cr, uid, context=context)75 warehouse_id = self._get_default_warehouse(cr, uid, context=context)
69 warehouse_obj = self.pool.get('stock.warehouse')76 warehouse_obj = self.pool.get('stock.warehouse')
70 if context.get('picking_type'):77 if context.get('picking_type'):
71 context_loc = context.get('picking_type')[8:]78 loc_field = 'lot_%s_id' % context.get('picking_type')[8:]
72 loc_field = 'lot_%s_id' %context.get('picking_type')[8:]79 loc_id = warehouse_obj.read(
73 loc_id = warehouse_obj.read(cr, uid,80 cr, uid, warehouse_id, [loc_field],
74 warehouse_id, [loc_field], context=context)[loc_field][0]81 context=context)[loc_field][0]
75 return loc_id82 return loc_id
7683
77 _defaults = {84 _defaults = {
@@ -80,9 +87,6 @@
80 'picking_line_ids': _get_picking_lines,87 'picking_line_ids': _get_picking_lines,
81 }88 }
8289
83 def action_cancel(self,cr,uid,ids,conect=None):
84 return {'type': 'ir.actions.act_window_close',}
85
86 # If "Create" button pressed90 # If "Create" button pressed
87 def action_create_picking_from_picking(self, cr, uid, ids, context=None):91 def action_create_picking_from_picking(self, cr, uid, ids, context=None):
88 picking_obj = self.pool.get('stock.picking')92 picking_obj = self.pool.get('stock.picking')
@@ -162,5 +166,3 @@
162 'res_id': picking_id,166 'res_id': picking_id,
163 'type': 'ir.actions.act_window',167 'type': 'ir.actions.act_window',
164 }168 }
165
166# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
167169
=== modified file 'crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml'
--- crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml 2013-11-14 10:07:54 +0000
+++ crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml 2015-11-20 10:22:38 +0000
@@ -1,6 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
2<!--2<!--
3 crm_claim_rma for OpenERP
4 Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>3 Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>
5 The licence is in the file __openerp__.py4 The licence is in the file __openerp__.py
6-->5-->
@@ -11,26 +10,27 @@
11 <field name="name">claim_picking</field>10 <field name="name">claim_picking</field>
12 <field name="model">claim_make_picking_from_picking.wizard</field>11 <field name="model">claim_make_picking_from_picking.wizard</field>
13 <field name="arch" type="xml">12 <field name="arch" type="xml">
14 <form string="Select lines to add in picking">13 <form string="Select lines to add in picking" version="7.0">
15 <separator string="Locations" colspan="4"/>14 <group string="Locations">
16 <field name="picking_line_source_location" nolabel="1" />15 <field name="picking_line_source_location" />
17 <field name="picking_line_dest_location" nolabel="1" />16 <field name="picking_line_dest_location" />
18 <separator string="Select lines for picking" colspan="4"/>17 </group>
19 <field name="picking_line_ids" nolabel="1" colspan="4"/>18 <group string="Select lines for picking">
20 <group col="4" colspan="2">19 <field name="picking_line_ids" nolabel="1"/>
21 <button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>20 </group>
22 <button name="action_create_picking_from_picking" string="Create picking" 21 <footer>
23 icon='gtk-ok' type="object"/>22 <button name="action_create_picking_from_picking"
24 </group>23 string="Create Picking"
24 class="oe_highlight" type="object"/>
25 <button special="cancel" string="Cancel" type="object" class="oe_link"/>
26 </footer>
25 </form>27 </form>
26 </field>28 </field>
27 </record> 29 </record>
2830
29 <record id="action_stock_picking_from_claim_picking" model="ir.actions.act_window">31 <record id="action_stock_picking_from_claim_picking" model="ir.actions.act_window">
30 <field name="name">Create Incomming Shipment to Stock</field>32 <field name="name">Create Incomming Shipment to Stock</field>
31 <field name="type">ir.actions.act_window</field>
32 <field name="res_model">claim_make_picking_from_picking.wizard</field>33 <field name="res_model">claim_make_picking_from_picking.wizard</field>
33 <field name="src_model">stock.picking</field>
34 <field name="view_type">form</field>34 <field name="view_type">form</field>
35 <field name="view_mode">form</field>35 <field name="view_mode">form</field>
36 <field name="target">new</field> 36 <field name="target">new</field>
@@ -39,9 +39,7 @@
3939
40 <record id="action_loss_picking_from_claim_picking" model="ir.actions.act_window">40 <record id="action_loss_picking_from_claim_picking" model="ir.actions.act_window">
41 <field name="name">Create Incomming Shipment to Breakkage Loss Location</field>41 <field name="name">Create Incomming Shipment to Breakkage Loss Location</field>
42 <field name="type">ir.actions.act_window</field>
43 <field name="res_model">claim_make_picking_from_picking.wizard</field>42 <field name="res_model">claim_make_picking_from_picking.wizard</field>
44 <field name="src_model">stock.picking</field>
45 <field name="view_type">form</field>43 <field name="view_type">form</field>
46 <field name="view_mode">form</field>44 <field name="view_mode">form</field>
47 <field name="target">new</field> 45 <field name="target">new</field>
@@ -50,9 +48,7 @@
5048
51 <record id="action_used_picking_from_claim_picking" model="ir.actions.act_window">49 <record id="action_used_picking_from_claim_picking" model="ir.actions.act_window">
52 <field name="name">Create Incomming Shipment to Refurbish Location</field>50 <field name="name">Create Incomming Shipment to Refurbish Location</field>
53 <field name="type">ir.actions.act_window</field>
54 <field name="res_model">claim_make_picking_from_picking.wizard</field>51 <field name="res_model">claim_make_picking_from_picking.wizard</field>
55 <field name="src_model">stock.picking</field>
56 <field name="view_type">form</field>52 <field name="view_type">form</field>
57 <field name="view_mode">form</field>53 <field name="view_mode">form</field>
58 <field name="target">new</field> 54 <field name="target">new</field>
5955
=== modified file 'crm_rma_advance_location/wizard/claim_make_picking_view.xml'
--- crm_rma_advance_location/wizard/claim_make_picking_view.xml 2013-11-14 10:07:54 +0000
+++ crm_rma_advance_location/wizard/claim_make_picking_view.xml 2015-11-20 10:22:38 +0000
@@ -1,6 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
2<!--2<!--
3 crm_claim_rma for OpenERP
4 Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>3 Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>
5 The licence is in the file __openerp__.py4 The licence is in the file __openerp__.py
6-->5-->
@@ -9,9 +8,7 @@
98
10 <record id="action_claim_picking_loss" model="ir.actions.act_window">9 <record id="action_claim_picking_loss" model="ir.actions.act_window">
11 <field name="name">Create Products Loss</field>10 <field name="name">Create Products Loss</field>
12 <field name="type">ir.actions.act_window</field>
13 <field name="res_model">claim_make_picking.wizard</field>11 <field name="res_model">claim_make_picking.wizard</field>
14 <field name="src_model">crm.claim</field>
15 <field name="view_type">form</field>12 <field name="view_type">form</field>
16 <field name="view_mode">form</field>13 <field name="view_mode">form</field>
17 <field name="target">new</field> 14 <field name="target">new</field>
1815
=== modified file 'product_warranty/__openerp__.py'
--- product_warranty/__openerp__.py 2013-11-21 15:08:21 +0000
+++ product_warranty/__openerp__.py 2015-11-20 10:22:38 +0000
@@ -47,7 +47,7 @@
47 'res_company_view.xml',47 'res_company_view.xml',
48 'product_warranty_view.xml',48 'product_warranty_view.xml',
49 ],49 ],
50 'demo_xml': [],50 'demo': [],
51 'test': [],51 'test': [],
52 'installable': True,52 'installable': True,
53 'active': False,53 'active': False,
5454
=== modified file 'product_warranty/product_warranty.py'
--- product_warranty/product_warranty.py 2013-12-03 10:26:17 +0000
+++ product_warranty/product_warranty.py 2015-11-20 10:22:38 +0000
@@ -1,26 +1,31 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2#########################################################################2#########################################################################
3# #3#
4# #4# Copyright (C) 2009-2014 Akretion (http://www.akretion.com/)
5#########################################################################5# Copyright (C) 2009-2014 Emmanuel Samyn
6# #6# Authors: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
7# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn, Benoît Guillot #7# Benoît Guillot, Joel Grand-Guillaume
8# #8#
9#This program is free software: you can redistribute it and/or modify #9# This program is free software: you can redistribute it and/or modify
10#it under the terms of the GNU General Public License as published by #10# it under the terms of the GNU Affero General Public License as
11#the Free Software Foundation, either version 3 of the License, or #11# published by the Free Software Foundation, either version 3 of the
12#(at your option) any later version. #12# License, or (at your option) any later version.
13# #13#
14#This program is distributed in the hope that it will be useful, #14# This program is distributed in the hope that it will be useful,
15#but WITHOUT ANY WARRANTY; without even the implied warranty of #15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17#GNU General Public License for more details. #17# GNU Affero General Public License for more details.
18# #18#
19#You should have received a copy of the GNU General Public License #19# You should have received a copy of the GNU Affero General Public License
20#along with this program. If not, see <http://www.gnu.org/licenses/>. #20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
21#########################################################################22#########################################################################
2223
23from openerp.osv import orm, fields24from openerp.osv import orm, fields
25import math
26from datetime import datetime
27from dateutil.relativedelta import relativedelta
28import calendar
2429
2530
26class return_instruction(orm.Model):31class return_instruction(orm.Model):
@@ -85,7 +90,7 @@
8590
86 _columns = {91 _columns = {
87 "warranty_duration": fields.float(92 "warranty_duration": fields.float(
88 'Period',93 'Product Warranty (in months)',
89 help="Warranty in month for this product/supplier relation. Only for "94 help="Warranty in month for this product/supplier relation. Only for "
90 "company/supplier relation (purchase order) ; the customer/company "95 "company/supplier relation (purchase order) ; the customer/company "
91 "relation (sale order) always use the product main warranty field"),96 "relation (sale order) always use the product main warranty field"),
@@ -121,3 +126,27 @@
121 'warranty_return_partner': 'company',126 'warranty_return_partner': 'company',
122 'return_instructions': _get_default_instructions,127 'return_instructions': _get_default_instructions,
123 }128 }
129
130
131class product_product(orm.Model):
132 _inherit = 'product.product'
133
134 def warranty_limit(self, cr, uid, start, warranty_duration, context=None):
135 """ Take a duration in float, return the duration in relativedelta
136
137 ``relative_delta(months=...)`` only accepts integers.
138 We have to extract the decimal part, and then, extend the delta with
139 days.
140
141 """
142 decimal_part, months = math.modf(warranty_duration)
143 months = int(months)
144 # If we have a decimal part, we add the number them as days to
145 # the limit. We need to get the month to know the number of
146 # days.
147 delta = relativedelta(months=months)
148 monthday = start + delta
149 __, days_month = calendar.monthrange(monthday.year, monthday.month)
150 # ignore the rest of the days (hours) since we expect a date
151 days = int(days_month * decimal_part)
152 return start + relativedelta(months=months, days=days)
124153
=== modified file 'product_warranty/res_company_view.xml'
--- product_warranty/res_company_view.xml 2013-11-21 15:08:21 +0000
+++ product_warranty/res_company_view.xml 2015-11-20 10:22:38 +0000
@@ -7,14 +7,12 @@
7 <field name="name">crm_claim_rma.company_form</field>7 <field name="name">crm_claim_rma.company_form</field>
8 <field name="model">res.company</field>8 <field name="model">res.company</field>
9 <field name="inherit_id" ref="base.view_company_form" />9 <field name="inherit_id" ref="base.view_company_form" />
10 <field eval="16" name="priority"/>
11 <field name="arch" type="xml">10 <field name="arch" type="xml">
12 <data>11 <page string="Configuration" position="inside">
13 <field name="company_registry" position="after">12 <group name="product-warranty" string="Product Warranty">
14 <separator string="Crm product return address" colspan="4"/>
15 <field name="crm_return_address_id"/>13 <field name="crm_return_address_id"/>
16 </field> 14 </group>
17 </data>15 </page>
18 </field>16 </field>
19 </record>17 </record>
2018

Subscribers

People subscribed via source and target branches