Rodney Elpidio Enciso Arias 6 лет назад
Сommit
5b3fd71cb1
11 измененных файлов с 193 добавлено и 0 удалено
  1. 4 0
      README.md
  2. 5 0
      __init__.py
  3. BIN
      __init__.pyc
  4. 39 0
      __openerp__.py
  5. 33 0
      i18n/es.po
  6. 33 0
      i18n/mrp_bom_total_price.pot
  7. 5 0
      models/__init__.py
  8. BIN
      models/__init__.pyc
  9. 39 0
      models/mrp.py
  10. BIN
      models/mrp.pyc
  11. 35 0
      views/mrp_view.xml

+ 4 - 0
README.md

@@ -0,0 +1,4 @@
+Mrp Bom Total Price
+===================
+
+Add bill of material total price and show bill of material price cost per product.

+ 5 - 0
__init__.py

@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in root directory
+##############################################################################
+from . import models


+ 39 - 0
__openerp__.py

@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#    Trey, Kilobytes de Soluciones
+#    Copyright (C) 2016-Today Trey, Kilobytes de Soluciones <www.trey.es>
+#
+#    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 Bom Total Price',
+    'summary': 'Add bill of material total price and show bill of material'
+               ' price cost per product',
+    'category': 'MRP management',
+    'version': '8.0.0.1',
+    'description': '''Add bill of material total price and show '
+                    'bill of material price cost per product''',
+    'author': 'Trey (www.trey.es) - Eiru',
+    'website': 'https://www.trey.es',
+    'depends': [
+        'base',
+        'mrp',
+    ],
+    'data': [
+        'views/mrp_view.xml'
+    ],
+    'installable': True,
+}

+ 33 - 0
i18n/es.po

@@ -0,0 +1,33 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mrp_bom_total_price
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: mrp_bom_total_price\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-02-09 18:00+0000\n"
+"PO-Revision-Date: 2017-02-09 19:06+0100\n"
+"Last-Translator: abraham <abraham@trey.es>\n"
+"Language-Team: www.trey.es <info@trey.es>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es_es\n"
+"X-Generator: Poedit 1.5.4\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+
+#. module: mrp_bom_total_price
+#: model:ir.model,name:mrp_bom_total_price.model_mrp_bom
+msgid "Bill of Material"
+msgstr "Lista de material"
+
+#. module: mrp_bom_total_price
+#: field:mrp.bom.line,bom_prod_price:0
+msgid "Product price total"
+msgstr "Precio total del producto"
+
+#. module: mrp_bom_total_price
+#: field:mrp.bom,bom_prod_price_total:0
+msgid "Total price"
+msgstr "Precio total"

+ 33 - 0
i18n/mrp_bom_total_price.pot

@@ -0,0 +1,33 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* mrp_bom_total_price
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: mrp_bom_total_price\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-02-09 18:00+0000\n"
+"PO-Revision-Date: 2017-02-09 19:05+0100\n"
+"Last-Translator: abraham <abraham@trey.es>\n"
+"Language-Team: www.trey.es <info@trey.es>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en_US\n"
+"X-Generator: Poedit 1.5.4\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+
+#. module: mrp_bom_total_price
+#: model:ir.model,name:mrp_bom_total_price.model_mrp_bom
+msgid "Bill of Material"
+msgstr "Bill of Material"
+
+#. module: mrp_bom_total_price
+#: field:mrp.bom.line,bom_prod_price:0
+msgid "Product price total"
+msgstr "Product price total"
+
+#. module: mrp_bom_total_price
+#: field:mrp.bom,bom_prod_price_total:0
+msgid "Total price"
+msgstr "Precio total"

+ 5 - 0
models/__init__.py

@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in root directory
+##############################################################################
+from . import mrp

BIN
models/__init__.pyc


+ 39 - 0
models/mrp.py

@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in root directory
+##############################################################################
+from openerp import models, api, fields
+
+
+class MrpBom(models.Model):
+    _inherit = 'mrp.bom'
+
+    @api.one
+    def _bom_price_total(self):
+        self.bom_prod_price_total = sum(
+            [l.bom_prod_price for l in self.bom_line_ids])
+
+    @api.one
+    def _bom_price_unit(self):
+        self.bom_prod_price_unit = self.bom_prod_price_total / self.product_qty
+
+    bom_prod_price_total = fields.Float(
+        string='Total price',
+        compute='_bom_price_total')
+
+    bom_prod_price_unit = fields.Float(
+        string='Precio por Unidad',
+        compute='_bom_price_unit')
+
+
+class MrpBomLine(models.Model):
+    _inherit = 'mrp.bom.line'
+
+    @api.one
+    @api.depends('product_id')
+    def _product_price_total(self):
+        self.bom_prod_price = self.product_qty * self.product_id.standard_price
+
+    bom_prod_price = fields.Float(
+        string='Product price total',
+        compute='_product_price_total')

BIN
models/mrp.pyc


+ 35 - 0
views/mrp_view.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <record id="mrp_bom_form_view_inhe" model="ir.ui.view">
+            <field name="model">mrp.bom</field>
+            <field name="inherit_id" ref="mrp.mrp_bom_form_view" />
+            <field name="arch" type="xml">
+                <xpath expr="//page[@string='Components']/field[@name='bom_line_ids']/tree[@string='Components']/field[@name='product_uom']" position="after">
+                    <field name="bom_prod_price"/>
+                </xpath>
+                <xpath expr="//form[@string='Bill of Material']/group/group/label[@for='routing_id']" position="before">
+                    <label for="bom_prod_price_total" class="oe_inline"/>
+                    <div>
+                        <field name="bom_prod_price_total"/>
+                    </div>
+                    <label for="bom_prod_price_unit" class="oe_inline"/>
+                    <div>
+                        <field name="bom_prod_price_unit"/>
+                    </div>
+                </xpath>
+            </field>
+        </record>
+        <record id="mrp.mrp_bom_tree_parent_view" model="ir.ui.view">
+            <field name="name">mrp.bom.tree</field>
+            <field name="model">mrp.bom</field>
+            <field name="arch" type="xml">
+                <tree>
+                    <field name="name"/>
+                    <field name="bom_prod_price_total"/>
+                    <field name="bom_prod_price_unit"/>
+                </tree>
+            </field>
+        </record>
+    </data>
+</openerp>