Merge lp:~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension into lp:openerp-manufacturing

Proposed by Alexis de Lattre
Status: Needs review
Proposed branch: lp:~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension
Merge into: lp:openerp-manufacturing
Diff against target: 516 lines (+490/-0)
5 files modified
mrp_repair_extension/__init__.py (+23/-0)
mrp_repair_extension/__openerp__.py (+43/-0)
mrp_repair_extension/i18n/mrp_repair_extension.pot (+129/-0)
mrp_repair_extension/mrp_repair.py (+59/-0)
mrp_repair_extension/mrp_repair_view.xml (+236/-0)
To merge this branch: bzr merge lp:~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Needs Fixing
Maxime Chambreuil (http://www.savoirfairelinux.com) Approve
Review via email: mp+211696@code.launchpad.net

Description of the change

This MP adds the module mrp_repair_extension.

For those who have already played with the module mrp_repair from the official adds, they may have seen that it contains horrible bugs (such as https://bugs.launchpad.net/openobject-addons/+bug/1281687, which is now fixed) and that the usability is quite poor. The module mrp_repair_extension adds several small usability improvements to the mrp_repair module. It contains several small changes, in particular in the views. Each change is too small to be located in a standalone module, that's why I grouped them in this module. This module must not contain any big change to the mrp_repair module, because big changes should be in dedicated modules.

To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Alexis,

Please explain on manifest description the modifications that this module makes.

Regards.

review: Needs Fixing (code review)

Unmerged revisions

7. By Alexis de Lattre

Add module mrp_repair_extension.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'mrp_repair_extension'
2=== added file 'mrp_repair_extension/__init__.py'
3--- mrp_repair_extension/__init__.py 1970-01-01 00:00:00 +0000
4+++ mrp_repair_extension/__init__.py 2014-03-19 10:38:14 +0000
5@@ -0,0 +1,23 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# MRP Repair Extension module for OpenERP
10+# Copyright (C) 2014 Akretion (http://www.akretion.com)
11+# @author Alexis de Lattre <alexis.delattre@akretion.com>
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+from . import mrp_repair
29
30=== added file 'mrp_repair_extension/__openerp__.py'
31--- mrp_repair_extension/__openerp__.py 1970-01-01 00:00:00 +0000
32+++ mrp_repair_extension/__openerp__.py 2014-03-19 10:38:14 +0000
33@@ -0,0 +1,43 @@
34+# -*- encoding: utf-8 -*-
35+##############################################################################
36+#
37+# MRP Repair extension module for OpenERP
38+# Copyright (C) 2014 Akretion (http://www.akretion.com)
39+# @author Alexis de Lattre <alexis.delattre@akretion.com>
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as
43+# published by the Free Software Foundation, either version 3 of the
44+# License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+
56+
57+{
58+ 'name': 'MRP Repair Extension',
59+ 'version': '0.1',
60+ 'category': 'Manufacturing',
61+ 'license': 'AGPL-3',
62+ 'summary': 'Enhance the mrp_repair module',
63+ 'description': """
64+MRP Repair Extension
65+====================
66+
67+This module adds small enhancements to the official mrp_repair module of OpenERP S.A. This module is NOT designed to implement large enhancement to the mrp_repair module, because large enhancement should be hosted in dedicated modules.
68+
69+Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
70+ """,
71+ 'author': 'Akretion',
72+ 'website': 'http://www.akretion.com',
73+ 'depends': ['mrp_repair'],
74+ 'data': ['mrp_repair_view.xml'],
75+ 'active': False,
76+}
77
78=== added directory 'mrp_repair_extension/i18n'
79=== added file 'mrp_repair_extension/i18n/mrp_repair_extension.pot'
80--- mrp_repair_extension/i18n/mrp_repair_extension.pot 1970-01-01 00:00:00 +0000
81+++ mrp_repair_extension/i18n/mrp_repair_extension.pot 2014-03-19 10:38:14 +0000
82@@ -0,0 +1,129 @@
83+# Translation of OpenERP Server.
84+# This file contains the translation of the following modules:
85+# * mrp_repair_extension
86+#
87+msgid ""
88+msgstr ""
89+"Project-Id-Version: OpenERP Server 7.0\n"
90+"Report-Msgid-Bugs-To: \n"
91+"POT-Creation-Date: 2014-03-19 10:21+0000\n"
92+"PO-Revision-Date: 2014-03-19 10:21+0000\n"
93+"Last-Translator: <>\n"
94+"Language-Team: \n"
95+"MIME-Version: 1.0\n"
96+"Content-Type: text/plain; charset=UTF-8\n"
97+"Content-Transfer-Encoding: \n"
98+"Plural-Forms: \n"
99+
100+#. module: mrp_repair_extension
101+#: view:stock.production.lot:0
102+#: field:stock.production.lot,repair_ids:0
103+msgid "Repairs"
104+msgstr ""
105+
106+#. module: mrp_repair_extension
107+#: field:mrp.repair,user_id:0
108+msgid "Responsible"
109+msgstr ""
110+
111+#. module: mrp_repair_extension
112+#: view:mrp.repair:0
113+msgid "Product Information"
114+msgstr ""
115+
116+#. module: mrp_repair_extension
117+#: view:mrp.repair:0
118+msgid "Add quotation notes..."
119+msgstr ""
120+
121+#. module: mrp_repair_extension
122+#: model:ir.model,name:mrp_repair_extension.model_mrp_repair
123+msgid "Repair Order"
124+msgstr ""
125+
126+#. module: mrp_repair_extension
127+#: field:mrp.repair,date_done:0
128+msgid "Date Done"
129+msgstr ""
130+
131+#. module: mrp_repair_extension
132+#: view:mrp.repair:0
133+msgid "Unit of Measure"
134+msgstr ""
135+
136+#. module: mrp_repair_extension
137+#: view:mrp.repair:0
138+msgid "Invoicing"
139+msgstr ""
140+
141+#. module: mrp_repair_extension
142+#: view:mrp.repair:0
143+msgid "Delivery"
144+msgstr ""
145+
146+#. module: mrp_repair_extension
147+#: model:ir.model,name:mrp_repair_extension.model_stock_production_lot
148+#: view:mrp.repair:0
149+msgid "Serial Number"
150+msgstr ""
151+
152+#. module: mrp_repair_extension
153+#: view:mrp.repair:0
154+msgid "History"
155+msgstr ""
156+
157+#. module: mrp_repair_extension
158+#: view:mrp.repair:0
159+msgid "Labour and Services"
160+msgstr ""
161+
162+#. module: mrp_repair_extension
163+#: view:mrp.repair:0
164+msgid "Repair Line"
165+msgstr ""
166+
167+#. module: mrp_repair_extension
168+#: view:mrp.repair:0
169+msgid "Quantity"
170+msgstr ""
171+
172+#. module: mrp_repair_extension
173+#: view:mrp.repair:0
174+msgid "Operations"
175+msgstr ""
176+
177+#. module: mrp_repair_extension
178+#: view:mrp.repair:0
179+msgid "Hardware Operations"
180+msgstr ""
181+
182+#. module: mrp_repair_extension
183+#: view:mrp.repair:0
184+msgid "Add internal notes..."
185+msgstr ""
186+
187+#. module: mrp_repair_extension
188+#: field:mrp.repair,currency_id:0
189+msgid "Currency"
190+msgstr ""
191+
192+#. module: mrp_repair_extension
193+#: view:mrp.repair:0
194+msgid "Extra Info"
195+msgstr ""
196+
197+#. module: mrp_repair_extension
198+#: view:mrp.repair:0
199+msgid "Fees"
200+msgstr ""
201+
202+#. module: mrp_repair_extension
203+#: view:mrp.repair:0
204+msgid "(update)"
205+msgstr ""
206+
207+#. module: mrp_repair_extension
208+#: help:mrp.repair,date_done:0
209+msgid "Date of completion of the repair"
210+msgstr ""
211+
212
213=== added file 'mrp_repair_extension/mrp_repair.py'
214--- mrp_repair_extension/mrp_repair.py 1970-01-01 00:00:00 +0000
215+++ mrp_repair_extension/mrp_repair.py 2014-03-19 10:38:14 +0000
216@@ -0,0 +1,59 @@
217+# -*- encoding: utf-8 -*-
218+##############################################################################
219+#
220+# MRP Repair Extension module for OpenERP
221+# Copyright (C) 2014 Akretion (http://www.akretion.com)
222+# @author Alexis de Lattre <alexis.delattre@akretion.com>
223+#
224+# This program is free software: you can redistribute it and/or modify
225+# it under the terms of the GNU Affero General Public License as
226+# published by the Free Software Foundation, either version 3 of the
227+# License, or (at your option) any later version.
228+#
229+# This program is distributed in the hope that it will be useful,
230+# but WITHOUT ANY WARRANTY; without even the implied warranty of
231+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
232+# GNU Affero General Public License for more details.
233+#
234+# You should have received a copy of the GNU Affero General Public License
235+# along with this program. If not, see <http://www.gnu.org/licenses/>.
236+#
237+##############################################################################
238+
239+from openerp.osv import orm, fields
240+
241+
242+class mrp_repair(orm.Model):
243+ _inherit = 'mrp.repair'
244+ _order = 'name desc'
245+
246+ _columns = {
247+ 'user_id': fields.many2one('res.users', "Responsible"),
248+ 'date_done': fields.datetime(
249+ 'Date Done', readonly=True,
250+ help='Date of completion of the repair'),
251+ 'currency_id': fields.related(
252+ 'pricelist_id', 'currency_id', type='many2one',
253+ relation='res.currency', string="Currency", readonly=True),
254+ }
255+
256+ _defaults = {
257+ 'user_id': lambda self, cr, uid, ctx: uid,
258+ }
259+
260+ def action_repair_done(self, cr, uid, ids, context=None):
261+ res = super(mrp_repair, self).action_repair_done(
262+ cr, uid, ids, context=context)
263+ self.write(cr, uid, ids, {
264+ 'date_done': fields.datetime.now()
265+ }, context=context)
266+ return res
267+
268+
269+class stock_production_lot(orm.Model):
270+ _inherit = 'stock.production.lot'
271+
272+ _columns = {
273+ 'repair_ids': fields.one2many(
274+ 'mrp.repair', 'prodlot_id', 'Repairs'),
275+ }
276
277=== added file 'mrp_repair_extension/mrp_repair_view.xml'
278--- mrp_repair_extension/mrp_repair_view.xml 1970-01-01 00:00:00 +0000
279+++ mrp_repair_extension/mrp_repair_view.xml 2014-03-19 10:38:14 +0000
280@@ -0,0 +1,236 @@
281+<?xml version="1.0" encoding="utf-8"?>
282+
283+<!--
284+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
285+ @author Alexis de Lattre <alexis.delattre@akretion.com>
286+ The licence is in the file __openerp__.py
287+-->
288+
289+<openerp>
290+<data>
291+
292+
293+<record id="view_repair_order_form" model="ir.ui.view">
294+ <field name="name">mrp.repair.extension.form</field>
295+ <field name="model">mrp.repair</field>
296+ <field name="inherit_id" ref="mrp_repair.view_repair_order_form" />
297+ <field name="arch" type="xml">
298+ <field name="guarantee_limit" position="after">
299+ <field name="user_id"/>
300+ <field name="date_done"/>
301+ <field name="currency_id" invisible="1"/>
302+ </field>
303+ <!-- Unfortunately, the notebook of repairs is against
304+ basic usability rules :
305+ - the link to the invoice is in the "Extra Info" tab, not in the
306+ "Invoicing" tab !
307+ - The "Invoicing" tab contains fees... but elements for invoicing are
308+ also in the "Operations" tab !
309+ - The total amount displayed in the "Operations" tab sums elements
310+ that are in 2 different tabs !!!
311+
312+ So I decided to fully redesign the notebook :
313+ - all the lines (fees and operations) are in the same tab, with the total
314+ amounts
315+ - reduce the number of tabs from 4 to 2, so that the user doesn't have
316+ to switch between so many tabs !
317+ -->
318+ <notebook position="replace">
319+ <notebook>
320+ <page name="operations" string="Operations">
321+ <group name="repair_line" string="Hardware Operations">
322+ <field name="operations" nolabel="1">
323+ <form string="Operations" version="7.0">
324+ <notebook>
325+ <page string="Repair Line">
326+ <group col="4">
327+ <field name="name"/>
328+ <field name="product_id"
329+ on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id)"/>
330+ <label for="product_uom_qty"/>
331+ <div>
332+ <field name="product_uom_qty"
333+ class="oe_inline"/>
334+ <field name="product_uom"
335+ class="oe_inline"
336+ groups="product.group_uom"/>
337+ </div>
338+ <field name="price_unit"/>
339+ <field name="price_subtotal"/>
340+ <field name="type"
341+ on_change="onchange_operation_type(type, parent.guarantee_limit, parent.company_id, context)"/>
342+ <field name="to_invoice"/>
343+ <field name="tax_id"
344+ widget="many2many_tags"
345+ domain="[('parent_id', '=', False), ('type_tax_use', '&lt;&gt;', 'purchase')]"/>
346+ <field name="invoiced"/>
347+ <field name="prodlot_id"
348+ groups="stock.group_production_lot"
349+ string="Serial Number"/>
350+ <field name="location_id"
351+ groups="stock.group_locations"/>
352+ <field name="location_dest_id"
353+ groups="stock.group_locations"/>
354+ </group>
355+ </page>
356+ <page string="History">
357+ <group>
358+ <field name="move_id" />
359+ <field name="invoice_line_id"/>
360+ </group>
361+ </page>
362+ </notebook>
363+ </form>
364+ <tree string="Operations" editable="bottom">
365+ <field name="type"
366+ on_change="onchange_operation_type(type, parent.guarantee_limit, parent.company_id, context)"/>
367+ <field name="product_id"
368+ on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id)"/>
369+ <field name="name"/>
370+ <field name="prodlot_id"
371+ groups="stock.group_production_lot"
372+ string="Serial Number"/>
373+ <field name="location_id"
374+ groups="stock.group_locations"/>
375+ <field name="location_dest_id"
376+ groups="stock.group_locations"/>
377+ <field name="product_uom_qty"
378+ string="Quantity"/>
379+ <field name="product_uom"
380+ string="Unit of Measure"
381+ groups="product.group_uom"/>
382+ <field name="price_unit"/>
383+ <field name="tax_id" widget="many2many_tags"/>
384+ <field name="to_invoice"/>
385+ <field name="price_subtotal"/>
386+ </tree>
387+ </field>
388+ </group>
389+ <group name="fees" string="Labour and Services">
390+ <field name="fees_lines" nolabel="1">
391+ <form string="Fees" version="7.0">
392+ <label for="name" class="oe_edit_only"/>
393+ <h2>
394+ <field name="name"/>
395+ </h2>
396+ <group string="Product Information">
397+ <group>
398+ <field name="to_invoice"/>
399+ <field name="product_id"
400+ on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id, parent.guarantee_limit)"/>
401+ <label for="product_uom_qty"/>
402+ <div>
403+ <field name="product_uom_qty"
404+ string="Quantity"
405+ class="oe_inline"/>
406+ <field name="product_uom"
407+ groups="product.group_uom"
408+ class="oe_inline"/>
409+ </div>
410+ </group>
411+ <group>
412+ <field name="price_unit"/>
413+ <field widget="many2many_tags"
414+ name="tax_id"
415+ domain="[('parent_id', '=', False), ('type_tax_use', '&lt;&gt;', 'purchase')]"/>
416+ <field name="price_subtotal"/>
417+ </group>
418+ </group>
419+ <group string="History">
420+ <group>
421+ <field name="invoiced"/>
422+ </group>
423+ <group>
424+ <field name="invoice_line_id" />
425+ </group>
426+ </group>
427+ </form>
428+ <tree string="Fees" editable="bottom">
429+ <field name="product_id"
430+ on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id, parent.guarantee_limit)"/>
431+ <field name='name'/>
432+ <field name="product_uom_qty"
433+ string="Quantity"/>
434+ <field name="product_uom"
435+ string="Unit of Measure"
436+ groups="product.group_uom"/>
437+ <field name="price_unit"/>
438+ <field name="to_invoice"/>
439+ <field name="price_subtotal"/>
440+ </tree>
441+ </field>
442+ </group>
443+ <group class="oe_subtotal_footer oe_right">
444+ <field name="amount_untaxed"
445+ widget="monetary"
446+ options="{'currency_field': 'currency_id'}"/>
447+ <field name="amount_tax"
448+ widget="monetary"
449+ options="{'currency_field': 'currency_id'}"/>
450+ <div class="oe_subtotal_footer_separator oe_inline">
451+ <label for="amount_total" />
452+ <button name="button_dummy"
453+ states="draft"
454+ string="(update)"
455+ type="object"
456+ class="oe_edit_only oe_link"/>
457+ </div>
458+ <field name="amount_total"
459+ nolabel="1"
460+ class="oe_subtotal_footer_separator"
461+ widget="monetary"
462+ options="{'currency_field': 'currency_id'}"/>
463+ </group>
464+ <div class="oe_clear"/>
465+ </page>
466+ <page name="extra" string="Extra Info">
467+ <group name="main-extra" col="2">
468+ <group name="invoicing" string="Invoicing">
469+ <field name="invoice_method"/>
470+ <field name="partner_invoice_id"
471+ attrs="{'readonly': [('invoice_method', '=', 'none')], 'required': [('invoice_method', '!=', 'none')]}"
472+ groups="sale.group_delivery_invoice_address"/>
473+ <field
474+ name="pricelist_id"
475+ groups="product.group_sale_pricelist"
476+ context="{'product_id':product_id}"
477+ attrs="{'readonly': [('invoice_method', '=', 'none')]}"/>
478+ <field name="invoice_id"
479+ context="{'form_view_ref': 'account.invoice_form'}"/>
480+ <field name="company_id"
481+ groups="base.group_multi_company"
482+ widget="selection"/>
483+ </group>
484+ <group name="delivery" string="Delivery">
485+ <field name="picking_id"/>
486+ <field name="location_dest_id"
487+ attrs="{'required': [('deliver_bool', '=', True)]}"
488+ groups="stock.group_locations"/>
489+ </group>
490+ </group>
491+ <field name="internal_notes"
492+ placeholder="Add internal notes..."/>
493+ <field name="quotation_notes"
494+ placeholder="Add quotation notes..."/>
495+ </page>
496+ </notebook>
497+ </notebook>
498+ </field>
499+</record>
500+
501+<!-- Show related repairs in the prodlot form view -->
502+<record id="view_production_lot_form" model="ir.ui.view">
503+ <field name="name">mrp.repair.prodlot.form</field>
504+ <field name="model">stock.production.lot</field>
505+ <field name="inherit_id" ref="stock.view_production_lot_form"/>
506+ <field name="arch" type="xml">
507+ <notebook position="inside">
508+ <page name="repairs" string="Repairs">
509+ <field name="repair_ids"/>
510+ </page>
511+ </notebook>
512+ </field>
513+</record>
514+
515+</data>
516+</openerp>

Subscribers

People subscribed via source and target branches