Skip to content

Commit

Permalink
[IMP] mrp_stock_info: added reserved lots to product to consume view
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed Nov 16, 2015
1 parent 8fc1785 commit 77e967a
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 42 deletions.
30 changes: 30 additions & 0 deletions mrp_stock_info/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

================
MRP - Stock info
================

This module adds stock info to MRP:

* Available and virtual qty to scheduled product lines
* Selected lots in reserved stock moves as a text to be displayed

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/187/8.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/odoomrp/odoomrp-utils/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here <https://github.com/odoomrp/odoomrp-utils/issues/new?body=module:%20mrp_stock_info%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Contributors
------------

* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Ana Juaristi <anajuaristi@avanzosc.es>
7 changes: 3 additions & 4 deletions mrp_stock_info/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import models
41 changes: 13 additions & 28 deletions mrp_stock_info/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 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/.
#
##############################################################################
# -*- coding: utf-8 -*-
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
"name": "MRP - Stock info",
"version": "1.0",
"depends": [
"mrp",
"stock",
],
"author": "OdooMRP team,"
"AvanzOSC,"
"version": "8.0.1.0.0",
"category": "Manufacturing",
"license": "AGPL-3",
"author": "OdooMRP team, "
"AvanzOSC, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"website": "http://www.odoomrp.com",
"contributors": [
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Ana Juaristi <anajuaristi@avanzosc.es>"
"Ana Juaristi <anajuaristi@avanzosc.es>",
],
"depends": [
"mrp",
"stock",
],
"category": "Custom Module",
"summary": "",
"data": [
"views/mrp_production_view.xml",
],
"installable": True,
"auto_install": False,
}
8 changes: 4 additions & 4 deletions mrp_stock_info/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import mrp_production
from . import stock
7 changes: 3 additions & 4 deletions mrp_stock_info/models/mrp_production.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# -*- coding: utf-8 -*-
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import models, fields

Expand Down
19 changes: 19 additions & 0 deletions mrp_stock_info/models/stock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import api, fields, models


class StockMove(models.Model):
_inherit = 'stock.move'

@api.multi
@api.depends('reserved_quant_ids')
def _compute_selected_lots(self):
for record in self:
record.selected_lots = ', '.join(
record.mapped('reserved_quant_ids.lot_id.name'))

selected_lots = fields.Char(
string='Reserved Lots', compute='_compute_selected_lots')
15 changes: 13 additions & 2 deletions mrp_stock_info/views/mrp_production_view.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="mrp_production_product_line_stock_info_tree_view">
<record id="mrp_production_selected_lot_form_view" model="ir.ui.view">
<field name="name">mrp.production.selected_lot.form</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='move_lines']/tree//field[@name='product_uom']" position="after">
<field name="selected_lots" groups="stock.group_production_lot" />
</xpath>
</field>
</record>

<record id="mrp_production_product_line_stock_info_tree_view" model="ir.ui.view">
<field name="name">mrp.production.product.line.stock_info.tree</field>
<field name="model">mrp.production.product.line</field>
<field name="inherit_id" ref="mrp.mrp_production_product_tree_view" />
Expand All @@ -13,7 +24,7 @@
</field>
</record>

<record model="ir.ui.view" id="mrp_production_product_line_stock_info_form_view">
<record id="mrp_production_product_line_stock_info_form_view" model="ir.ui.view">
<field name="name">mrp.production.product.line.stock_info.form</field>
<field name="model">mrp.production.product.line</field>
<field name="inherit_id" ref="mrp.mrp_production_product_form_view" />
Expand Down

0 comments on commit 77e967a

Please sign in to comment.