summaryrefslogtreecommitdiff
path: root/addons/stock_landed_costs/models
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2019-08-02 14:02:31 +0000
committerSimon Lejeune <sle@openerp.com>2019-08-07 14:11:21 +0000
commit24bca8fd4ae3ea1307c80e2262c4e5493520e228 (patch)
treedc92d179847e89b8169b81f15191e73a50cf34d2 /addons/stock_landed_costs/models
parent98f974cae305f868de97682db8b36e5c570d9e70 (diff)
[REF] stock_landed_costs: landed cost special product
We remove the special views/actions/menuitems for the "landed cost type" product. The user should now chose the split method on the landed costs directly. We still keep the landed_cost_ok field that will be used in the next commit integrating the landed costs with the vendor bill. task-59011
Diffstat (limited to 'addons/stock_landed_costs/models')
-rw-r--r--addons/stock_landed_costs/models/product.py16
-rw-r--r--addons/stock_landed_costs/models/stock_landed_cost.py14
2 files changed, 12 insertions, 18 deletions
diff --git a/addons/stock_landed_costs/models/product.py b/addons/stock_landed_costs/models/product.py
index 47719e4fe04..f3892c362b6 100644
--- a/addons/stock_landed_costs/models/product.py
+++ b/addons/stock_landed_costs/models/product.py
@@ -3,23 +3,9 @@
from odoo import fields, models
-SPLIT_METHOD = [
- ('equal', 'Equal'),
- ('by_quantity', 'By Quantity'),
- ('by_current_cost_price', 'By Current Cost'),
- ('by_weight', 'By Weight'),
- ('by_volume', 'By Volume'),
-]
-
class ProductTemplate(models.Model):
_inherit = "product.template"
landed_cost_ok = fields.Boolean('Is a Landed Cost', help='Indicates whether the product is a landed cost.')
- split_method = fields.Selection(
- selection=SPLIT_METHOD, string='Split Method', default='equal',
- help="Equal : Cost will be equally divided.\n"
- "By Quantity : Cost will be divided according to product's quantity.\n"
- "By Current cost : Cost will be divided according to product's current cost.\n"
- "By Weight : Cost will be divided depending on its weight.\n"
- "By Volume : Cost will be divided depending on its volume.")
+
diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py
index 1aa6451d0de..a516da51338 100644
--- a/addons/stock_landed_costs/models/stock_landed_cost.py
+++ b/addons/stock_landed_costs/models/stock_landed_cost.py
@@ -4,11 +4,19 @@
from collections import defaultdict
from odoo import api, fields, models, tools, _
-from odoo.addons.stock_landed_costs.models import product
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_is_zero
+SPLIT_METHOD = [
+ ('equal', 'Equal'),
+ ('by_quantity', 'By Quantity'),
+ ('by_current_cost_price', 'By Current Cost'),
+ ('by_weight', 'By Weight'),
+ ('by_volume', 'By Volume'),
+]
+
+
class LandedCost(models.Model):
_name = 'stock.landed.cost'
_description = 'Stock Landed Cost'
@@ -267,7 +275,7 @@ class LandedCostLine(models.Model):
required=True, ondelete='cascade')
product_id = fields.Many2one('product.product', 'Product', required=True)
price_unit = fields.Float('Cost', digits='Product Price', required=True)
- split_method = fields.Selection(product.SPLIT_METHOD, string='Split Method', required=True)
+ split_method = fields.Selection(SPLIT_METHOD, string='Split Method', required=True)
account_id = fields.Many2one('account.account', 'Account', domain=[('deprecated', '=', False)])
@api.onchange('product_id')
@@ -275,7 +283,7 @@ class LandedCostLine(models.Model):
if not self.product_id:
self.quantity = 0.0
self.name = self.product_id.name or ''
- self.split_method = self.product_id.split_method or 'equal'
+ self.split_method = 'equal'
self.price_unit = self.product_id.standard_price or 0.0
self.account_id = self.product_id.property_account_expense_id.id or self.product_id.categ_id.property_account_expense_categ_id.id