Parcourir la source

Calcula costo de producción en Mrp

Sebas il y a 5 ans
commit
923a9e0b4b

+ 3 - 0
__init__.py

@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import models

BIN
__init__.pyc


+ 34 - 0
__openerp__.py

@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+{
+    'name': 'MRP Cost',
+    'version': '2.0',
+    'author' : 'Eiru Software, Sebastian Penayo',
+    'website': 'www.eiru.py',
+    'description': """
+
+Funcionalidad:
+ - Calcule el precio de producción como el precio real de los componentes.
+
+
+    """,
+
+    'category': 'Manufacturing',
+    'depends': [
+        'mrp',
+        'mrp_bom_total_price',
+        'stock',
+        'sale',
+        'product'
+
+    ],
+
+    'data': [
+        'views/mrp_view.xml'
+    ],
+
+    'installable': True,
+}
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 6 - 0
data/mrp_data.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <data noupdate="1">
+
+    </data>
+</odoo>

+ 7 - 0
models/__init__.py

@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+
+
+import mrp_production
+# import stock_picking
+# import stock_move
+# import mrp_routing

BIN
models/__init__.pyc


+ 25 - 0
models/mrp_production.py

@@ -0,0 +1,25 @@
+ # -*- coding: utf-8 -*-
+
+# import openerp.addons.decimal_precision as dp
+
+from openerp import api, models, fields
+
+class MrpProduction(models.Model):
+    _inherit = 'mrp.production'
+
+    @api.one
+    def _eiru_price_unit(self):
+        self.prod_price_unit = self.product_price / self.product_qty
+
+    @api.one
+    @api.depends('product_id')
+    def _product_price_total(self):
+        self.product_price = self.product_qty * self.product_id.standard_price
+
+    product_price = fields.Float(
+        string='Costo de producción',
+        compute='_product_price_total')
+
+    prod_price_unit = fields.Float(
+        string='Precio por Unidad',
+        compute='_eiru_price_unit')

BIN
models/mrp_production.pyc


BIN
static/description/icon.png


+ 31 - 0
views/mrp_view.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        <record id="mrp_production_form_view" model="ir.ui.view">
+            <field name="name">eiru.mrp.production.form</field>
+            <field name="model">mrp.production</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="mrp.mrp_production_form_view"/>
+            <field name="arch" type="xml">
+                <field name="date_planned" position="after">
+                    <field name="prod_price_unit"/>
+                    <field name="product_price"/>
+                </field>
+            </field>
+        </record>
+        <record id="mrp_eiru_tree_parent_view" model="ir.ui.view">
+            <field name="name">mrp.eiru.bom.tree</field>
+            <field name="model">mrp.production</field>
+            <field name="inherit_id" ref="mrp.mrp_production_tree_view"/>
+            <field name="arch" type="xml">
+
+                    <xpath expr="//tree/field[@name='origin']" position="after">
+                        <field name="prod_price_unit"/>
+                        <field name="product_price" sum="Total Producción"/>
+                    </xpath>
+
+            </field>
+        </record>
+    </data>
+
+</openerp>