← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Alexis de Lattre has proposed merging lp:~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension into lp:openerp-manufacturing.

Requested reviews:
  Manufacture Core Editors (manufacture-core-editors)

For more details, see:
https://code.launchpad.net/~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension/+merge/211696

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.
-- 
https://code.launchpad.net/~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension/+merge/211696
Your team Manufacture Core Editors is requested to review the proposed merge of lp:~akretion-team/openerp-manufacturing/70-add-mrp-repair-extension into lp:openerp-manufacturing.
=== added directory 'mrp_repair_extension'
=== added file 'mrp_repair_extension/__init__.py'
--- mrp_repair_extension/__init__.py	1970-01-01 00:00:00 +0000
+++ mrp_repair_extension/__init__.py	2014-03-19 10:38:14 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    MRP Repair Extension module for OpenERP
+#    Copyright (C) 2014 Akretion (http://www.akretion.com)
+#    @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from . import mrp_repair

=== added file 'mrp_repair_extension/__openerp__.py'
--- mrp_repair_extension/__openerp__.py	1970-01-01 00:00:00 +0000
+++ mrp_repair_extension/__openerp__.py	2014-03-19 10:38:14 +0000
@@ -0,0 +1,43 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    MRP Repair extension module for OpenERP
+#    Copyright (C) 2014 Akretion (http://www.akretion.com)
+#    @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'MRP Repair Extension',
+    'version': '0.1',
+    'category': 'Manufacturing',
+    'license': 'AGPL-3',
+    'summary': 'Enhance the mrp_repair module',
+    'description': """
+MRP Repair Extension
+====================
+
+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.
+
+Please contact Alexis de Lattre from Akretion <alexis.delattre@xxxxxxxxxxxx> for any help or question about this module.
+    """,
+    'author': 'Akretion',
+    'website': 'http://www.akretion.com',
+    'depends': ['mrp_repair'],
+    'data': ['mrp_repair_view.xml'],
+    'active': False,
+}

=== added directory 'mrp_repair_extension/i18n'
=== added file 'mrp_repair_extension/i18n/mrp_repair_extension.pot'
--- mrp_repair_extension/i18n/mrp_repair_extension.pot	1970-01-01 00:00:00 +0000
+++ mrp_repair_extension/i18n/mrp_repair_extension.pot	2014-03-19 10:38:14 +0000
@@ -0,0 +1,129 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* mrp_repair_extension
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-03-19 10:21+0000\n"
+"PO-Revision-Date: 2014-03-19 10:21+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: mrp_repair_extension
+#: view:stock.production.lot:0
+#: field:stock.production.lot,repair_ids:0
+msgid "Repairs"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: field:mrp.repair,user_id:0
+msgid "Responsible"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Product Information"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Add quotation notes..."
+msgstr ""
+
+#. module: mrp_repair_extension
+#: model:ir.model,name:mrp_repair_extension.model_mrp_repair
+msgid "Repair Order"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: field:mrp.repair,date_done:0
+msgid "Date Done"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Unit of Measure"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Invoicing"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Delivery"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: model:ir.model,name:mrp_repair_extension.model_stock_production_lot
+#: view:mrp.repair:0
+msgid "Serial Number"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "History"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Labour and Services"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Repair Line"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Quantity"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Operations"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Hardware Operations"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Add internal notes..."
+msgstr ""
+
+#. module: mrp_repair_extension
+#: field:mrp.repair,currency_id:0
+msgid "Currency"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Extra Info"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "Fees"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: view:mrp.repair:0
+msgid "(update)"
+msgstr ""
+
+#. module: mrp_repair_extension
+#: help:mrp.repair,date_done:0
+msgid "Date of completion of the repair"
+msgstr ""
+

=== added file 'mrp_repair_extension/mrp_repair.py'
--- mrp_repair_extension/mrp_repair.py	1970-01-01 00:00:00 +0000
+++ mrp_repair_extension/mrp_repair.py	2014-03-19 10:38:14 +0000
@@ -0,0 +1,59 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    MRP Repair Extension module for OpenERP
+#    Copyright (C) 2014 Akretion (http://www.akretion.com)
+#    @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import orm, fields
+
+
+class mrp_repair(orm.Model):
+    _inherit = 'mrp.repair'
+    _order = 'name desc'
+
+    _columns = {
+        'user_id': fields.many2one('res.users', "Responsible"),
+        'date_done': fields.datetime(
+            'Date Done', readonly=True,
+            help='Date of completion of the repair'),
+        'currency_id': fields.related(
+            'pricelist_id', 'currency_id', type='many2one',
+            relation='res.currency', string="Currency", readonly=True),
+        }
+
+    _defaults = {
+        'user_id': lambda self, cr, uid, ctx: uid,
+        }
+
+    def action_repair_done(self, cr, uid, ids, context=None):
+        res = super(mrp_repair, self).action_repair_done(
+            cr, uid, ids, context=context)
+        self.write(cr, uid, ids, {
+            'date_done': fields.datetime.now()
+            }, context=context)
+        return res
+
+
+class stock_production_lot(orm.Model):
+    _inherit = 'stock.production.lot'
+
+    _columns = {
+        'repair_ids': fields.one2many(
+            'mrp.repair', 'prodlot_id', 'Repairs'),
+        }

