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
1=== modified file 'crm_claim_rma/__openerp__.py'
2--- crm_claim_rma/__openerp__.py 2014-04-23 15:08:04 +0000
3+++ crm_claim_rma/__openerp__.py 2015-11-20 10:22:38 +0000
4@@ -75,9 +75,11 @@
5 'crm_claim',
6 'product_warranty',
7 ],
8- 'data': ['wizard/claim_make_picking_view.xml',
9+ 'data': [
10+ 'security/rma_group.xml',
11+ 'security/ir.model.access.csv',
12+ 'wizard/claim_make_picking_view.xml',
13 'crm_claim_rma_view.xml',
14- 'security/ir.model.access.csv',
15 'account_invoice_view.xml',
16 'stock_view.xml',
17 'res_partner_view.xml',
18
19=== modified file 'crm_claim_rma/crm_claim_rma.py'
20--- crm_claim_rma/crm_claim_rma.py 2014-05-16 12:28:51 +0000
21+++ crm_claim_rma/crm_claim_rma.py 2015-11-20 10:22:38 +0000
22@@ -1,8 +1,8 @@
23 # -*- coding: utf-8 -*-
24 ##############################################################################
25 #
26-# Copyright 2013 Camptocamp
27-# Copyright 2009-2013 Akretion,
28+# Copyright 2013-2014 Camptocamp
29+# Copyright 2009-2014 Akretion,
30 # Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
31 # Benoît Guillot, Joel Grand-Guillaume
32 #
33@@ -21,9 +21,13 @@
34 #
35 ##############################################################################
36
37+<<<<<<< TREE
38 import calendar
39 import math
40 from openerp.osv import fields, orm, osv
41+=======
42+from openerp.osv import fields, orm
43+>>>>>>> MERGE-SOURCE
44 from datetime import datetime
45 from dateutil.relativedelta import relativedelta
46 from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,
47@@ -37,7 +41,7 @@
48 _name = "substate.substate"
49 _description = "substate that precise a given state"
50 _columns = {
51- 'name': fields.char('Sub state', required=True),
52+ 'name': fields.char('Sub State', required=True),
53 'substate_descr': fields.text(
54 'Description',
55 help="To give more information about the sub state"),
56@@ -51,11 +55,41 @@
57 _name = "claim.line"
58 _description = "List of product to return"
59
60- # Comment written in a claim.line to know about the warranty status
61- WARRANT_COMMENT = {
62- 'valid': "Valid",
63- 'expired': "Expired",
64- 'not_define': "Not Defined"}
65+ def prodlot_id_change(
66+ self, cr, uid, ids, prodlot_id, company_id, warehouse_id,
67+ context=None):
68+ res = {'value': {}}
69+ if prodlot_id:
70+ prodlot = self.pool['stock.production.lot'].browse(
71+ cr, uid, prodlot_id, context=context)
72+ return_address_id, return_type = \
73+ self.pool['crm.claim']._get_return_info_from_product(
74+ cr, uid, prodlot.product_id, company_id,
75+ context=context)
76+
77+ res['value'].update({
78+ 'product_id': prodlot.product_id.id,
79+ 'product_returned_quantity': 1,
80+ 'return_address_id': return_address_id,
81+ 'return_type': return_type,
82+ })
83+ else:
84+ res['value'].update({
85+ 'product_id': False,
86+ 'product_returned_quantity': 0,
87+ 'return_address_id': False,
88+ 'return_type': False,
89+ })
90+ return res
91+
92+ def product_id_change(
93+ self, cr, uid, ids, product_id, company_id, context=None):
94+ res = {'domain': {}}
95+ if product_id:
96+ res['domain']['prodlot_id'] = "[('product_id', '=', product_id)]"
97+ else:
98+ res['domain']['prodlot_id'] = "[]"
99+ return res
100
101 # Method to calculate total amount of the line : qty*UP
102 def _line_total_amount(self, cr, uid, ids, field_name, arg, context=None):
103@@ -118,8 +152,8 @@
104 help="Quantity returned * Unit sold price",),
105 'prodlot_id': fields.many2one(
106 'stock.production.lot',
107- string='Serial/Lot n°',
108- help="The serial/lot of the returned product"),
109+ string='Serial Number',
110+ help="The serial number of the returned product"),
111 'applicable_guarantee': fields.selection(
112 [('us', 'Company'),
113 ('supplier', 'Supplier'),
114@@ -127,16 +161,18 @@
115 'Warranty type'),
116 'guarantee_limit': fields.date(
117 'Warranty limit',
118- readonly=True,
119 help="The warranty limit is computed as: invoice date + warranty "
120 "defined on selected product."),
121- 'warning': fields.char(
122- 'Warranty',
123- readonly=True,
124+ 'warning': fields.selection([
125+ ('valid', "Valid"),
126+ ('expired', "Expired"),
127+ ('not_define', "Not Defined"),
128+ ], 'Warranty',
129 help="If warranty has expired"),
130 'warranty_type': fields.selection(
131 get_warranty_return_partner,
132 'Warranty type',
133+<<<<<<< TREE
134 readonly=True,
135 help="Who is in charge of the warranty return treatment towards "
136 "the end customer. Company will use the current company "
137@@ -145,13 +181,28 @@
138 "to be applied is the one of the return partner (ie: can be "
139 "returned to the company and be under the brand warranty"),
140 'warranty_return_partner': fields.many2one(
141+=======
142+ help="Who is in charge of the warranty return treatment towards the end customer. "
143+ "Company will use the current company delivery or default address and so on for "
144+ "supplier and brand manufacturer. Does not necessarily mean that the warranty to be "
145+ "applied is the one of the return partner (ie: can be returned to the company and "
146+ "be under the brand warranty"),
147+ "warranty_return_partner" : fields.many2one(
148+>>>>>>> MERGE-SOURCE
149 'res.partner',
150 string='Warranty Address',
151 help="Where the customer has to send back the product(s)"),
152 'claim_id': fields.many2one(
153 'crm.claim', string='Related claim',
154 help="To link to the case.claim object"),
155+<<<<<<< TREE
156 'state': fields.selection(
157+=======
158+ 'company_id': fields.related(
159+ 'claim_id', 'company_id', type="many2one",
160+ relation="res.company", string="Company"),
161+ 'state' : fields.selection(
162+>>>>>>> MERGE-SOURCE
163 [('draft', 'Draft'),
164 ('refused', 'Refused'),
165 ('confirmed', 'Confirmed, waiting for product'),
166@@ -196,6 +247,7 @@
167 'name': 'none',
168 }
169
170+<<<<<<< TREE
171 @staticmethod
172 def warranty_limit(start, warranty_duration):
173 """ Take a duration in float, return the duration in relativedelta
174@@ -263,6 +315,8 @@
175 self.set_warranty(cr, uid, [line.id], context=context)
176 return True
177
178+=======
179+>>>>>>> MERGE-SOURCE
180 def get_destination_location(self, cr, uid, product_id,
181 warehouse_id, context=None):
182 """Compute and return the destination location ID to take
183@@ -281,6 +335,7 @@
184 location_dest_id = seller.name.property_stock_supplier.id
185 return location_dest_id
186
187+<<<<<<< TREE
188 # Method to calculate warranty return address
189 def set_warranty_return_address(self, cr, uid, ids, claim_line,
190 context=None):
191@@ -330,40 +385,35 @@
192 claim_line, context=context)
193 return True
194
195+=======
196+>>>>>>> MERGE-SOURCE
197
198 #TODO add the option to split the claim_line in order to manage the same
199 # product separately
200 class crm_claim(orm.Model):
201 _inherit = 'crm.claim'
202-
203- def _get_sequence_number(self, cr, uid, context=None):
204- seq_obj = self.pool.get('ir.sequence')
205- res = seq_obj.get(cr, uid, 'crm.claim.rma', context=context) or '/'
206- return res
207+ _order = 'number desc'
208
209 def _get_default_warehouse(self, cr, uid, context=None):
210- user_obj = self.pool.get('res.users')
211- user = user_obj.browse(cr, uid, uid, context=context)
212- company_id = user.company_id.id
213- wh_obj = self.pool.get('stock.warehouse')
214- wh_ids = wh_obj.search(cr, uid,
215- [('company_id', '=', company_id)],
216- context=context)
217- if not wh_ids:
218- raise orm.except_orm(
219- _('Error!'),
220- _('There is no warehouse for the current user\'s company.'))
221- return wh_ids[0]
222+ warehouse_model, warehouse_id = self.pool['ir.model.data'].\
223+ get_object_reference(cr, uid, 'stock', 'warehouse0')
224+ assert warehouse_model == 'stock.warehouse', 'Wrong model !'
225+ return warehouse_id
226
227 def name_get(self, cr, uid, ids, context=None):
228 res = []
229 if isinstance(ids, (int, long)):
230 ids = [ids]
231 for claim in self.browse(cr, uid, ids, context=context):
232+<<<<<<< TREE
233 number = claim.number and str(claim.number) or ''
234 res.append((claim.id, '[' + number + '] ' + claim.name))
235+=======
236+ res.append((claim.id, '[%s] %s' % (claim.number, claim.name)))
237+>>>>>>> MERGE-SOURCE
238 return res
239
240+<<<<<<< TREE
241 def create(self, cr, uid, vals, context=None):
242 if ('number' not in vals) or (vals.get('number') == '/'):
243 vals['number'] = self._get_sequence_number(cr, uid,
244@@ -372,22 +422,22 @@
245 return new_id
246
247 def copy_data(self, cr, uid, id, default=None, context=None):
248+=======
249+ def copy(self, cr, uid, id, default=None, context=None):
250+>>>>>>> MERGE-SOURCE
251 if default is None:
252 default = {}
253- std_default = {
254+ default.update({
255 'invoice_ids': False,
256 'picking_ids': False,
257- 'number': self._get_sequence_number(cr, uid, context=context),
258- }
259- std_default.update(default)
260- return super(crm_claim, self).copy_data(
261- cr, uid, id, default=std_default, context=context)
262+ 'number': self.pool['ir.sequence'].get(cr, uid, 'crm.claim.rma'),
263+ })
264+ return super(crm_claim, self).copy(
265+ cr, uid, id, default=default, context=context)
266
267 _columns = {
268 'number': fields.char(
269 'Number', readonly=True,
270- states={'draft': [('readonly', False)]},
271- required=True,
272 select=True,
273 help="Company internal claim unique number"),
274 'claim_type': fields.selection(
275@@ -396,6 +446,7 @@
276 ('other', 'Other')],
277 string='Claim type',
278 required=True,
279+ track_visibility='onchange',
280 help="Customer: from customer to company.\n "
281 "Supplier: from company to supplier."),
282 'claim_line_ids': fields.one2many(
283@@ -409,19 +460,23 @@
284 'account.invoice', 'claim_id', 'Refunds'),
285 'picking_ids': fields.one2many('stock.picking', 'claim_id', 'RMA'),
286 'invoice_id': fields.many2one(
287+<<<<<<< TREE
288 'account.invoice', string='Invoice',
289 help='Related original Cusotmer invoice'),
290 'delivery_address_id': fields.many2one(
291 'res.partner', string='Partner delivery address',
292 help="This address will be used to deliver repaired or replacement"
293 "products."),
294+=======
295+ 'account.invoice', string='Customer Invoice',
296+ help='Related original Customer invoice'),
297+>>>>>>> MERGE-SOURCE
298 'warehouse_id': fields.many2one(
299 'stock.warehouse', string='Warehouse',
300 required=True),
301 }
302
303 _defaults = {
304- 'number': '/',
305 'claim_type': 'customer',
306 'warehouse_id': _get_default_warehouse,
307 }
308@@ -431,11 +486,44 @@
309 'Number/Reference must be unique per Company!'),
310 ]
311
312+<<<<<<< TREE
313 def onchange_partner_address_id(self, cr, uid, ids, add, email=False,
314 context=None):
315 res = super(crm_claim, self
316 ).onchange_partner_address_id(cr, uid, ids, add,
317 email=email)
318+=======
319+ def create(self, cr, uid, vals, context=None):
320+ if not vals:
321+ vals = {}
322+ if not vals.get('number'):
323+ vals['number'] = self.pool['ir.sequence'].next_by_code(
324+ cr, uid, 'crm.claim.rma')
325+ return super(crm_claim, self).create(cr, uid, vals, context=context)
326+
327+ def _get_return_info_from_product(
328+ self, cr, uid, product, company_id, context=None):
329+ seller = product.seller_info_id
330+ if seller:
331+ return_address_id = seller.warranty_return_address.id
332+ return_type = seller.warranty_return_partner
333+ else:
334+ # when no supplier is configured, get the info from the company
335+ if not company_id:
336+ company_id = self.pool['res.company']._company_default_get(
337+ cr, uid, 'claim.line', context=context)
338+ company = self.pool['res.company'].browse(
339+ cr, uid, company_id, context=context)
340+ return_address_id = (company.crm_return_address_id.id or
341+ company.partner_id.id)
342+ return_type = 'company'
343+ return (return_address_id, return_type)
344+
345+ def onchange_partner_address_id(
346+ self, cr, uid, ids, add, email=False, context=None):
347+ res = super(crm_claim, self).onchange_partner_address_id(
348+ cr, uid, ids, add, email=email)
349+>>>>>>> MERGE-SOURCE
350 if add:
351 if (not res['value']['email_from']
352 or not res['value']['partner_phone']):
353@@ -448,26 +536,66 @@
354 res['value']['partner_phone'] = other_add.phone
355 return res
356
357+<<<<<<< TREE
358 def onchange_invoice_id(self, cr, uid, ids, invoice_id, warehouse_id,
359 context=None):
360+=======
361+ def onchange_invoice_id(
362+ self, cr, uid, ids, invoice_id, warehouse_id, claim_date,
363+ company_id, context=None):
364+>>>>>>> MERGE-SOURCE
365 invoice_line_obj = self.pool.get('account.invoice.line')
366 invoice_obj = self.pool.get('account.invoice')
367 claim_line_obj = self.pool.get('claim.line')
368- invoice_line_ids = invoice_line_obj.search(
369- cr, uid,
370- [('invoice_id', '=', invoice_id)],
371- context=context)
372+ if not invoice_id:
373+ return {}
374+ invoice = self.pool['account.invoice'].browse(
375+ cr, uid, invoice_id, context=context)
376+
377+ if not invoice.date_invoice:
378+ raise orm.except_orm(
379+ _('Error'),
380+ _("The invoice %s doesn't have a date. "
381+ "Must be a validated invoice." % invoice.number))
382+ date_inv_dt = datetime.strptime(
383+ invoice.date_invoice, DEFAULT_SERVER_DATE_FORMAT)
384+
385 claim_lines = []
386 value = {}
387 if not warehouse_id:
388+<<<<<<< TREE
389 warehouse_id = self._get_default_warehouse(cr, uid,
390 context=context)
391 invoice_lines = invoice_line_obj.browse(cr, uid, invoice_line_ids,
392 context=context)
393 for invoice_line in invoice_lines:
394+=======
395+ warehouse_id = self._get_default_warehouse(
396+ cr, uid, context=context)
397+
398+ for invoice_line in invoice.invoice_line:
399+>>>>>>> MERGE-SOURCE
400 location_dest_id = claim_line_obj.get_destination_location(
401 cr, uid, invoice_line.product_id.id,
402 warehouse_id, context=context)
403+
404+ warning = 'not_define'
405+ warranty_duration = invoice_line.product_id.warranty
406+ limit = self.pool['product.product'].warranty_limit(
407+ cr, uid, date_inv_dt, warranty_duration, context=context)
408+ # If warranty period was defined
409+ if warranty_duration > 0:
410+ claim_date_dt = datetime.strptime(
411+ claim_date, DEFAULT_SERVER_DATETIME_FORMAT)
412+ if limit < claim_date_dt:
413+ warning = 'expired'
414+ else:
415+ warning = 'valid'
416+
417+ return_address_id, return_type = \
418+ self._get_return_info_from_product(
419+ cr, uid, product, company_id, context=context)
420+
421 claim_lines.append({
422 'name': invoice_line.name,
423 'claim_origine': "none",
424@@ -477,6 +605,10 @@
425 'unit_sale_price': invoice_line.price_unit,
426 'location_dest_id': location_dest_id,
427 'state': 'draft',
428+ 'warranty_return_partner': return_address_id,
429+ 'warranty_type': return_type,
430+ 'guarantee_limit': limit.strftime(DEFAULT_SERVER_DATE_FORMAT),
431+ 'warning': warning,
432 })
433 value = {'claim_line_ids': claim_lines}
434 delivery_address_id = False
435
436=== modified file 'crm_claim_rma/crm_claim_rma_data.xml'
437--- crm_claim_rma/crm_claim_rma_data.xml 2013-04-30 19:15:31 +0000
438+++ crm_claim_rma/crm_claim_rma_data.xml 2015-11-20 10:22:38 +0000
439@@ -1,104 +1,96 @@
440 <?xml version="1.0"?>
441 <openerp>
442- <data noupdate="1">
443- <!-- Claims Sequence n° -->
444- <record id="seq_type_claim" model="ir.sequence.type">
445- <field name="name">CRM Claim</field>
446- <field name="code">crm.claim.rma</field>
447- </record>
448-
449- <record id="seq_claim" model="ir.sequence">
450- <field name="name">CRM Claim</field>
451- <field name="code">crm.claim.rma</field>
452- <field eval="5" name="padding"/>
453- <field name="prefix">RMA-%(year)s/</field>
454- </record>
455-
456- <!--
457- Claim sections
458- -->
459-
460- <record model="crm.case.section" id="section_after_sales_service">
461- <field name="name">After Sales Service</field>
462- <field name="code">ASV</field>
463- <field name="parent_id" ref="crm.section_sales_department"/>
464- <!-- <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'))]"/> -->
465- </record>
466-
467- <!--
468- Claim categories
469- -->
470-
471- <record model="crm.case.categ" id="categ_claim10">
472- <field name="name">No Inventory</field>
473- <field name="section_id" ref="section_after_sales_service"/>
474- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
475- </record>
476-
477- <record model="crm.case.categ" id="categ_claim11">
478- <field name="name">Customer Return</field>
479- <field name="section_id" ref="section_after_sales_service"/>
480- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
481- </record>
482-
483- <record model="crm.case.categ" id="categ_claim12">
484- <field name="name">Buyer Cancelled</field>
485- <field name="section_id" ref="section_after_sales_service"/>
486- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
487- </record>
488-
489- <record model="crm.case.categ" id="categ_claim13">
490- <field name="name">General Adjustement</field>
491- <field name="section_id" ref="section_after_sales_service"/>
492- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
493- </record>
494-
495- <record model="crm.case.categ" id="categ_claim14">
496- <field name="name">Could Not Ship</field>
497- <field name="section_id" ref="section_after_sales_service"/>
498- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
499- </record>
500-
501- <record model="crm.case.categ" id="categ_claim15">
502- <field name="name">Different Item</field>
503- <field name="section_id" ref="section_after_sales_service"/>
504- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
505- </record>
506-
507- <record model="crm.case.categ" id="categ_claim16">
508- <field name="name">Merchandise Not Received</field>
509- <field name="section_id" ref="section_after_sales_service"/>
510- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
511- </record>
512-
513- <record model="crm.case.categ" id="categ_claim17">
514- <field name="name">Merchandise Not As Described</field>
515- <field name="section_id" ref="section_after_sales_service"/>
516- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
517- </record>
518-
519- <record model="crm.case.categ" id="categ_claim18">
520- <field name="name">Pricing Error</field>
521- <field name="section_id" ref="section_after_sales_service"/>
522- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
523- </record>
524-
525- <record model="crm.case.categ" id="categ_claim19">
526- <field name="name">Shipping Address Undeliverable</field>
527- <field name="section_id" ref="section_after_sales_service"/>
528- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
529- </record>
530-
531- <record model="crm.case.categ" id="categ_claim20">
532- <field name="name">Delivered Late by Carrier</field>
533- <field name="section_id" ref="section_after_sales_service"/>
534- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
535- </record>
536-
537- <record model="crm.case.categ" id="categ_claim21">
538- <field name="name">Missed Fulfilment Promise</field>
539- <field name="section_id" ref="section_after_sales_service"/>
540- <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
541- </record>
542- </data>
543+<data noupdate="1">
544+
545+<!-- Claims Sequence n° -->
546+<record id="seq_type_claim" model="ir.sequence.type">
547+ <field name="name">CRM Claim</field>
548+ <field name="code">crm.claim.rma</field>
549+</record>
550+
551+<record id="seq_claim" model="ir.sequence">
552+ <field name="name">CRM Claim</field>
553+ <field name="code">crm.claim.rma</field>
554+ <field name="padding" eval="5"/>
555+ <field name="prefix">RMA-%(year)s/</field>
556+</record>
557+
558+<!-- Claim sections -->
559+
560+<record model="crm.case.section" id="section_after_sales_service">
561+ <field name="name">After Sales Service</field>
562+ <field name="code">ASV</field>
563+ <field name="parent_id" ref="crm.section_sales_department"/>
564+</record>
565+
566+<!-- Claim categories -->
567+
568+<record model="crm.case.categ" id="categ_claim10">
569+ <field name="name">No Inventory</field>
570+ <field name="section_id" ref="section_after_sales_service"/>
571+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
572+</record>
573+
574+<record model="crm.case.categ" id="categ_claim11">
575+ <field name="name">Customer Return</field>
576+ <field name="section_id" ref="section_after_sales_service"/>
577+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
578+</record>
579+
580+<record model="crm.case.categ" id="categ_claim12">
581+ <field name="name">Cancelled by Customer</field>
582+ <field name="section_id" ref="section_after_sales_service"/>
583+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
584+</record>
585+
586+<record model="crm.case.categ" id="categ_claim13">
587+ <field name="name">General Adjustement</field>
588+ <field name="section_id" ref="section_after_sales_service"/>
589+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
590+</record>
591+
592+<record model="crm.case.categ" id="categ_claim14">
593+ <field name="name">Could Not Ship</field>
594+ <field name="section_id" ref="section_after_sales_service"/>
595+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
596+</record>
597+
598+<record model="crm.case.categ" id="categ_claim15">
599+ <field name="name">Different Item</field>
600+ <field name="section_id" ref="section_after_sales_service"/>
601+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
602+</record>
603+
604+<record model="crm.case.categ" id="categ_claim16">
605+ <field name="name">Merchandise Not Received</field>
606+ <field name="section_id" ref="section_after_sales_service"/>
607+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
608+</record>
609+
610+<record model="crm.case.categ" id="categ_claim17">
611+ <field name="name">Merchandise Not As Described</field>
612+ <field name="section_id" ref="section_after_sales_service"/>
613+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
614+</record>
615+
616+<record model="crm.case.categ" id="categ_claim18">
617+ <field name="name">Price Error</field>
618+ <field name="section_id" ref="section_after_sales_service"/>
619+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
620+</record>
621+
622+<record model="crm.case.categ" id="categ_claim19">
623+ <field name="name">Shipping Address Undeliverable</field>
624+ <field name="section_id" ref="section_after_sales_service"/>
625+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
626+</record>
627+
628+<record model="crm.case.categ" id="categ_claim20">
629+ <field name="name">Delivered Late by Carrier</field>
630+ <field name="section_id" ref="section_after_sales_service"/>
631+ <field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
632+</record>
633+
634+
635+</data>
636 </openerp>
637
638=== modified file 'crm_claim_rma/crm_claim_rma_view.xml'
639--- crm_claim_rma/crm_claim_rma_view.xml 2014-04-23 07:07:52 +0000
640+++ crm_claim_rma/crm_claim_rma_view.xml 2015-11-20 10:22:38 +0000
641@@ -7,42 +7,29 @@
642 <field name="name">CRM - Claims Search</field>
643 <field name="model">claim.line</field>
644 <field name="arch" type="xml">
645- <search string="Search Claims">
646- <filter icon="terp-check" string="Current" name="current"
647- domain="[('state','in',('draft', 'refused', 'treated'))]"
648- separator="1" help="Draft and Open Claims" />
649- <filter icon="terp-camera_test"
650- string="In Progress"
651- domain="[('state','in',('confirmed','in_to_control','in_to_treate'))]"
652- separator="1" help="In Progress Claims"/>
653- <separator orientation="vertical"/>
654- <field name="state" select='1'/>
655- <field name="substate_id" select='1'/>
656- <field name="name" select='1'/>
657- <field name="warning" select='1'/>
658- <field name="invoice_line_id" select='1'/>
659- <field name="product_id" select='1'/>
660- <field name="prodlot_id" select='1'/>
661- <newline/>
662- <group expand="0" string="More">
663- <field name="last_state_change" select='1'/>
664- <field name="guarantee_limit" select='1'/>
665- <field name="return_value" select='1'/>
666- <field name="name" select='1'/>
667- </group>
668- <newline/>
669- <group expand="0" string="Group By...">
670- <filter string="Invoice" icon="terp-dolar"
671- domain="[]" help="Invoice"
672+ <search string="Search Return Lines">
673+ <filter string="Current" name="current"
674+ domain="[('state', 'in', ('draft', 'refused', 'treated'))]"
675+ help="Draft and Open Return Lines" />
676+ <filter string="In Progress" name="in_progress"
677+ domain="[('state', 'in', ('confirmed', 'in_to_control', 'in_to_treate'))]"
678+ help="Return Lines In Progress"/>
679+ <field name="state"/>
680+ <field name="substate_id"/>
681+ <field name="name"/>
682+ <field name="warning"/>
683+ <field name="invoice_line_id"/>
684+ <field name="product_id"/>
685+ <field name="prodlot_id"/>
686+ <group string="Group By..." name="group_by">
687+ <filter string="Invoice"
688 context="{'group_by':'invoice_id'}" />
689- <filter string="Product" icon="terp-product"
690- domain="[]" help="Product"
691+ <filter string="Product"
692 context="{'group_by':'product_id'}" />
693- <separator orientation="vertical"/>
694- <filter string="Substate" icon="terp-stage"
695- domain="[]" context="{'group_by':'substate_id'}" />
696- <filter string="Claim n°" icon="terp-emblem-documents"
697- domain="[]" context="{'group_by':'claim_id'}" />
698+ <filter string="Substate"
699+ context="{'group_by':'substate_id'}" />
700+ <filter string="Claim n°"
701+ context="{'group_by':'claim_id'}" />
702 </group>
703 </search>
704 </field>
705@@ -54,16 +41,15 @@
706 <field name="model">claim.line</field>
707 <field name="arch" type="xml">
708 <tree string="Returned lines">
709- <field name="claim_id" invisible="1"/>
710+ <field name="claim_id" invisible="not context.get('claim_line_main_view')"/>
711 <field name="state"/>
712 <field name="substate_id"/>
713 <field name="product_id"/>
714 <field name="name"/>
715 <field name="prodlot_id"/>
716- <field name="warning"/>
717- <field name="warranty_type"/>
718- <field name="warranty_return_partner"/>
719- <button name="set_warranty" string="Compute Waranty" type="object" icon="gtk-justify-fill"/>
720+ <field name="warning"/>
721+ <field name="warranty_type"/>
722+ <field name="warranty_return_partner"/>
723 <field name="product_returned_quantity"/>
724 <field name="claim_origine"/>
725 <field name="refund_line_id"/>
726@@ -79,52 +65,50 @@
727 <field name="model">claim.line</field>
728 <field name="arch" type="xml">
729 <form string="Claim Line" version="7.0">
730- <header>
731- <button name="set_warranty" string="Calculate warranty state" type="object" class="oe_highlight"/>
732- </header>
733- <sheet string="Claims">
734- <div class="oe_title">
735+ <sheet string="Claims">
736+ <div class="oe_title">
737 <group>
738 <label for="name" class="oe_edit_only"/>
739 <h1><field name="name"/></h1>
740 </group>
741- </div>
742- <group>
743- <group string="Returned good">
744- <field name="product_returned_quantity"/>
745- <field name="product_id"/>
746- <field name="prodlot_id"/>
747- <field name="unit_sale_price"/>
748- <field name="return_value"/>
749- </group>
750- <group string="Linked Document">
751- <field name="claim_id" />
752- <field name="invoice_line_id"/>
753- <field name="refund_line_id"/>
754- <field name="move_in_id"/>
755- <field name="move_out_id"/>
756- </group>
757- </group>
758- <group>
759- <group string="Problem">
760- <field name="claim_origine" nolabel="1" colspan="4"/>
761- <field name="claim_descr" nolabel="1" colspan="4"/>
762- </group>
763- <group string="Warranty">
764- <field name="guarantee_limit"/>
765- <field name="warning"/>
766- <field name="warranty_return_partner"/>
767- <field name="warranty_type"/>
768- </group>
769- </group>
770- <separator string="State" colspan="4"/>
771- <group col="6" colspan="4">
772- <field name="state"/>
773- <field name="substate_id" widget='selection' />
774- <field name="last_state_change"/>
775- </group>
776- </sheet>
777- </form>
778+ </div>
779+ <group>
780+ <group string="Returned good">
781+ <field name="product_returned_quantity"/>
782+ <field name="product_id" on_change="product_id_change(product_id, company_id, context)"/>
783+ <field name="prodlot_id" on_change="prodlot_id_change(prodlot_id, company_id, parent.warehouse_id, context)"/>
784+ <field name="unit_sale_price"/>
785+ <field name="return_value"/>
786+ </group>
787+ <group string="Linked Document">
788+ <field name="claim_id" invisible="not context.get('claim_line_main_view')"/>
789+ <field name="company_id" groups="base.group_multi_company"/>
790+ <field name="invoice_line_id"/>
791+ <field name="refund_line_id"/>
792+ <field name="move_in_id"/>
793+ <field name="move_out_id"/>
794+ </group>
795+ </group>
796+ <group>
797+ <group string="Problem">
798+ <field name="claim_origine" nolabel="1" colspan="2"/>
799+ <field name="claim_descr" nolabel="1" colspan="2"/>
800+ </group>
801+ <group string="Warranty">
802+ <field name="guarantee_limit"/>
803+ <field name="warning"/>
804+ <field name="warranty_return_partner"/>
805+ <field name="warranty_type"/>
806+ </group>
807+ <group name="state" string="State">
808+ <field name="state"/>
809+ <field name="substate_id" widget="selection" />
810+ <field name="location_dest_id"/>
811+ <field name="last_state_change"/>
812+ </group>
813+ </group>
814+ </sheet>
815+ </form>
816 </field>
817 </record>
818
819@@ -140,41 +124,48 @@
820 </field>
821 <field name="name" position="before">
822 <field name="number" />
823+ <field name="claim_type" />
824 </field>
825 </field>
826 </record>
827
828- <record model="ir.ui.view" id="crm_case_claims_form_view_replace">
829- <field name="name">CRM - Claims Form</field>
830- <field name="model">crm.claim</field>
831- <field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
832- <field name="arch" type="xml">
833- <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]" position="replace">
834- <field name="categ_id" />
835- </field>
836- </field>
837- </record>
838-
839- <record model="ir.ui.view" id="crm_claim_rma_form_view">
840- <field name="name">CRM - Claim product return Form</field>
841+ <record id="crm_case_claims_form_view" model="ir.ui.view">
842+ <field name="name">CRM RMA - Claims Form</field>
843 <field name="model">crm.claim</field>
844 <field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
845 <field name="arch" type="xml">
846- <page string="Follow Up" position="before">
847+ <xpath expr="//sheet/group" position="before">
848+ <group name="number">
849+ <div class="oe_title">
850+ <label for="number" class="oe_edit_only"/>
851+ <h1><field name="number"/></h1>
852+ </div>
853+ </group>
854+ </xpath>
855+ <field name="date_deadline" position="after">
856+ <field name="claim_type"/>
857+ <field name="warehouse_id" />
858+ </field>
859+ <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]" position="replace">
860+ <field name="categ_id" />
861+ </field>
862+ <notebook position="inside">
863 <page string="Product Return">
864- <group name="Product Return">
865- <separator string="Product Return" colspan="4"/>
866+ <group name="Product Return" string="Product Returns">
867 <group>
868+<<<<<<< TREE
869 <field name="invoice_id" on_change="onchange_invoice_id(invoice_id,warehouse_id,context)" domain="['|',('commercial_partner_id','=',partner_id),('partner_id','=',partner_id)]" />
870 <field name="delivery_address_id" context="{'tree_view_ref': 'crm_claim_rma.view_partner_contact_tree', 'search_default_parent_id': partner_id}"/>
871+=======
872+ <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'}"/>
873+>>>>>>> MERGE-SOURCE
874 </group>
875 <group>
876 <!-- Place for mass return button from crm_rma_lot_mass_return -->
877 </group>
878 <field name="claim_line_ids" nolabel="1" colspan="4" editable="top"/>
879 </group>
880- <group col="4" colspan="4" attrs="{'invisible':[('state', '&lt;&gt;','open')]}">
881- <separator string="Action" colspan="4" />
882+ <group attrs="{'invisible':[('state', '&lt;&gt;','open')]}" string="Actions on Product Returns" name="actions">
883 <button name="%(action_claim_picking_in)d"
884 string="New Products Return" states="open"
885 type="action" target="new"
886@@ -189,7 +180,7 @@
887
888 <button name="%(account.action_account_invoice_refund)d"
889 type='action' string='New Refund'
890- states='open' icon="gtk-execute"
891+ states='open'
892 context="{
893 'invoice_ids': [invoice_id],
894 'claim_line_ids': claim_line_ids,
895@@ -199,16 +190,19 @@
896 </group>
897 </page>
898 <page string="Generated Documents">
899- <separator colspan="2" string="Refunds"/>
900- <field name="invoice_ids" colspan="4" readonly="1"/>
901- <separator colspan="2" string="Receptions / Deliveries"/>
902- <field name="picking_ids" colspan="4" readonly="1"/>
903+ <group name="refunds" string="Refunds">
904+ <field name="invoice_ids" readonly="1" nolabel="1"/>
905+ </group>
906+ <group name="picking" string="Receptions / Deliveries">
907+ <field name="picking_ids" readonly="1" nolabel="1"/>
908+ </group>
909 </page>
910- </page>
911+ </notebook>
912 </field>
913 </record>
914
915
916+<<<<<<< TREE
917 <!-- Right side link to orders -->
918 <act_window
919 id="act_crm_claim_rma_sale_orders"
920@@ -321,6 +315,8 @@
921 </field>
922 </record>
923
924+=======
925+>>>>>>> MERGE-SOURCE
926 <!-- Crm claim Search view -->
927 <record id="view_crm_case_claims_filter" model="ir.ui.view">
928 <field name="name">CRM - Claims Search</field>
929@@ -330,13 +326,37 @@
930 <field name="name" string="Claims" position="before">
931 <field name="number"/>
932 </field>
933- <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" position="before">
934- <filter string="Sales Team" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'section_id'}"/>
935+ <filter string="Stage" context="{'group_by':'stage_id'}" position="before">
936+ <filter string="Sales Team" name="section_id_groupby" context="{'group_by':'section_id'}"/>
937+ <filter string="Claim Type" name="claim_type_groupby" context="{'group_by':'claim_type'}"/>
938 </filter>
939 </field>
940 </record>
941
942-
943+ <record id="substate_substate_form" model="ir.ui.view">
944+ <field name="name">substate.substate.form</field>
945+ <field name="model">substate.substate</field>
946+ <field name="arch" type="xml">
947+ <form string="Return Line Substates" version="7.0">
948+ <group name="main">
949+ <field name="name"/>
950+ <field name="substate_descr"/>
951+ </group>
952+ </form>
953+ </field>
954+ </record>
955+
956+ <record id="substate_substate_tree" model="ir.ui.view">
957+ <field name="name">substate.substate.tree</field>
958+ <field name="model">substate.substate</field>
959+ <field name="arch" type="xml">
960+ <tree string="Return Line Substates">
961+ <field name="name"/>
962+ </tree>
963+ </field>
964+ </record>
965+
966+
967 <!-- Menu -->
968 <record model="ir.actions.act_window" id="crm_claim.crm_case_categ_claim0">
969 <field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field>
970@@ -344,23 +364,28 @@
971
972 <!-- return lines action -->
973 <record model="ir.actions.act_window" id="act_crm_case_claim_lines">
974- <field name="name">Claim lines</field>
975+ <field name="name">Return Lines</field>
976 <field name="res_model">claim.line</field>
977 <field name="view_type">form</field>
978 <field name="view_mode">tree,form</field>
979- <field name="view_id" ref="crm_claim_line_tree_view"/>
980- <field name="search_view_id" ref="view_crm_claim_lines_filter"/>
981+ <field name="context">{'claim_line_main_view': True}</field>
982 </record>
983 <!-- substates action -->
984 <record id="act_crm_claim_substates" model="ir.actions.act_window">
985- <field name="name">Claim line substates</field>
986+ <field name="name">Return Line Substates</field>
987 <field name="res_model">substate.substate</field>
988 <field name="view_type">form</field>
989+ <field name="view_mode">tree,form</field>
990 </record>
991 <!-- Menu -->
992- <menuitem name="Return lines" id="menu_crm_case_claims_claim_lines"
993+ <menuitem id="menu_crm_case_claims_claim_lines"
994 parent="base.menu_aftersale" action="act_crm_case_claim_lines" sequence="2"/>
995- <menuitem name="Returned line substates" id="menu_crm_case_claims_claim_line_substates"
996+ <menuitem id="menu_crm_case_claims_claim_line_substates"
997 parent="crm_claim.menu_config_claim" action="act_crm_claim_substates" sequence="2"/>
998+
999+ <!-- Add group RMA User to menu entry "After-Sale Services" -->
1000+ <record id="base.menu_aftersale" model="ir.ui.menu">
1001+ <field name="groups_id" eval="[(4, ref('group_rma_user'))]"/>
1002+ </record>
1003 </data>
1004 </openerp>
1005
1006=== modified file 'crm_claim_rma/security/ir.model.access.csv'
1007--- crm_claim_rma/security/ir.model.access.csv 2013-02-11 14:26:42 +0000
1008+++ crm_claim_rma/security/ir.model.access.csv 2015-11-20 10:22:38 +0000
1009@@ -1,7 +1,14 @@
1010-"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1011-"access_substate_user","substate.substate.user","model_substate_substate","base.group_sale_salesman_all_leads","True","True","True",
1012-"access_claim_line_user","claim.line.user","model_claim_line","base.group_sale_salesman_all_leads","True","True","True",
1013-"access_substate_manager","substate.substate.manager","model_substate_substate","base.group_sale_manager","True","True","True","True"
1014-"access_claim_line_manager","claim.line.manager","model_claim_line","base.group_sale_manager","True","True","True","True"
1015-"access_substate_user","substate.substate.user","model_substate_substate","base.group_sale_salesman","True","True","True",
1016-"access_claim_line_user","claim.line.user","model_claim_line","base.group_sale_salesman","True","True","True",
1017+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
1018+access_substate_user,Read access on substate.substate to Sale User,model_substate_substate,base.group_sale_salesman,1,0,0,0
1019+access_substate_manager,substate.substate.manager,model_substate_substate,base.group_sale_manager,1,1,1,1
1020+access_substate_rma_user,Read access on substate.substate to RMA User,model_substate_substate,group_rma_user,1,0,0,0
1021+access_substate_rma_manager,Full access on substate.substate to RMA Manager,model_substate_substate,group_rma_manager,1,1,1,1
1022+access_claim_line_user,claim.line.user,model_claim_line,base.group_sale_salesman,1,1,1,0
1023+access_claim_line_manager,claim.line.manager,model_claim_line,base.group_sale_manager,1,1,1,1
1024+access_claim_line_rma_user,Access on claim.line to RMA User,model_claim_line,group_rma_user,1,1,1,0
1025+access_claim_line_rma_manager,Full Access on claim.line to RMA Manager,model_claim_line,group_rma_manager,1,1,1,1
1026+access_crm_claim_rma_user,Access on crm.claim to RMA User,crm_claim.model_crm_claim,group_rma_user,1,1,1,0
1027+access_crm_claim_rma_manager,Access on crm.claim to RMA Manager,crm_claim.model_crm_claim,group_rma_manager,1,1,1,1
1028+access_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
1029+access_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
1030+access_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
1031
1032=== added file 'crm_claim_rma/security/rma_group.xml'
1033--- crm_claim_rma/security/rma_group.xml 1970-01-01 00:00:00 +0000
1034+++ crm_claim_rma/security/rma_group.xml 2015-11-20 10:22:38 +0000
1035@@ -0,0 +1,30 @@
1036+<?xml version="1.0" encoding="utf-8"?>
1037+<!--
1038+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
1039+ @author: Alexis de Lattre <alexis.delattre@akretion.com>
1040+ The licence is in the file __openerp__.py
1041+-->
1042+
1043+<openerp>
1044+<data noupdate="1">
1045+
1046+
1047+<record id="module_category_rma" model="ir.module.category">
1048+ <field name="name">RMA</field>
1049+ <field name="sequence">30</field>
1050+</record>
1051+
1052+<record id="group_rma_user" model="res.groups">
1053+ <field name="name">User</field>
1054+ <field name="category_id" ref="module_category_rma"/>
1055+</record>
1056+
1057+<record id="group_rma_manager" model="res.groups">
1058+ <field name="name">Manager</field>
1059+ <field name="category_id" ref="module_category_rma"/>
1060+ <field name="implied_ids" eval="[(4, ref('group_rma_user'))]"/>
1061+</record>
1062+
1063+
1064+</data>
1065+</openerp>
1066
1067=== modified file 'crm_claim_rma/stock_view.xml'
1068--- crm_claim_rma/stock_view.xml 2014-02-26 11:11:38 +0000
1069+++ crm_claim_rma/stock_view.xml 2015-11-20 10:22:38 +0000
1070@@ -24,16 +24,20 @@
1071 </xpath>
1072 </field>
1073 </record>
1074-
1075+
1076 <record id="view_picking_in_search" model="ir.ui.view">
1077 <field name="name">crm_claim_rma.picking_in_search</field>
1078 <field name="model">stock.picking.in</field>
1079 <field name="inherit_id" ref="stock.view_picking_in_search" />
1080 <field name="arch" type="xml">
1081- <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]" position="after">
1082+ <filter string="To Invoice" name="to_invoice" position="after">
1083 <separator/>
1084+<<<<<<< TREE
1085 <filter string="RMA" icon="terp-accessories-archiver-minus" domain="[('claim_id', '!=', 'False')]" />
1086 <field name="claim_id" string="RMA" invisible="True"/>
1087+=======
1088+ <filter string="RMA" domain="[('claim_id', '!=', 'False')]" />
1089+>>>>>>> MERGE-SOURCE
1090 </filter>
1091 </field>
1092 </record>
1093@@ -43,9 +47,9 @@
1094 <field name="model">stock.picking.out</field>
1095 <field name="inherit_id" ref="stock.view_picking_out_search" />
1096 <field name="arch" type="xml">
1097- <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Delivery orders to invoice" position="after">
1098+ <filter name="to_invoice" string="To Invoice" position="after">
1099 <separator/>
1100- <filter string="RMA" icon="terp-accessories-archiver-minus" domain="[('claim_id', '!=', 'False')]" />
1101+ <filter string="RMA" domain="[('claim_id', '!=', 'False')]" />
1102 </filter>
1103 </field>
1104 </record>
1105
1106=== modified file 'crm_claim_rma/wizard/claim_make_picking_view.xml'
1107--- crm_claim_rma/wizard/claim_make_picking_view.xml 2013-12-20 14:31:15 +0000
1108+++ crm_claim_rma/wizard/claim_make_picking_view.xml 2015-11-20 10:22:38 +0000
1109@@ -12,13 +12,15 @@
1110 <field name="model">claim_make_picking.wizard</field>
1111 <field name="arch" type="xml">
1112 <form string="Select exchange lines to add in picking" version="7.0">
1113- <separator string="Locations" colspan="4"/>
1114- <field name="claim_line_source_location" nolabel="1" />
1115- <field name="claim_line_dest_location" nolabel="1" />
1116- <separator string="Select lines for picking" colspan="4"/>
1117- <field name="claim_line_ids" nolabel="1" colspan="4"/>
1118+ <group name="locations" string="Locations">
1119+ <field name="claim_line_source_location" />
1120+ <field name="claim_line_dest_location" />
1121+ </group>
1122+ <group name="lines" string="Select Lines for Picking">
1123+ <field name="claim_line_ids" nolabel="1"/>
1124+ </group>
1125 <footer>
1126- <button name="action_create_picking" string="Create picking" type="object" class="oe_highlight"/>
1127+ <button name="action_create_picking" string="Create Picking" type="object" class="oe_highlight"/>
1128 or
1129 <button string="Cancel" class="oe_link" special="cancel" />
1130 </footer>
1131@@ -28,7 +30,6 @@
1132
1133 <record id="action_claim_picking_in" model="ir.actions.act_window">
1134 <field name="name">Return Products</field>
1135- <field name="type">ir.actions.act_window</field>
1136 <field name="res_model">claim_make_picking.wizard</field>
1137 <field name="src_model">crm.claim</field>
1138 <field name="view_type">form</field>
1139@@ -39,7 +40,6 @@
1140
1141 <record id="action_claim_picking_out" model="ir.actions.act_window">
1142 <field name="name">Create Outgoing Shipments</field>
1143- <field name="type">ir.actions.act_window</field>
1144 <field name="res_model">claim_make_picking.wizard</field>
1145 <field name="src_model">crm.claim</field>
1146 <field name="view_type">form</field>
1147
1148=== modified file 'crm_rma_advance_location/__openerp__.py'
1149--- crm_rma_advance_location/__openerp__.py 2013-11-15 13:24:39 +0000
1150+++ crm_rma_advance_location/__openerp__.py 2015-11-20 10:22:38 +0000
1151@@ -2,7 +2,7 @@
1152 ##############################################################################
1153 #
1154 # Copyright 2013 Camptocamp
1155-# Copyright 2009-2013 Akretion,
1156+# Copyright 2009-2013 Akretion
1157 # Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
1158 #
1159 # This program is free software: you can redistribute it and/or modify
1160@@ -40,10 +40,10 @@
1161 * Refurbish
1162 * Mistake Loss
1163
1164-And also various wizards on icoming deliveries that allow you to move your goods easily in those
1165+And also various wizards on incoming deliveries that allow you to move your goods easily to those
1166 new locations from a done reception.
1167
1168-Using this module make the logistic flow of return a bit more complexe:
1169+Using this module make the logistic flow of return a bit more complex:
1170
1171 * Returning product goes into RMA location with a incoming shipment
1172 * From the incoming shipment, forward them to another places (stock, loss,...)
1173
1174=== modified file 'crm_rma_advance_location/claim_rma_view.xml'
1175--- crm_rma_advance_location/claim_rma_view.xml 2013-11-15 13:24:39 +0000
1176+++ crm_rma_advance_location/claim_rma_view.xml 2015-11-20 10:22:38 +0000
1177@@ -1,20 +1,22 @@
1178 <?xml version="1.0"?>
1179 <openerp>
1180- <data>
1181- <record model="ir.ui.view" id="crm_claim_rma_form_view">
1182- <field name="name">CRM - Claim product return Form</field>
1183- <field name="model">crm.claim</field>
1184- <field name="inherit_id" ref="crm_claim_rma.crm_claim_rma_form_view"/>
1185- <field name="arch" type="xml">
1186- <xpath expr="//button[@string='New Delivery']" position="after">
1187- <button name="%(action_claim_picking_loss)d"
1188- string="New Product Loss" states="open"
1189- type="action" target="new"
1190- context="{'warehouse_id': warehouse_id,
1191- 'partner_id': partner_id}"/>
1192- </xpath>
1193- </field>
1194- </record>
1195-
1196- </data>
1197+<data>
1198+
1199+<record id="crm_claim_rma_form_view" model="ir.ui.view">
1200+ <field name="name">CRM - Claim product return Form</field>
1201+ <field name="model">crm.claim</field>
1202+ <field name="inherit_id" ref="crm_claim_rma.crm_case_claims_form_view"/>
1203+ <field name="arch" type="xml">
1204+ <xpath expr="//button[@string='New Delivery']" position="after">
1205+ <button name="%(action_claim_picking_loss)d"
1206+ string="New Product Loss" states="open"
1207+ type="action" target="new"
1208+ context="{'warehouse_id': warehouse_id,
1209+ 'partner_id': partner_id}"/>
1210+ </xpath>
1211+ </field>
1212+</record>
1213+
1214+
1215+</data>
1216 </openerp>
1217
1218=== modified file 'crm_rma_advance_location/stock.py'
1219--- crm_rma_advance_location/stock.py 2013-12-03 10:27:02 +0000
1220+++ crm_rma_advance_location/stock.py 2015-11-20 10:22:38 +0000
1221@@ -2,7 +2,7 @@
1222 ##############################################################################
1223 #
1224 # Copyright 2013 Camptocamp
1225-# Copyright 2009-2013 Akretion,
1226+# Copyright 2009-2013 Akretion
1227 # Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
1228 #
1229 # This program is free software: you can redistribute it and/or modify
1230
1231=== modified file 'crm_rma_advance_location/stock_view.xml'
1232--- crm_rma_advance_location/stock_view.xml 2013-11-14 10:07:54 +0000
1233+++ crm_rma_advance_location/stock_view.xml 2015-11-20 10:22:38 +0000
1234@@ -11,7 +11,7 @@
1235 <!-- Those wizard aren't working yet -->
1236 <xpath expr="/form/header/button[@string='Return Products']" position="after">
1237 <button name="%(action_stock_picking_from_claim_picking)d"
1238- string="Product to stock" type="action"
1239+ string="Product to Stock" type="action"
1240 attrs="{'invisible':['|',
1241 ('state','&lt;&gt;','done'),
1242 ('claim_id', '=', False)]}"/>
1243@@ -21,7 +21,7 @@
1244 ('state','&lt;&gt;','done'),
1245 ('claim_id', '=', False)]}"/>
1246 <button name="%(action_used_picking_from_claim_picking)d"
1247- string="Product to refurbish stock" type="action"
1248+ string="Product to Refurbish" type="action"
1249 attrs="{'invisible':['|',
1250 ('state','&lt;&gt;','done'),
1251 ('claim_id', '=', False)]}"/>
1252@@ -42,7 +42,6 @@
1253 </xpath>
1254 </field>
1255 </record>
1256-
1257
1258 </data>
1259 </openerp>
1260
1261=== modified file 'crm_rma_advance_location/wizard/__init__.py'
1262--- crm_rma_advance_location/wizard/__init__.py 2013-11-14 10:07:54 +0000
1263+++ crm_rma_advance_location/wizard/__init__.py 2015-11-20 10:22:38 +0000
1264@@ -2,7 +2,7 @@
1265 ##############################################################################
1266 #
1267 # Copyright 2013 Camptocamp
1268-# Copyright 2009-2013 Akretion,
1269+# Copyright 2009-2013 Akretion
1270 # Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
1271 #
1272 # This program is free software: you can redistribute it and/or modify
1273@@ -20,4 +20,4 @@
1274 #
1275 ##############################################################################
1276 from . import claim_make_picking_from_picking
1277-from . import claim_make_picking
1278\ No newline at end of file
1279+from . import claim_make_picking
1280
1281=== modified file 'crm_rma_advance_location/wizard/claim_make_picking.py'
1282--- crm_rma_advance_location/wizard/claim_make_picking.py 2013-12-03 10:33:50 +0000
1283+++ crm_rma_advance_location/wizard/claim_make_picking.py 2015-11-20 10:22:38 +0000
1284@@ -1,26 +1,28 @@
1285 # -*- coding: utf-8 -*-
1286 #########################################################################
1287-# #
1288-# #
1289-#########################################################################
1290-# #
1291-# crm_claim_rma for OpenERP #
1292-# Copyright (C) 2009-2012 Akretion, Emmanuel Samyn, #
1293-# Benoît GUILLOT <benoit.guillot@akretion.com> #
1294-#This program is free software: you can redistribute it and/or modify #
1295-#it under the terms of the GNU General Public License as published by #
1296-#the Free Software Foundation, either version 3 of the License, or #
1297-#(at your option) any later version. #
1298-# #
1299-#This program is distributed in the hope that it will be useful, #
1300-#but WITHOUT ANY WARRANTY; without even the implied warranty of #
1301-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
1302-#GNU General Public License for more details. #
1303-# #
1304-#You should have received a copy of the GNU General Public License #
1305-#along with this program. If not, see <http://www.gnu.org/licenses/>. #
1306-#########################################################################
1307+#
1308+# crm_claim_rma_advance_location for OpenERP
1309+# Copyright (C) 2009-2014 Emmanuel Samyn
1310+# Copyright (C) 2009-2014 Akretion (http://www.akretion.com)
1311+# Authors: Emmanuel Samyn, Benoît GUILLOT <benoit.guillot@akretion.com>
1312+#
1313+# This program is free software: you can redistribute it and/or modify
1314+# it under the terms of the GNU Affero General Public License as
1315+# published by the Free Software Foundation, either version 3 of the
1316+# License, or (at your option) any later version.
1317+#
1318+# This program is distributed in the hope that it will be useful,
1319+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1320+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1321+# GNU Affero General Public License for more details.
1322+#
1323+# You should have received a copy of the GNU Affero General Public License
1324+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1325+#
1326+#########################################################################
1327+
1328 from openerp.osv import orm
1329+from openerp.tools.translate import _
1330
1331
1332 class claim_make_picking(orm.TransientModel):
1333@@ -29,23 +31,27 @@
1334
1335 def _get_dest_loc(self, cr, uid, context=None):
1336 """ Get default destination location """
1337- loc_id = super(claim_make_picking, self)._get_dest_loc(cr, uid, context=context)
1338 if context is None:
1339 context = {}
1340- warehouse_obj = self.pool.get('stock.warehouse')
1341+ loc_id = super(claim_make_picking, self)._get_dest_loc(
1342+ cr, uid, context=context)
1343 warehouse_id = context.get('warehouse_id')
1344+ warehouse = self.pool['stock.warehouse'].browse(
1345+ cr, uid, warehouse_id, context=context)
1346 if context.get('picking_type') == 'in':
1347- loc_id = warehouse_obj.read(
1348- cr, uid,
1349- warehouse_id,
1350- ['lot_rma_id'],
1351- context=context)['lot_rma_id'][0]
1352+ loc_id = warehouse.lot_rma_id.id or False
1353+ if not loc_id:
1354+ raise orm.except_orm(
1355+ _('Error:'),
1356+ _("Missing RMA stock location on warehouse '%s'")
1357+ % warehouse.name)
1358 elif context.get('picking_type') == 'loss':
1359- loc_id = warehouse_obj.read(
1360- cr, uid,
1361- warehouse_id,
1362- ['lot_carrier_loss_id'],
1363- context=context)['lot_carrier_loss_id'][0]
1364+ loc_id = warehouse.lot_carrier_loss_id.id or False
1365+ if not loc_id:
1366+ raise orm.except_orm(
1367+ _('Error:'),
1368+ _("Missing Carrier Loss stock location on warehouse '%s'")
1369+ % warehouse.name)
1370 return loc_id
1371
1372 _defaults = {
1373
1374=== modified file 'crm_rma_advance_location/wizard/claim_make_picking_from_picking.py'
1375--- crm_rma_advance_location/wizard/claim_make_picking_from_picking.py 2013-11-21 15:41:37 +0000
1376+++ crm_rma_advance_location/wizard/claim_make_picking_from_picking.py 2015-11-20 10:22:38 +0000
1377@@ -1,27 +1,28 @@
1378 # -*- coding: utf-8 -*-
1379 #########################################################################
1380-# #
1381-# #
1382-#########################################################################
1383-# #
1384-# crm_claim_rma for OpenERP #
1385-# Copyright (C) 2009-2012 Akretion, Emmanuel Samyn, #
1386-# Benoît GUILLOT <benoit.guillot@akretion.com> #
1387-#This program is free software: you can redistribute it and/or modify #
1388-#it under the terms of the GNU General Public License as published by #
1389-#the Free Software Foundation, either version 3 of the License, or #
1390-#(at your option) any later version. #
1391-# #
1392-#This program is distributed in the hope that it will be useful, #
1393-#but WITHOUT ANY WARRANTY; without even the implied warranty of #
1394-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
1395-#GNU General Public License for more details. #
1396-# #
1397-#You should have received a copy of the GNU General Public License #
1398-#along with this program. If not, see <http://www.gnu.org/licenses/>. #
1399-#########################################################################
1400+#
1401+# crm_claim_rma_advance_location for OpenERP
1402+# Copyright (C) 2009-2014 Emmanuel Samyn
1403+# Copyright (C) 2009-2014 Akretion (http://www.akretion.com)
1404+# Authors: Emmanuel Samyn, Benoît GUILLOT <benoit.guillot@akretion.com>
1405+#
1406+# This program is free software: you can redistribute it and/or modify
1407+# it under the terms of the GNU Affero General Public License as
1408+# published by the Free Software Foundation, either version 3 of the
1409+# License, or (at your option) any later version.
1410+#
1411+# This program is distributed in the hope that it will be useful,
1412+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1413+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+# GNU Affero General Public License for more details.
1415+#
1416+# You should have received a copy of the GNU Affero General Public License
1417+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1418+#
1419+#########################################################################
1420+
1421 from openerp.osv import fields, orm
1422-from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
1423+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
1424 from openerp import netsvc
1425 import time
1426
1427@@ -31,15 +32,16 @@
1428 _name = 'claim_make_picking_from_picking.wizard'
1429 _description = 'Wizard to create pickings from picking lines'
1430 _columns = {
1431- 'picking_line_source_location': fields.many2one('stock.location',
1432- 'Source Location',
1433+ 'picking_line_source_location': fields.many2one(
1434+ 'stock.location', 'Source Location',
1435 help="Location where the returned products are from.",
1436 required=True),
1437- 'picking_line_dest_location': fields.many2one('stock.location',
1438- 'Dest. Location',
1439+ 'picking_line_dest_location': fields.many2one(
1440+ 'stock.location', 'Dest. Location',
1441 help="Location where the system will stock the returned products.",
1442 required=True),
1443- 'picking_line_ids': fields.many2many('stock.move',
1444+ 'picking_line_ids': fields.many2many(
1445+ 'stock.move',
1446 'claim_picking_line_picking',
1447 'claim_picking_id',
1448 'picking_line_id',
1449@@ -47,31 +49,36 @@
1450 }
1451
1452 def _get_default_warehouse(self, cr, uid, context=None):
1453- warehouse_id=self.pool.get('crm.claim')._get_default_warehouse(cr, uid, context=context)
1454+ warehouse_id = self.pool['crm.claim']._get_default_warehouse(
1455+ cr, uid, context=context)
1456 return warehouse_id
1457
1458 def _get_picking_lines(self, cr, uid, context):
1459- return self.pool.get('stock.picking').read(cr, uid,
1460- context['active_id'], ['move_lines'], context=context)['move_lines']
1461+ return self.pool.get('stock.picking').read(
1462+ cr, uid, context['active_id'], ['move_lines'],
1463+ context=context)['move_lines']
1464
1465 # Get default source location
1466 def _get_source_loc(self, cr, uid, context):
1467- if context is None: context = {}
1468+ if context is None:
1469+ context = {}
1470 warehouse_obj = self.pool.get('stock.warehouse')
1471 warehouse_id = self._get_default_warehouse(cr, uid, context=context)
1472- return warehouse_obj.read(cr, uid,
1473- warehouse_id, ['lot_rma_id'], context=context)['lot_rma_id'][0]
1474+ return warehouse_obj.read(
1475+ cr, uid, warehouse_id, ['lot_rma_id'],
1476+ context=context)['lot_rma_id'][0]
1477
1478 # Get default destination location
1479 def _get_dest_loc(self, cr, uid, context):
1480- if context is None: context = {}
1481+ if context is None:
1482+ context = {}
1483 warehouse_id = self._get_default_warehouse(cr, uid, context=context)
1484 warehouse_obj = self.pool.get('stock.warehouse')
1485 if context.get('picking_type'):
1486- context_loc = context.get('picking_type')[8:]
1487- loc_field = 'lot_%s_id' %context.get('picking_type')[8:]
1488- loc_id = warehouse_obj.read(cr, uid,
1489- warehouse_id, [loc_field], context=context)[loc_field][0]
1490+ loc_field = 'lot_%s_id' % context.get('picking_type')[8:]
1491+ loc_id = warehouse_obj.read(
1492+ cr, uid, warehouse_id, [loc_field],
1493+ context=context)[loc_field][0]
1494 return loc_id
1495
1496 _defaults = {
1497@@ -80,9 +87,6 @@
1498 'picking_line_ids': _get_picking_lines,
1499 }
1500
1501- def action_cancel(self,cr,uid,ids,conect=None):
1502- return {'type': 'ir.actions.act_window_close',}
1503-
1504 # If "Create" button pressed
1505 def action_create_picking_from_picking(self, cr, uid, ids, context=None):
1506 picking_obj = self.pool.get('stock.picking')
1507@@ -162,5 +166,3 @@
1508 'res_id': picking_id,
1509 'type': 'ir.actions.act_window',
1510 }
1511-
1512-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1513
1514=== modified file 'crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml'
1515--- crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml 2013-11-14 10:07:54 +0000
1516+++ crm_rma_advance_location/wizard/claim_make_picking_from_picking_view.xml 2015-11-20 10:22:38 +0000
1517@@ -1,6 +1,5 @@
1518 <?xml version="1.0" encoding="utf-8"?>
1519 <!--
1520- crm_claim_rma for OpenERP
1521 Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>
1522 The licence is in the file __openerp__.py
1523 -->
1524@@ -11,26 +10,27 @@
1525 <field name="name">claim_picking</field>
1526 <field name="model">claim_make_picking_from_picking.wizard</field>
1527 <field name="arch" type="xml">
1528- <form string="Select lines to add in picking">
1529- <separator string="Locations" colspan="4"/>
1530- <field name="picking_line_source_location" nolabel="1" />
1531- <field name="picking_line_dest_location" nolabel="1" />
1532- <separator string="Select lines for picking" colspan="4"/>
1533- <field name="picking_line_ids" nolabel="1" colspan="4"/>
1534- <group col="4" colspan="2">
1535- <button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
1536- <button name="action_create_picking_from_picking" string="Create picking"
1537- icon='gtk-ok' type="object"/>
1538- </group>
1539+ <form string="Select lines to add in picking" version="7.0">
1540+ <group string="Locations">
1541+ <field name="picking_line_source_location" />
1542+ <field name="picking_line_dest_location" />
1543+ </group>
1544+ <group string="Select lines for picking">
1545+ <field name="picking_line_ids" nolabel="1"/>
1546+ </group>
1547+ <footer>
1548+ <button name="action_create_picking_from_picking"
1549+ string="Create Picking"
1550+ class="oe_highlight" type="object"/>
1551+ <button special="cancel" string="Cancel" type="object" class="oe_link"/>
1552+ </footer>
1553 </form>
1554 </field>
1555- </record>
1556+ </record>
1557
1558 <record id="action_stock_picking_from_claim_picking" model="ir.actions.act_window">
1559 <field name="name">Create Incomming Shipment to Stock</field>
1560- <field name="type">ir.actions.act_window</field>
1561 <field name="res_model">claim_make_picking_from_picking.wizard</field>
1562- <field name="src_model">stock.picking</field>
1563 <field name="view_type">form</field>
1564 <field name="view_mode">form</field>
1565 <field name="target">new</field>
1566@@ -39,9 +39,7 @@
1567
1568 <record id="action_loss_picking_from_claim_picking" model="ir.actions.act_window">
1569 <field name="name">Create Incomming Shipment to Breakkage Loss Location</field>
1570- <field name="type">ir.actions.act_window</field>
1571 <field name="res_model">claim_make_picking_from_picking.wizard</field>
1572- <field name="src_model">stock.picking</field>
1573 <field name="view_type">form</field>
1574 <field name="view_mode">form</field>
1575 <field name="target">new</field>
1576@@ -50,9 +48,7 @@
1577
1578 <record id="action_used_picking_from_claim_picking" model="ir.actions.act_window">
1579 <field name="name">Create Incomming Shipment to Refurbish Location</field>
1580- <field name="type">ir.actions.act_window</field>
1581 <field name="res_model">claim_make_picking_from_picking.wizard</field>
1582- <field name="src_model">stock.picking</field>
1583 <field name="view_type">form</field>
1584 <field name="view_mode">form</field>
1585 <field name="target">new</field>
1586
1587=== modified file 'crm_rma_advance_location/wizard/claim_make_picking_view.xml'
1588--- crm_rma_advance_location/wizard/claim_make_picking_view.xml 2013-11-14 10:07:54 +0000
1589+++ crm_rma_advance_location/wizard/claim_make_picking_view.xml 2015-11-20 10:22:38 +0000
1590@@ -1,6 +1,5 @@
1591 <?xml version="1.0" encoding="utf-8"?>
1592 <!--
1593- crm_claim_rma for OpenERP
1594 Copyright (C) 2011 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>
1595 The licence is in the file __openerp__.py
1596 -->
1597@@ -9,9 +8,7 @@
1598
1599 <record id="action_claim_picking_loss" model="ir.actions.act_window">
1600 <field name="name">Create Products Loss</field>
1601- <field name="type">ir.actions.act_window</field>
1602 <field name="res_model">claim_make_picking.wizard</field>
1603- <field name="src_model">crm.claim</field>
1604 <field name="view_type">form</field>
1605 <field name="view_mode">form</field>
1606 <field name="target">new</field>
1607
1608=== modified file 'product_warranty/__openerp__.py'
1609--- product_warranty/__openerp__.py 2013-11-21 15:08:21 +0000
1610+++ product_warranty/__openerp__.py 2015-11-20 10:22:38 +0000
1611@@ -47,7 +47,7 @@
1612 'res_company_view.xml',
1613 'product_warranty_view.xml',
1614 ],
1615- 'demo_xml': [],
1616+ 'demo': [],
1617 'test': [],
1618 'installable': True,
1619 'active': False,
1620
1621=== modified file 'product_warranty/product_warranty.py'
1622--- product_warranty/product_warranty.py 2013-12-03 10:26:17 +0000
1623+++ product_warranty/product_warranty.py 2015-11-20 10:22:38 +0000
1624@@ -1,26 +1,31 @@
1625 # -*- coding: utf-8 -*-
1626 #########################################################################
1627-# #
1628-# #
1629-#########################################################################
1630-# #
1631-# Copyright (C) 2009-2011 Akretion, Emmanuel Samyn, Benoît Guillot #
1632-# #
1633-#This program is free software: you can redistribute it and/or modify #
1634-#it under the terms of the GNU General Public License as published by #
1635-#the Free Software Foundation, either version 3 of the License, or #
1636-#(at your option) any later version. #
1637-# #
1638-#This program is distributed in the hope that it will be useful, #
1639-#but WITHOUT ANY WARRANTY; without even the implied warranty of #
1640-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
1641-#GNU General Public License for more details. #
1642-# #
1643-#You should have received a copy of the GNU General Public License #
1644-#along with this program. If not, see <http://www.gnu.org/licenses/>. #
1645+#
1646+# Copyright (C) 2009-2014 Akretion (http://www.akretion.com/)
1647+# Copyright (C) 2009-2014 Emmanuel Samyn
1648+# Authors: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau,
1649+# Benoît Guillot, Joel Grand-Guillaume
1650+#
1651+# This program is free software: you can redistribute it and/or modify
1652+# it under the terms of the GNU Affero General Public License as
1653+# published by the Free Software Foundation, either version 3 of the
1654+# License, or (at your option) any later version.
1655+#
1656+# This program is distributed in the hope that it will be useful,
1657+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1658+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1659+# GNU Affero General Public License for more details.
1660+#
1661+# You should have received a copy of the GNU Affero General Public License
1662+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1663+#
1664 #########################################################################
1665
1666 from openerp.osv import orm, fields
1667+import math
1668+from datetime import datetime
1669+from dateutil.relativedelta import relativedelta
1670+import calendar
1671
1672
1673 class return_instruction(orm.Model):
1674@@ -85,7 +90,7 @@
1675
1676 _columns = {
1677 "warranty_duration": fields.float(
1678- 'Period',
1679+ 'Product Warranty (in months)',
1680 help="Warranty in month for this product/supplier relation. Only for "
1681 "company/supplier relation (purchase order) ; the customer/company "
1682 "relation (sale order) always use the product main warranty field"),
1683@@ -121,3 +126,27 @@
1684 'warranty_return_partner': 'company',
1685 'return_instructions': _get_default_instructions,
1686 }
1687+
1688+
1689+class product_product(orm.Model):
1690+ _inherit = 'product.product'
1691+
1692+ def warranty_limit(self, cr, uid, start, warranty_duration, context=None):
1693+ """ Take a duration in float, return the duration in relativedelta
1694+
1695+ ``relative_delta(months=...)`` only accepts integers.
1696+ We have to extract the decimal part, and then, extend the delta with
1697+ days.
1698+
1699+ """
1700+ decimal_part, months = math.modf(warranty_duration)
1701+ months = int(months)
1702+ # If we have a decimal part, we add the number them as days to
1703+ # the limit. We need to get the month to know the number of
1704+ # days.
1705+ delta = relativedelta(months=months)
1706+ monthday = start + delta
1707+ __, days_month = calendar.monthrange(monthday.year, monthday.month)
1708+ # ignore the rest of the days (hours) since we expect a date
1709+ days = int(days_month * decimal_part)
1710+ return start + relativedelta(months=months, days=days)
1711
1712=== modified file 'product_warranty/res_company_view.xml'
1713--- product_warranty/res_company_view.xml 2013-11-21 15:08:21 +0000
1714+++ product_warranty/res_company_view.xml 2015-11-20 10:22:38 +0000
1715@@ -7,14 +7,12 @@
1716 <field name="name">crm_claim_rma.company_form</field>
1717 <field name="model">res.company</field>
1718 <field name="inherit_id" ref="base.view_company_form" />
1719- <field eval="16" name="priority"/>
1720 <field name="arch" type="xml">
1721- <data>
1722- <field name="company_registry" position="after">
1723- <separator string="Crm product return address" colspan="4"/>
1724+ <page string="Configuration" position="inside">
1725+ <group name="product-warranty" string="Product Warranty">
1726 <field name="crm_return_address_id"/>
1727- </field>
1728- </data>
1729+ </group>
1730+ </page>
1731 </field>
1732 </record>
1733

Subscribers

People subscribed via source and target branches