[ADD] Product margin UoM + product_extended

bzr revid: jco@openerp.com-20130605085626-6g4kvnrfgoxf3y2k
This commit is contained in:
Josse Colpaert 2013-06-05 10:56:26 +02:00
parent cfbee92a61
commit 9f9023b139
21 changed files with 949 additions and 4 deletions

View File

@ -0,0 +1,23 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 product_extended
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP S.A. (<http://www.openerp.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/>.
#
##############################################################################
{
"name" : "Product extension to track sales and purchases",
"version" : "1.0",
"author" : "OpenERP S.A.",
"depends" : ["product", "purchase", "sale", "mrp"],
"category" : "Generic Modules/Inventory Control",
"description": """
Product extension. This module adds:
* Last purchase order for each product supplier
* New functional field: Available stock (real+outgoing stock)
* Computes standard price from the BoM of the product (optional for each product)
* Standard price is shown in the BoM and it can be computed with a wizard
""",
"init_xml" : [],
"demo_xml" : [],
"update_xml" : ["product_extended_view.xml","product_extended_wizard.xml","mrp_view.xml"],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,62 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.1\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-07-08 18:00+0000\n"
"PO-Revision-Date: 2011-02-15 15:23+0000\n"
"Last-Translator: Benjamí Borràs Delgado <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2013-04-20 05:38+0000\n"
"X-Generator: Launchpad (build 16567)\n"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_name_translation
msgid "Product extension to track sales and purchases"
msgstr "Extensió de producte pel seguiment de compres i vendes"
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "XML invàlid per a la definició de la vista!"
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr "Preu cost"
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr "Data de l'última comanda"
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr "Estoc disponible"
#. module: product_extended
#: field:product.product,calculate_price:0
msgid "Compute price"
msgstr "Calcula preu"
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr "Última comanda"
#. module: product_extended
#: view:product.product:0
msgid "Compute standard price"
msgstr "Calcular preu cost"
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr "Punts de comandes"

View File

@ -0,0 +1,81 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.1\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-07-16 19:42:46+0000\n"
"PO-Revision-Date: 2009-07-16 22:03+0100\n"
"Last-Translator: Benjamí Borràs Delgado <benjami@zikzakmedia.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
#. module: product_extended
#: model:ir.module.module,description:product_extended.module_meta_information
msgid ""
"\n"
"Product extension. This module adds:\n"
" * Last purchase order for each product supplier \n"
" * New functional field: Available stock (real+outgoing stock)\n"
" * Computes standard price from the BoM of the product (optional for each product)\n"
" * Standard price is shown in the BoM and it can be computed with a wizard \n"
msgstr ""
"\n"
"Extensió de producte. Aquest mòdul afegeix:\n"
" * Última comanda de compra per cada proveïdor del producte\n"
" * Nou camp funcional: Estoc disponible (estoc real+sortint)\n"
" * Calcula preu de cost a partir de la LdM del producte (opcional per cada producte)\n"
" * Preu de cost es mostra en la LdM i pot ser calculat amb un assistent\n"
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "XML invàlid per a la definició de la vista!"
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr "Preu cost"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_meta_information
msgid "Product extension to track sales and purchases"
msgstr "Extensió de producte pel seguiment de compres i vendes"
#. module: product_extended
#: help:product.product,calculate_price:0
msgid "Check this box if the standard price must be computed from the BoM."
msgstr "Marqueu aquesta opció si el preu de cost s'ha de calcular a partir de la Llista de Materials."
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr "Data de l'última comanda"
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr "Estoc disponible"
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr "Última comanda"
#. module: product_extended
#: model:ir.actions.wizard,name:product_extended.id_compute_price
#: view:product.product:0
#: field:product.product,calculate_price:0
msgid "Compute standard price"
msgstr "Calcular preu cost"
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr "Punts de comandes"

View File

@ -0,0 +1,63 @@
# German translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-07-08 18:00+0000\n"
"PO-Revision-Date: 2012-09-11 11:15+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2013-04-20 05:38+0000\n"
"X-Generator: Launchpad (build 16567)\n"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_name_translation
msgid "Product extension to track sales and purchases"
msgstr ""
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr ""
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr ""
#. module: product_extended
#: field:product.product,calculate_price:0
msgid "Compute price"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr ""
#. module: product_extended
#: view:product.product:0
msgid "Compute standard price"
msgstr ""
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr ""

View File

@ -0,0 +1,62 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.1\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-07-08 18:00+0000\n"
"PO-Revision-Date: 2011-02-15 15:23+0000\n"
"Last-Translator: Benjamí Borràs Delgado <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2013-04-20 05:38+0000\n"
"X-Generator: Launchpad (build 16567)\n"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_name_translation
msgid "Product extension to track sales and purchases"
msgstr "Extensión de producto para el seguimiento de compras y ventas"
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "¡XML inválido para la definición de la vista!"
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr "Precio de coste"
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr "Fecha del último pedido"
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr "Stock disponible"
#. module: product_extended
#: field:product.product,calculate_price:0
msgid "Compute price"
msgstr "Calcular precio"
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr "Último pedido"
#. module: product_extended
#: view:product.product:0
msgid "Compute standard price"
msgstr "Calcular precio de coste"
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr "Puntos de pedidos"

View File

@ -0,0 +1,84 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.1\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-07-16 19:42:46+0000\n"
"PO-Revision-Date: 2009-07-16 21:58+0100\n"
"Last-Translator: Benjamí Borràs Delgado <benjami@zikzakmedia.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
#. module: product_extended
#: model:ir.module.module,description:product_extended.module_meta_information
msgid ""
"\n"
"Product extension. This module adds:\n"
" * Last purchase order for each product supplier \n"
" * New functional field: Available stock (real+outgoing stock)\n"
" * Computes standard price from the BoM of the product (optional for each product)\n"
" * Standard price is shown in the BoM and it can be computed with a wizard \n"
msgstr ""
"\n"
"Extensión de producto. Este módulo añade:\n"
" * Último pedido de compra por cada proveedor del producto\n"
" * Nuevo campo funcional: Stock disponible (stock real + saliente)\n"
" * Calcula precio de coste a partir de la LdM del producto (opcional para cada producto)\n"
" * Precio de coste se muestra en la LdM y puede ser calculado con un asistente\n"
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "¡XML inválido para la definición de la vista!"
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr "Precio de coste"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_meta_information
msgid "Product extension to track sales and purchases"
msgstr "Extensión de producto para el seguimiento de compras y ventas"
#. module: product_extended
#: help:product.product,calculate_price:0
msgid "Check this box if the standard price must be computed from the BoM."
msgstr "Marque esta opción si el precio de coste se calculará a partir de la Lista de Materiales."
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr "Fecha del último pedido"
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr "Stock disponible"
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr "Último pedido"
#. module: product_extended
#: model:ir.actions.wizard,name:product_extended.id_compute_price
#: view:product.product:0
#: field:product.product,calculate_price:0
msgid "Compute standard price"
msgstr "Calcular precio de coste"
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr "Puntos de pedidos"
#~ msgid "Compute price"
#~ msgstr "Calcular precio"

View File

@ -0,0 +1,75 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.6\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-11-26 08:13:54+0000\n"
"PO-Revision-Date: 2009-11-26 08:13:54+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: product_extended
#: model:ir.module.module,description:product_extended.module_meta_information
msgid "\n"
"Product extension. This module adds:\n"
" * Last purchase order for each product supplier \n"
" * New functional field: Available stock (real+outgoing stock)\n"
" * Computes standard price from the BoM of the product (optional for each product)\n"
" * Standard price is shown in the BoM and it can be computed with a wizard \n"
""
msgstr ""
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr ""
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_meta_information
msgid "Product extension to track sales and purchases"
msgstr ""
#. module: product_extended
#: help:product.product,calculate_price:0
msgid "Check this box if the standard price must be computed from the BoM."
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr ""
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr ""
#. module: product_extended
#: model:ir.actions.wizard,name:product_extended.id_compute_price
#: view:product.product:0
#: field:product.product,calculate_price:0
msgid "Compute standard price"
msgstr ""
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr ""

View File

@ -0,0 +1,63 @@
# Dutch translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-07-08 18:00+0000\n"
"PO-Revision-Date: 2012-04-05 10:22+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Dutch <nl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2013-04-20 05:38+0000\n"
"X-Generator: Launchpad (build 16567)\n"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_name_translation
msgid "Product extension to track sales and purchases"
msgstr "Productgegevens uitbreiding"
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "Ongeldige XML voor weergave opbouw!"
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr "Standaardprijs"
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr "Laatste orderdatum"
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr "Voorraad beschikbaar"
#. module: product_extended
#: field:product.product,calculate_price:0
msgid "Compute price"
msgstr "Bereken kostprijs"
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr "Laatste order"
#. module: product_extended
#: view:product.product:0
msgid "Compute standard price"
msgstr "Bereken standaard prijs"
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr "Orderpunten"

View File

@ -0,0 +1,62 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.1\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-07-08 18:00:36+0000\n"
"PO-Revision-Date: 2009-07-08 18:00:36+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_name_translation
msgid "Product extension to track sales and purchases"
msgstr ""
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr ""
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr ""
#. module: product_extended
#: field:product.product,calculate_price:0
msgid "Compute price"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr ""
#. module: product_extended
#: view:product.product:0
msgid "Compute standard price"
msgstr ""
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr ""

View File

@ -0,0 +1,62 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * product_extended
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.14\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-07-08 18:00+0000\n"
"PO-Revision-Date: 2011-02-15 15:23+0000\n"
"Last-Translator: Olivier Dony (OpenERP) <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2013-04-20 05:38+0000\n"
"X-Generator: Launchpad (build 16567)\n"
#. module: product_extended
#: model:ir.module.module,shortdesc:product_extended.module_name_translation
msgid "Product extension to track sales and purchases"
msgstr "Product extension to track sales and purchases"
#. module: product_extended
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: product_extended
#: field:mrp.bom,standard_price:0
msgid "Standard Price"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order_date:0
msgid "Last Order date"
msgstr ""
#. module: product_extended
#: field:product.product,qty_dispo:0
msgid "Stock available"
msgstr ""
#. module: product_extended
#: field:product.product,calculate_price:0
msgid "Compute price"
msgstr ""
#. module: product_extended
#: field:product.supplierinfo,last_order:0
msgid "Last Order"
msgstr ""
#. module: product_extended
#: view:product.product:0
msgid "Compute standard price"
msgstr ""
#. module: product_extended
#: field:product.product,orderpoint_ids:0
msgid "Orderpoints"
msgstr ""

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="mrp_bom_form_view_product_extended" model="ir.ui.view">
<field name="name">mrp.bom.form.product_extended</field>
<field name="model">mrp.bom</field>
<field name="type">form</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="standard_price"/>
<newline/>
</field>
</field>
</record>
<record id="mrp_bom_tree_view_product_extended" model="ir.ui.view">
<field name="name">mrp.bom.tree.product_extended</field>
<field name="model">mrp.bom</field>
<field name="type">tree</field>
<field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>
<field name="arch" type="xml">
<field name="product_uom" position="after">
<field name="standard_price"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,102 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP S.A. (<http://www.openerp.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.osv import fields
from openerp.osv import osv
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
_columns = {
'calculate_price': fields.boolean('Compute standard price', help="Check this box if the standard price must be computed from the BoM."),
}
_defaults = {
'calculate_price': lambda w,x,y,z: False,
}
def compute_price(self, cr, uid, ids, *args):
proxy = self.pool.get('mrp.bom')
for prod_id in ids:
bom_ids = proxy.search(cr, uid, [('product_id', '=', prod_id)])
if bom_ids:
for bom in proxy.browse(cr, uid, bom_ids):
self._calc_price(cr, uid, bom)
return True
def _calc_price(self, cr, uid, bom):
if not bom.product_id.calculate_price:
return bom.product_id.standard_price
else:
price = 0
if bom.bom_lines:
for sbom in bom.bom_lines:
my_qty = sbom.bom_lines and 1.0 or sbom.product_qty
price += self._calc_price(cr, uid, sbom) * my_qty
else:
bom_obj = self.pool.get('mrp.bom')
no_child_bom = bom_obj.search(cr, uid, [('product_id', '=', bom.product_id.id), ('bom_id', '=', False)])
if no_child_bom and bom.id not in no_child_bom:
other_bom = bom_obj.browse(cr, uid, no_child_bom)[0] #TODO zero before?
if not other_bom.product_id.calculate_price:
price += self._calc_price(cr, uid, other_bom) * other_bom.product_qty
else:
# price += other_bom.product_qty * other_bom.product_id.standard_price
price += other_bom.product_id.standard_price
else:
# price += bom.product_qty * bom.product_id.standard_price
price += bom.product_id.standard_price
# if no_child_bom:
# other_bom = bom_obj.browse(cr, uid, no_child_bom)[0]
# price += bom.product_qty * self._calc_price(cr, uid, other_bom)
# else:
# price += bom.product_qty * bom.product_id.standard_price
if bom.routing_id:
for wline in bom.routing_id.workcenter_lines:
wc = wline.workcenter_id
cycle = wline.cycle_nbr
hour = (wc.time_start + wc.time_stop + cycle * wc.time_cycle) * (wc.time_efficiency or 1.0)
price += wc.costs_cycle * cycle + wc.costs_hour * hour
price = self.pool.get('product.uom')._compute_price(cr,uid,bom.product_uom.id,price,bom.product_id.uom_id.id)
if bom.bom_lines:
self.write(cr, uid, [bom.product_id.id], {'standard_price' : price/bom.product_qty})
if bom.product_uom.id != bom.product_id.uom_id.id:
price = self.pool.get('product.uom')._compute_price(cr,uid,bom.product_uom.id,price,bom.product_id.uom_id.id)
return price
product_product()
class product_bom(osv.osv):
_inherit = 'mrp.bom'
_columns = {
'standard_price': fields.related('product_id','standard_price',type="float",relation="product.product",string="Standard Price",store=False)
}
product_bom()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<openerp>
<data>
<!-- <record model="ir.ui.view" id="product_product_ext_form_view">
<field name="name">product_extended.product.form.view</field>
<field name="type">form</field>
<field name="model">product.product</field>
<field name="priority">2</field>
<field name="inherit_id" ref="stock.view_product_standard_price_form" />
<field name="arch" type="xml">
<field name="virtual_available" position="after">
<field name="qty_dispo" />
</field>
</field>
</record> -->
<record model="ir.ui.view" id="product_product_ext_form_view2">
<field name="name">product_extended.product.form.view</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="priority">3</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<field name="standard_price" position="after">
<field name="calculate_price" />
<button name="compute_price" attrs="{'invisible': [('cost_method', '!=', 'standard')]}" type="object" string="Compute standard price"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" ?>
<openerp>
<data>
<wizard
string="Compute standard price"
model="mrp.bom"
name="product_extended.compute_price"
menu="True"
id="id_compute_price"/>
</data>
</openerp>

View File

@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard_price
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,49 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP S.A. (<http://www.openerp.com>).
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
def _compute_price(self, cr, uid, data, context):
bom_obj = self.pool.get('mrp.bom')
for bom in bom_obj.browse(cr, uid, data['ids'], context=context):
bom.product_id.compute_price(cr, uid, bom.product_id.id)
return {}
class wizard_price(osv.osv):
_name = "wizard.price"
_description = "Compute price wizard"
states = {
'init' : {
'actions' : [],
'result' : {
'type' : 'action',
'action' : _compute_price,
'state' : 'end'
}
},
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -67,7 +67,7 @@ class product_product(osv.osv):
left join product_product product on (product.id=l.product_id)
left join product_template pt on (pt.id = l.product_id)
left join product_uom pu on (pt.uom_id = pu.id)
left join product_uom pu2 on (i.uos_id = pu2.id)
left join product_uom pu2 on (l.uos_id = pu2.id)
where l.product_id = %s and i.state in %s and i.type IN %s and (i.date_invoice IS NULL or (i.date_invoice>=%s and i.date_invoice<=%s and i.company_id=%s))
"""
invoice_types = ('out_invoice', 'in_refund')

View File

@ -358,4 +358,23 @@
The price of the product should have changed back to 65.0
-
!python {model: product.product}: |
assert self.browse(cr, uid, ref("product_fifo_icecream")).standard_price == 65.0
assert self.browse(cr, uid, ref("product_fifo_icecream")).standard_price == 65.0
-
Check Stock Valuation Report view, check first purchase order line corresponds with first outgoing line
-
!python {model: report.stock.valuation}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_fifo1")).picking_ids
original_move = pick_ids[0].name
pick_compare = self.pool.get("stock.picking").browse(cr, uid, ref("outgoing_fifo_shipment")).name
ids = self.search(cr, uid, [('product_id', '=', ref("product_fifo_icecream")), ('product_qty', '=', -10.0), ('value', '=', -500.0),
('related_move_in', '=', original_move), ('name', '=', pick_compare)])
assert len(ids) == 1, 'Could not find the correct line in the report'
-
Check Stock Inventory Report view if it shows the correct value of the stock
-
!python {model: report.stock.inventory}: |
print self.pool.get("product.product").browse(cr, uid, ref("product_fifo_icecream")).qty_available
ids = self.search(cr, uid, [('product_id', '=', ref("product_fifo_icecream")), ("state", "=", "done"), ("product_qty", ">", 0.0)])
for line in self.browse(cr, uid, ids):
print line.product_qty, line.value, line.location_src_type, line.location_dest_type, line.state, line.ref
assert len(ids) == 0, 'No lines should be visible in the stock inventory'

View File

@ -256,7 +256,7 @@ class report_stock_valuation(osv.osv):
_description = "Stock Valuation Statistics"
_auto = False
_order = 'date desc'

View File

@ -147,7 +147,8 @@
help = "Analysis including future moves (similar to virtual stock)"/>
<separator/>
<filter icon="terp-go-home" name="location_type_internal" string="Internal" domain="[('location_type','=','internal')]"/>
<filter name="inmovesremaining" string="In moves still in stock" domain="[('location_src_type','!=','internal'), ('location_dest_type','=', 'internal'), ('product_qty', '>', 0.0)]"/>
<filter name="inmovesremaining" string="In moves still in stock" domain="[('location_src_type','!=','internal'), ('location_dest_type','=', 'internal'), ('product_qty', '>', 0.0)]"
help="Analysis showing only the in moves which are still (partially) in stock"/>
<field name="product_id" default_focus="1"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>