=== added file 'mrp_repair_extension/mrp_repair_view.xml'
--- mrp_repair_extension/mrp_repair_view.xml	1970-01-01 00:00:00 +0000
+++ mrp_repair_extension/mrp_repair_view.xml	2014-03-19 10:38:14 +0000
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Copyright (C) 2014 Akretion (http://www.akretion.com/)
+    @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+    The licence is in the file __openerp__.py
+-->
+
+<openerp>
+<data>
+
+
+<record id="view_repair_order_form" model="ir.ui.view">
+    <field name="name">mrp.repair.extension.form</field>
+    <field name="model">mrp.repair</field>
+    <field name="inherit_id" ref="mrp_repair.view_repair_order_form" />
+    <field name="arch" type="xml">
+        <field name="guarantee_limit" position="after">
+            <field name="user_id"/>
+            <field name="date_done"/>
+            <field name="currency_id" invisible="1"/>
+        </field>
+        <!-- Unfortunately, the notebook of repairs is against
+        basic usability rules :
+        - the link to the invoice is in the "Extra Info" tab, not in the
+        "Invoicing" tab !
+        - The "Invoicing" tab contains fees... but elements for invoicing are
+        also in the "Operations" tab !
+        - The total amount displayed in the "Operations" tab sums elements
+        that are in 2 different tabs !!!
+
+        So I decided to fully redesign the notebook :
+        - all the lines (fees and operations) are in the same tab, with the total
+        amounts
+        - reduce the number of tabs from 4 to 2, so that the user doesn't have
+        to switch between so many tabs !
+        -->
+        <notebook position="replace">
+            <notebook>
+                <page name="operations" string="Operations">
+                    <group name="repair_line" string="Hardware Operations">
+                        <field name="operations" nolabel="1">
+                           <form string="Operations" version="7.0">
+                                <notebook>
+                                    <page string="Repair Line">
+                                        <group col="4">
+                                            <field name="name"/>
+                                            <field name="product_id"
+                                                on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id)"/>
+                                            <label for="product_uom_qty"/>
+                                            <div>
+                                                <field name="product_uom_qty"
+                                                    class="oe_inline"/>
+                                                <field name="product_uom"
+                                                    class="oe_inline"
+                                                    groups="product.group_uom"/>
+                                            </div>
+                                            <field name="price_unit"/>
+                                            <field name="price_subtotal"/>
+                                            <field name="type"
+                                                on_change="onchange_operation_type(type, parent.guarantee_limit, parent.company_id, context)"/>
+                                            <field name="to_invoice"/>
+                                            <field name="tax_id"
+                                                widget="many2many_tags"
+                                                domain="[('parent_id', '=', False), ('type_tax_use', '&lt;&gt;', 'purchase')]"/>
+                                            <field name="invoiced"/>
+                                            <field name="prodlot_id"
+                                                groups="stock.group_production_lot"
+                                                string="Serial Number"/>
+                                            <field name="location_id"
+                                                groups="stock.group_locations"/>
+                                            <field name="location_dest_id"
+                                                groups="stock.group_locations"/>
+                                        </group>
+                                    </page>
+                                    <page string="History">
+                                        <group>
+                                            <field name="move_id" />
+                                            <field name="invoice_line_id"/>
+                                        </group>
+                                    </page>
+                                 </notebook>
+                            </form>
+                            <tree string="Operations" editable="bottom">
+                                <field name="type"
+                                    on_change="onchange_operation_type(type, parent.guarantee_limit, parent.company_id, context)"/>
+                                <field name="product_id"
+                                    on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id)"/>
+                                <field name="name"/>
+                                <field name="prodlot_id"
+                                    groups="stock.group_production_lot"
+                                    string="Serial Number"/>
+                                <field name="location_id"
+                                    groups="stock.group_locations"/>
+                                <field name="location_dest_id"
+                                    groups="stock.group_locations"/>
+                                <field name="product_uom_qty"
+                                    string="Quantity"/>
+                                <field name="product_uom"
+                                    string="Unit of Measure"
+                                    groups="product.group_uom"/>
+                                <field name="price_unit"/>
+                                <field name="tax_id" widget="many2many_tags"/>
+                                <field name="to_invoice"/>
+                                <field name="price_subtotal"/>
+                            </tree>
+                        </field>
+                    </group>
+                    <group name="fees" string="Labour and Services">
+                        <field name="fees_lines" nolabel="1">
+                            <form string="Fees" version="7.0">
+                                <label for="name" class="oe_edit_only"/>
+                                <h2>
+                                    <field name="name"/>
+                                </h2>
+                                <group string="Product Information">
+                                    <group>
+                                        <field name="to_invoice"/>
+                                        <field name="product_id"
+                                            on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id, parent.guarantee_limit)"/>
+                                        <label for="product_uom_qty"/>
+                                        <div>
+                                            <field name="product_uom_qty"
+                                                string="Quantity"
+                                                class="oe_inline"/>
+                                            <field name="product_uom"
+                                                groups="product.group_uom"
+                                                class="oe_inline"/>
+                                        </div>
+                                    </group>
+                                    <group>
+                                        <field name="price_unit"/>
+                                        <field widget="many2many_tags"
+                                            name="tax_id"
+                                            domain="[('parent_id', '=', False), ('type_tax_use', '&lt;&gt;', 'purchase')]"/>
+                                        <field name="price_subtotal"/>
+                                    </group>
+                                </group>
+                                <group string="History">
+                                    <group>
+                                        <field name="invoiced"/>
+                                    </group>
+                                    <group>
+                                        <field name="invoice_line_id" />
+                                    </group>
+                                </group>
+                            </form>
+                            <tree string="Fees" editable="bottom">
+                                <field name="product_id"
+                                    on_change="product_id_change(parent.pricelist_id, product_id, product_uom, product_uom_qty, parent.partner_id, parent.guarantee_limit)"/>
+                                <field name='name'/>
+                                <field name="product_uom_qty"
+                                    string="Quantity"/>
+                                <field name="product_uom"
+                                    string="Unit of Measure"
+                                    groups="product.group_uom"/>
+                                <field name="price_unit"/>
+                                <field name="to_invoice"/>
+                                <field name="price_subtotal"/>
+                            </tree>
+                        </field>
+                    </group>
+                    <group class="oe_subtotal_footer oe_right">
+                        <field name="amount_untaxed"
+                            widget="monetary"
+                            options="{'currency_field': 'currency_id'}"/>
+                        <field name="amount_tax"
+                            widget="monetary"
+                            options="{'currency_field': 'currency_id'}"/>
+                        <div class="oe_subtotal_footer_separator oe_inline">
+                            <label for="amount_total" />
+                            <button name="button_dummy"
+                                states="draft"
+                                string="(update)"
+                                type="object"
+                                class="oe_edit_only oe_link"/>
+                        </div>
+                        <field name="amount_total"
+                            nolabel="1"
+                            class="oe_subtotal_footer_separator"
+                            widget="monetary"
+                            options="{'currency_field': 'currency_id'}"/>
+                    </group>
+                        <div class="oe_clear"/>
+                </page>
+                <page name="extra" string="Extra Info">
+                    <group name="main-extra" col="2">
+                        <group name="invoicing" string="Invoicing">
+                            <field name="invoice_method"/>
+                            <field name="partner_invoice_id"
+                                attrs="{'readonly': [('invoice_method', '=', 'none')], 'required': [('invoice_method', '!=', 'none')]}"
+                                groups="sale.group_delivery_invoice_address"/>
+                            <field
+                                name="pricelist_id"
+                                groups="product.group_sale_pricelist"
+                                context="{'product_id':product_id}"
+                                attrs="{'readonly': [('invoice_method', '=', 'none')]}"/>
+                            <field name="invoice_id"
+                                context="{'form_view_ref': 'account.invoice_form'}"/>
+                            <field name="company_id"
+                                groups="base.group_multi_company"
+                                widget="selection"/>
+                        </group>
+                        <group name="delivery" string="Delivery">
+                            <field name="picking_id"/>
+                            <field name="location_dest_id"
+                                attrs="{'required': [('deliver_bool', '=', True)]}"
+                                groups="stock.group_locations"/>
+                        </group>
+                    </group>
+                    <field name="internal_notes"
+                        placeholder="Add internal notes..."/>
+                    <field name="quotation_notes"
+                        placeholder="Add quotation notes..."/>
+                </page>
+            </notebook>
+        </notebook>
+    </field>
+</record>
+
+<!-- Show related repairs in the prodlot form view -->
+<record id="view_production_lot_form" model="ir.ui.view">
+    <field name="name">mrp.repair.prodlot.form</field>
+    <field name="model">stock.production.lot</field>
+    <field name="inherit_id" ref="stock.view_production_lot_form"/>
+    <field name="arch" type="xml">
+        <notebook position="inside">
+            <page name="repairs" string="Repairs">
+                <field name="repair_ids"/>
+            </page>
+        </notebook>
+    </field>
+</record>
+
+</data>
+</openerp>


Follow ups