Skip to content

Commit

Permalink
[PORT] V8 api;
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Jul 24, 2015
1 parent 4d5bffa commit d5f78a2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 114 deletions.
2 changes: 1 addition & 1 deletion product_replenishment_cost/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
#
##############################################################################

from . import product_get_cost_field
from . import product_product
85 changes: 0 additions & 85 deletions product_replenishment_cost/models/product_get_cost_field.py

This file was deleted.

45 changes: 45 additions & 0 deletions product_replenishment_cost/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle
# Copyright 2012 Camptocamp SA
#
# 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 fields, api
from openerp.models import Model

import openerp.addons.decimal_precision as dp


class ProductProduct(Model):
_inherit = 'product.product'

@api.one
@api.depends('product_tmpl_id.standard_price')
def _get_replenishment_cost(self):
self.replenishment_cost = self.standard_price

replenishment_cost = fields.Float(
compute=_get_replenishment_cost,
string='Replenishment cost',
digits_compute=dp.get_precision('Product Price'),
help="The cost that you have to support in order to produce or "
"acquire the goods. Depending on the modules installed, "
"this cost may be computed based on various pieces of "
"information, for example Bills of Materials or latest "
"Purchases. By default, the Replenishment cost is the same "
"as the Cost Price.")
39 changes: 11 additions & 28 deletions product_replenishment_cost/views/view.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="product_get_cost_field_form">
<field name="name">product.get_cost_field.view.form</field>
<field name="type">form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<!-- Add the Replenishment cost -->
<field name="cost_method" groups="product.group_costing_method" position="after">
<field name="cost_price"/>
</field>
</field>
</record>
<data>
<record model="ir.ui.view" id="product_get_cost_field_form">
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<field name="standard_price" position="after">
<field name="replenishment_cost"/>
</field>
</field>
</record>

<record model="ir.ui.view" id="product_get_cost_field_tree">
<field name="name">product.get_cost_field.view.tree</field>
<field name="type">tree</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view" />
<field name="arch" type="xml">
<field name="standard_price" position="after">
<field name="cost_price"/>
</field>
<field name="standard_price" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
</data>
</data>
</openerp>

0 comments on commit d5f78a2

Please sign in to comment.