openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #01670
lp:~camptocamp/stock-logistic-flows/6.1-add-mrp_open_lot_attributes-lep into lp:stock-logistic-flows
Leonardo Pistone @ camptocamp has proposed merging lp:~camptocamp/stock-logistic-flows/6.1-add-mrp_open_lot_attributes-lep into lp:stock-logistic-flows.
Requested reviews:
Stock and Logistic Core Editors (stock-logistic-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/stock-logistic-flows/6.1-add-mrp_open_lot_attributes-lep/+merge/196749
This new module allows to edit the Custom Attributes in the production lot from the Manufacturing Order.
--
https://code.launchpad.net/~camptocamp/stock-logistic-flows/6.1-add-mrp_open_lot_attributes-lep/+merge/196749
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/stock-logistic-flows/6.1-add-mrp_open_lot_attributes-lep into lp:stock-logistic-flows.
=== added directory 'mrp_open_lot_attributes'
=== added file 'mrp_open_lot_attributes/__init__.py'
--- mrp_open_lot_attributes/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_open_lot_attributes/__init__.py 2013-11-26 16:40:22 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+# #
+# Author: Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxxxx> #
+# Copyright 2013 Camptocamp SA #
+# #
+# 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 stock
=== added file 'mrp_open_lot_attributes/__openerp__.py'
--- mrp_open_lot_attributes/__openerp__.py 1970-01-01 00:00:00 +0000
+++ mrp_open_lot_attributes/__openerp__.py 2013-11-26 16:40:22 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+# #
+# Author: Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxxxx> #
+# Copyright 2013 Camptocamp SA #
+# #
+# 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 Open Lot Attributes',
+ 'version': '0.1',
+ 'category': 'Generic Modules/Others',
+ 'license': 'AGPL-3',
+ 'description': """
+This module adds buttons to edit the Production Lot information, including
+custom attributes, from the Finished Products tab in the Manufacturing Order.
+
+""",
+ 'complexity': 'easy',
+ 'author': 'Camptocamp',
+ 'website': 'http://www.camptocamp.com/',
+ 'depends': ['mrp', 'production_lot_custom_attributes'],
+ 'init_xml': [],
+ 'update_xml': ['mrp_view.xml'],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+ }
=== added file 'mrp_open_lot_attributes/mrp_view.xml'
--- mrp_open_lot_attributes/mrp_view.xml 1970-01-01 00:00:00 +0000
+++ mrp_open_lot_attributes/mrp_view.xml 2013-11-26 16:40:22 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="mrp_production_form_lot_attribute_view" model="ir.ui.view">
+ <field name="name">mrp.production.lot.attribute.form</field>
+ <field name="model">mrp.production</field>
+ <field name="inherit_id" ref="mrp.mrp_production_form_view"/>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <xpath expr="/form/notebook/page[@string='Finished Products']/field[@name='move_created_ids2']/tree/button[@string='Scrap Products']" position="after">
+ <button name="open_lot" string="Open Lot" type="object" icon="gtk-justify-fill"/>
+ </xpath>
+ </field>
+ </record>
+
+ </data>
+</openerp>
=== added file 'mrp_open_lot_attributes/stock.py'
--- mrp_open_lot_attributes/stock.py 1970-01-01 00:00:00 +0000
+++ mrp_open_lot_attributes/stock.py 2013-11-26 16:40:22 +0000
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+# #
+# Author: Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxxxx> #
+# Copyright 2013 Camptocamp SA #
+# #
+# 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 osv import osv
+
+
+class stock_move(osv.osv):
+ _inherit = 'stock.move'
+
+ def open_lot(self, cr, uid, ids, context=None):
+ """If there is a production lot, open it in a form
+
+ If the production lot has custom attributes, these are shown in a
+ dynamic view
+
+ """
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+
+ if context is None:
+ context = {}
+ for move in self.browse(cr, uid, ids, context=context):
+ if move.prodlot_id:
+ action_id = mod_obj.get_object_reference(
+ cr, uid, 'stock', 'action_production_lot_form')[1]
+ action = act_obj.read(cr, uid, [action_id], context=context)[0]
+
+ if move.prodlot_id.attribute_set_id:
+
+ action['context'] = (
+ "{'open_lot_by_attribute_set': True, "
+ "'attribute_group_ids': %s}"
+ % [
+ group.id
+ for group in move.prodlot_id.attribute_set_id.attribute_group_ids
+ ]
+ )
+ action['domain'] = (
+ "[('attribute_set_id', '=', %s)]"
+ % move.prodlot_id.attribute_set_id.id
+ )
+
+ # I want the form, not the tree view
+ action['view_mode'] = 'form'
+ del action['views']
+ action['res_id'] = move.prodlot_id.id
+ return action
Follow ups