forked from OCA/margin-analysis
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d5bffa
commit d5f78a2
Showing
4 changed files
with
57 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
product_replenishment_cost/models/product_get_cost_field.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |