Browse Source

Cantidad disponible y precio de costo en BOM

sebas 4 years ago
commit
3662512b89
5 changed files with 155 additions and 0 deletions
  1. 24 0
      __init__.py
  2. 38 0
      __openerp__.py
  3. 44 0
      mrp_bom_product_details.py
  4. BIN
      static/description/icon.png
  5. 49 0
      views/mrp_bom_product_details.xml

+ 24 - 0
__init__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+import mrp_bom_product_details
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

+ 38 - 0
__openerp__.py

@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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': 'Detalles en la vista BOM',
+    'version': '8.1.0',
+    'category': 'Extra Tools',
+    'description': """Este módulo añade el precio y el stock del producto a la vista bom.""",
+    'author': 'Sebastian Penayo/Eiru',
+    'website': 'http://www.eiru.com.py',
+    'depends': ["base", "mrp"],
+    'data': [
+        "views/mrp_bom_product_details.xml",
+    ],
+    'demo': [
+    ],
+    'installable': True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 44 - 0
mrp_bom_product_details.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_features for OpenERP                                               #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>   #
+#                                                                               #
+#    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 import models, fields, tools
+
+class MrpBom(models.Model):
+    _inherit = 'mrp.bom'
+
+    product_standard_price = fields.Float(
+        related='product_id.standard_price', string='Costo Unitario',
+        readonly=True)
+
+    product_qty_available = fields.Float(
+        related='product_id.qty_available',
+        string='Cant. Disponible', readonly=True)
+
+class MrpBomLine(models.Model):
+    _inherit = 'mrp.bom.line'
+
+    product_standard_price = fields.Float(related='product_id.standard_price',
+                                          string='Costo Unitario', readonly=True)
+    product_qty_available = fields.Float(related='product_id.qty_available',
+                                         string='Cant. Disponible',readonly=True)

BIN
static/description/icon.png


+ 49 - 0
views/mrp_bom_product_details.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  product_features for OpenERP
+  Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).
+    Authors, Mathieu Lemercier, mathieu@netandco.net, Franck Bret, franck@netandco.net
+  Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>
+  The licence is in the file __openerp__.py
+-->
+<openerp>
+    <data>
+         <record id="mrp_bom_tree_view" model="ir.ui.view">
+            <field name="name">mrp.bom.tree</field>
+            <field name="model">mrp.bom</field>
+            <field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>
+              <field name="arch" type="xml">
+                <field name="product_uom" position="after">
+                    <field name="product_standard_price" />
+                    <field name="product_qty_available" />
+                </field>
+              </field>
+         </record>
+
+         <record id="mrp_bom_component_tree_view" model="ir.ui.view">
+            <field name="name">mrp.bom.component.tree</field>
+            <field name="model">mrp.bom.line</field>
+            <field name="inherit_id" ref="mrp.mrp_bom_component_tree_view"/>
+            <field name="arch" type="xml">
+                <field name="product_qty" position="before">
+                    <field name="product_standard_price" />
+                </field>
+                <field name="product_uom" position="after">
+                    <field name="product_qty_available" />
+                </field>
+            </field>
+          </record>
+
+          <record id="mrp_bom_form_view" model="ir.ui.view">
+              <field name="name">mrp.bom.form</field>
+              <field name="model">mrp.bom</field>
+              <field name="inherit_id" ref="mrp.mrp_bom_form_view"/>
+              <field name="arch" type="xml">
+                  <xpath expr="//field[@name='bom_line_ids']/tree[@string='Components']/field[@name='product_uom']" position="after">
+                      <field name="product_standard_price" />
+                      <field name="product_qty_available" />
+                  </xpath>
+              </field>
+          </record>
+    </data>
+</openerp>