diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml
index 1f38f6e845c..360b6c8e94e 100644
--- a/addons/delivery/delivery_view.xml
+++ b/addons/delivery/delivery_view.xml
@@ -248,7 +248,6 @@
-
@@ -284,7 +283,6 @@
-
@@ -301,7 +299,6 @@
-
diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py
index 26c8d4f7864..69238eee0be 100644
--- a/addons/delivery/stock.py
+++ b/addons/delivery/stock.py
@@ -14,20 +14,9 @@ class stock_picking(osv.osv):
def _cal_weight(self, cr, uid, ids, name, args, context=None):
res = {}
for picking in self.browse(cr, uid, ids, context=context):
- total_weight = total_weight_net = 0.00
-
- for move in picking.move_lines:
- if move.state != 'cancel':
- total_weight += move.weight
- total_weight_net += move.weight_net
-
- res[picking.id] = {
- 'weight': total_weight,
- 'weight_net': total_weight_net,
- }
+ res[picking.id] = sum(move.weight for move in picking.move_lines if move.state != 'cancel')
return res
-
def _get_picking_line(self, cr, uid, ids, context=None):
result = {}
for line in self.pool.get('stock.move').browse(cr, uid, ids, context=context):
@@ -38,12 +27,7 @@ class stock_picking(osv.osv):
_columns = {
'carrier_id':fields.many2one("delivery.carrier","Carrier"),
'volume': fields.float('Volume', copy=False),
- 'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
- store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 40),
- 'stock.move': (_get_picking_line, ['state', 'picking_id', 'product_id','product_uom_qty','product_uom'], 40),
- }),
- 'weight_net': fields.function(_cal_weight, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
+ 'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'),
store={
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 40),
'stock.move': (_get_picking_line, ['state', 'picking_id', 'product_id','product_uom_qty','product_uom'], 40),
@@ -93,6 +77,7 @@ class stock_picking(osv.osv):
fpos = picking.sale_id.fiscal_position_id
elif picking.partner_id:
fpos = partner.property_account_position_id
+ # TDE FIXME: spotted undefined variable
account_id = fpos_obj.map_account(cr, uid, fpos, account_id, context=context)
taxes_ids = fpos_obj.map_tax(cr, uid, fpos, taxes, context=context)
@@ -136,28 +121,15 @@ class stock_move(osv.osv):
def _cal_move_weight(self, cr, uid, ids, name, args, context=None):
res = {}
- uom_obj = self.pool.get('product.uom')
for move in self.browse(cr, uid, ids, context=context):
- weight = weight_net = 0.00
+ weight = 0.00
if move.product_id.weight > 0.00:
- converted_qty = move.product_qty
- weight = (converted_qty * move.product_id.weight)
-
- if move.product_id.weight_net > 0.00:
- weight_net = (converted_qty * move.product_id.weight_net)
-
- res[move.id] = {
- 'weight': weight,
- 'weight_net': weight_net,
- }
+ weight = move.product_qty * move.product_id.weight
+ res[move.id] = weight
return res
_columns = {
- 'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
- store={
- 'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_uom_qty', 'product_uom'], 30),
- }),
- 'weight_net': fields.function(_cal_move_weight, type='float', string='Net weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
+ 'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'),
store={
'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_uom_qty', 'product_uom'], 30),
}),
diff --git a/addons/delivery/test/stock_move_values_with_invoice_before_delivery.yml b/addons/delivery/test/stock_move_values_with_invoice_before_delivery.yml
index 61fa086c5c2..3409c82f0e4 100644
--- a/addons/delivery/test/stock_move_values_with_invoice_before_delivery.yml
+++ b/addons/delivery/test/stock_move_values_with_invoice_before_delivery.yml
@@ -4,7 +4,7 @@
set a weight on ipod 16GB
-
!python {model: product.product, id: product.product_product_11}: |
- self.write({'weight': 0.25, 'weight_net': 0.2})
+ self.write({'weight': 0.25})
-
create a SO with invoice before delivery
-
@@ -66,7 +66,6 @@
move = self.picking_ids.move_lines
assert move.product_qty == 2, 'wrong product_qty'
assert move.weight == 0.5, 'wrong move weight'
- assert move.weight_net == 0.4, 'wrong move weight_net'
-
ship
-
diff --git a/addons/l10n_be_intrastat/wizard/xml_decl.py b/addons/l10n_be_intrastat/wizard/xml_decl.py
index 8b3b95e7447..8b6ac110421 100644
--- a/addons/l10n_be_intrastat/wizard/xml_decl.py
+++ b/addons/l10n_be_intrastat/wizard/xml_decl.py
@@ -313,9 +313,9 @@ class xml_decl(osv.TransientModel):
if (not inv_line.uos_id.category_id
or not inv_line.product_id.uom_id.category_id
or inv_line.uos_id.category_id.id != inv_line.product_id.uom_id.category_id.id):
- weight = inv_line.product_id.weight_net * inv_line.quantity
+ weight = inv_line.product_id.weight * inv_line.quantity
else:
- weight = (inv_line.product_id.weight_net *
+ weight = (inv_line.product_id.weight *
inv_line.quantity * inv_line.uos_id.factor)
if (not inv_line.uos_id.category_id or not inv_line.product_id.uom_id.category_id
or inv_line.uos_id.category_id.id != inv_line.product_id.uom_id.category_id.id):
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index de8bd18a3d5..c523523d679 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -10,7 +10,6 @@ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
from openerp import tools, SUPERUSER_ID
-from openerp.addons.product import _common
from openerp.exceptions import UserError, AccessError
@@ -276,7 +275,10 @@ class mrp_bom(osv.osv):
def _factor(factor, product_efficiency, product_rounding):
factor = factor / (product_efficiency or 1.0)
- factor = _common.ceiling(factor, product_rounding)
+ if product_rounding:
+ factor = tools.float_round(factor,
+ precision_rounding=product_rounding,
+ rounding_method='UP')
if factor < product_rounding:
factor = product_rounding
return factor
diff --git a/addons/product/_common.py b/addons/product/_common.py
deleted file mode 100644
index c0aff8cba9a..00000000000
--- a/addons/product/_common.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import tools
-
-def rounding(f, r):
- # TODO for trunk: log deprecation warning
- # _logger.warning("Deprecated rounding method, please use tools.float_round to round floats.")
- return tools.float_round(f, precision_rounding=r)
-
-# TODO for trunk: add rounding method parameter to tools.float_round and use this method as hook
-def ceiling(f, r):
- if not r:
- return f
- return tools.float_round(f, precision_rounding=r, rounding_method='UP')
diff --git a/addons/product/product.py b/addons/product/product.py
index 61079b878e6..84cc1fffebb 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-import math
import re
import time
-from _common import ceiling
-
from openerp import api, tools, SUPERUSER_ID
from openerp.osv import osv, fields, expression
@@ -478,8 +475,7 @@ class product_template(osv.osv):
help="Cost price of the product template used for standard stock valuation in accounting and used as a base price on purchase orders. "
"Expressed in the default unit of measure of the product..", groups="base.group_user", store=True),
'volume': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Volume', help="The volume in m3.", store=True),
- 'weight': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The gross weight in Kg.", store=True),
- 'weight_net': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Net Weight', digits_compute=dp.get_precision('Stock Weight'), help="The net weight in Kg.", store=True),
+ 'weight': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The weight of the contents in Kg, not including any packaging, etc.", store=True),
'warranty': fields.float('Warranty'),
'sale_ok': fields.boolean('Can be Sold', help="Specify if the product can be selected in a sales order line."),
'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'),
@@ -693,8 +689,6 @@ class product_template(osv.osv):
related_vals['volume'] = vals['volume']
if vals.get('weight'):
related_vals['weight'] = vals['weight']
- if vals.get('weight_net'):
- related_vals['weight_net'] = vals['weight_net']
if related_vals:
self.write(cr, uid, product_template_id, related_vals, context=context)
@@ -952,8 +946,7 @@ class product_product(osv.osv):
"Expressed in the default unit of measure of the product.",
groups="base.group_user", string="Cost Price"),
'volume': fields.float('Volume', help="The volume in m3."),
- 'weight': fields.float('Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The gross weight in Kg."),
- 'weight_net': fields.float('Net Weight', digits_compute=dp.get_precision('Stock Weight'), help="The net weight in Kg."),
+ 'weight': fields.float('Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The weight of the contents in Kg, not including any packaging, etc."),
}
_defaults = {
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 7b0ff540c46..3d2c46def0d 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -37,7 +37,6 @@
-
@@ -114,7 +113,6 @@
-
@@ -252,7 +250,6 @@
-
@@ -453,7 +450,6 @@
-
diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
index 5a38fbe61dd..c677ebc5310 100644
--- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
+++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
@@ -21,7 +21,6 @@
volume: 0.0
warranty: 0.0
weight: 0.0
- weight_net: 0.0
-
Create an analytic journal for employees timesheet
-
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 63212c265ae..47fd47ef794 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -1,17 +1,15 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-import pytz
from openerp import SUPERUSER_ID, workflow
from datetime import datetime
from dateutil.relativedelta import relativedelta
from operator import attrgetter
-from openerp.tools.safe_eval import safe_eval as eval
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.osv.orm import browse_record_list, browse_record, browse_null
-from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP
+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.float_utils import float_compare
from openerp.exceptions import UserError
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index 976ab5ea9c6..8e77a3a5c1a 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -1,10 +1,8 @@
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from datetime import datetime
from openerp.osv import fields, osv
from openerp.tools.translate import _
-from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
import openerp.addons.decimal_precision as dp
from openerp.exceptions import UserError
@@ -369,7 +367,16 @@ class product_template(osv.osv):
_inherit = 'product.template'
_columns = {
- 'purchase_requisition': fields.boolean('Call for Tenders', help="Check this box to generate Call for Tenders instead of generating requests for quotation from procurement.")
+ 'purchase_requisition': fields.selection(
+ [('rfq', 'Create a draft purchase order'),
+ ('tenders', 'Propose a call for tenders')],
+ string='Procurement',
+ help="Check this box to generate Call for Tenders instead of generating "
+ "requests for quotation from procurement."),
+ }
+
+ _defaults = {
+ 'purchase_requisition': 'rfq',
}
@@ -386,7 +393,7 @@ class procurement_order(osv.osv):
res = {}
for procurement in self.browse(cr, uid, ids, context=context):
res[procurement.id] = False
- if procurement.product_id.purchase_requisition:
+ if procurement.product_id.purchase_requisition == 'tenders':
warehouse_id = warehouse_obj.search(cr, uid, [('company_id', '=', procurement.company_id.id)], context=context)
requisition_id = requisition_obj.create(cr, uid, {
'origin': procurement.origin,
@@ -411,7 +418,7 @@ class procurement_order(osv.osv):
return res
def _check(self, cr, uid, procurement, context=None):
- if procurement.rule_id and procurement.rule_id.action == 'buy' and procurement.product_id.purchase_requisition:
+ if procurement.rule_id and procurement.rule_id.action == 'buy' and procurement.product_id.purchase_requisition == 'tenders':
if procurement.requisition_id.state == 'done':
if any([purchase.shipped for purchase in procurement.requisition_id.purchase_ids]):
return True
diff --git a/addons/purchase_requisition/purchase_requisition_demo.xml b/addons/purchase_requisition/purchase_requisition_demo.xml
index 1702ab079de..b9b4b041eea 100644
--- a/addons/purchase_requisition/purchase_requisition_demo.xml
+++ b/addons/purchase_requisition/purchase_requisition_demo.xml
@@ -7,7 +7,7 @@
-
+ tenders
diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml
index 3333282d5cb..2c33e7fab82 100644
--- a/addons/purchase_requisition/purchase_requisition_view.xml
+++ b/addons/purchase_requisition/purchase_requisition_view.xml
@@ -196,7 +196,7 @@
-
+
diff --git a/addons/report_intrastat/report_intrastat.py b/addons/report_intrastat/report_intrastat.py
index ec1083a0cd2..024b1a65efa 100644
--- a/addons/report_intrastat/report_intrastat.py
+++ b/addons/report_intrastat/report_intrastat.py
@@ -70,8 +70,8 @@ class report_intrastat(osv.osv):
else 0
end) as value,
sum(
- case when uom.category_id != puom.category_id then (pp.weight_net * inv_line.quantity)
- else (pp.weight_net * inv_line.quantity * uom.factor) end
+ case when uom.category_id != puom.category_id then (pt.weight * inv_line.quantity)
+ else (pt.weight * inv_line.quantity * uom.factor) end
) as weight,
sum(
case when uom.category_id != puom.category_id then inv_line.quantity
diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py
index 46f16b367cb..40bba95b617 100644
--- a/addons/sale_margin/sale_margin.py
+++ b/addons/sale_margin/sale_margin.py
@@ -44,7 +44,7 @@ class sale_order_line(osv.osv):
_columns = {
'margin': fields.function(_product_margin, string='Margin', digits_compute= dp.get_precision('Product Price'),
store = True),
- 'purchase_price': fields.float('Cost Price', digits_compute= dp.get_precision('Product Price'))
+ 'purchase_price': fields.float('Cost', digits_compute= dp.get_precision('Product Price'))
}
@@ -68,7 +68,7 @@ class sale_order(osv.osv):
return result.keys()
_columns = {
- 'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and the cost price.", store={
+ 'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and the cost.", store={
'sale.order.line': (_get_order, ['margin', 'purchase_price'], 20),
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 20),
}, digits_compute= dp.get_precision('Product Price')),
diff --git a/addons/stock/product.py b/addons/stock/product.py
index c0183c20ec4..f760584adbc 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -235,7 +235,6 @@ class product_product(osv.osv):
"or any of its children.\n"
"Otherwise, this includes goods stored in any Stock Location "
"with 'internal' type."),
- 'qty_available2': fields.related('qty_available', type="float", relation="product.product", string="On Hand"),
'virtual_available': fields.function(_product_available, multi='qty_available',
type='float', digits_compute=dp.get_precision('Product Unit of Measure'),
string='Forecast Quantity',
@@ -273,8 +272,6 @@ class product_product(osv.osv):
"any of its children.\n"
"Otherwise, this includes goods leaving any Stock "
"Location with 'internal' type."),
- 'location_id': fields.dummy(string='Location', relation='stock.location', type='many2one'),
- 'warehouse_id': fields.dummy(string='Warehouse', relation='stock.warehouse', type='many2one'),
'orderpoint_ids': fields.one2many('stock.warehouse.orderpoint', 'product_id', 'Minimum Stock Rules'),
'nbr_reordering_rules': fields.function(_compute_nbr_reordering_rules, string='Reordering Rules', type='integer', multi=True),
'reordering_min_qty': fields.function(_compute_nbr_reordering_rules, type='float', multi=True),
@@ -397,7 +394,6 @@ class product_template(osv.osv):
_columns = {
'type': fields.selection([('product', 'Stockable Product'), ('consu', 'Consumable'), ('service', 'Service')], 'Product Type', required=True, help="Consumable: Will not imply stock management for this product. \nStockable product: Will imply stock management for this product."),
- 'qty_available2': fields.related('qty_available', type="float", relation="product.template", string="On Hand"),
'property_stock_procurement': fields.property(
type='many2one',
relation='stock.location',
@@ -417,10 +413,8 @@ class product_template(osv.osv):
domain=[('usage','like','inventory')],
help="This stock location will be used, instead of the default one, as the source location for stock moves generated when you do an inventory."),
'sale_delay': fields.float('Customer Lead Time', help="The average delay in days between the confirmation of the customer order and the delivery of the finished products. It's the time you promise to your customers."),
- 'loc_rack': fields.char('Rack', size=16),
- 'loc_row': fields.char('Row', size=16),
- 'loc_case': fields.char('Case', size=16),
'tracking': fields.selection(selection=[('serial', 'By Unique Serial Number'), ('lot', 'By Lots'), ('none', 'No Tracking')], string="Tracking", required=True),
+ 'description_picking': fields.text('Description on Picking', translate=True),
# sum of product variant qty
# 'reception_count': fields.function(_product_available, multi='qty_available',
# fnct_search=_search_product_quantity, type='float', string='Quantity On Hand'),
@@ -434,7 +428,8 @@ class product_template(osv.osv):
fnct_search=_search_product_quantity, type='float', string='Incoming'),
'outgoing_qty': fields.function(_product_available, multi='qty_available', digits_compute=dp.get_precision('Product Unit of Measure'),
fnct_search=_search_product_quantity, type='float', string='Outgoing'),
-
+ 'location_id': fields.dummy(string='Location', relation='stock.location', type='many2one'),
+ 'warehouse_id': fields.dummy(string='Warehouse', relation='stock.warehouse', type='many2one'),
'route_ids': fields.many2many('stock.location.route', 'stock_route_product', 'product_id', 'route_id', 'Routes', domain="[('product_selectable', '=', True)]",
help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO/MTS,..."),
'nbr_reordering_rules': fields.function(_compute_nbr_reordering_rules, string='Reordering Rules', type='integer', multi=True),
diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml
index 80ecfcc1842..17162086c9f 100644
--- a/addons/stock/product_view.xml
+++ b/addons/stock/product_view.xml
@@ -126,13 +126,6 @@
-
-
-
-
-
-
-
@@ -224,7 +217,7 @@
name="%(product_open_quants)d"
icon="fa-building-o"
type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations">
-
+