diff --git a/addons/product/product.py b/addons/product/product.py
index eaa1df9ebf2..035ff1f0faa 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -69,15 +69,15 @@ class product_uom(osv.osv):
'name': fields.char('Name', size=64, required=True, translate=True),
'category_id': fields.many2one('product.uom.categ', 'UoM Category', required=True, ondelete='cascade',
help="Quantity conversions may happen automatically between Units of Measure in the same category, according to their respective ratios."),
- 'factor': fields.float('Ratio', digits=(12, 6), required=True,
+ 'factor': fields.float('Ratio', digits_compute=dp.get_precision('Product UoM'), required=True,
help='How many times this UoM is smaller than the reference UoM in this category:\n'\
'1 * (reference unit) = ratio * (this unit)'),
- 'factor_inv': fields.function(_factor_inv, digits=(12, 6),
+ 'factor_inv': fields.function(_factor_inv, digits_compute=dp.get_precision('Product UoM'),
fnct_inv=_factor_inv_write,
method=True, string='Ratio',
help='How many times this UoM is bigger than the reference UoM in this category:\n'\
'1 * (this unit) = ratio * (reference unit)', required=True),
- 'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
+ 'rounding': fields.float('Rounding Precision', digits_compute=dp.get_precision('Product UoM'), required=True,
help="The computed quantity will be a multiple of this value. "\
"Use 1.0 for a UoM that cannot be further split, such as a piece."),
'active': fields.boolean('Active', help="By unchecking the active field you can disable a unit of measure without deleting it."),
diff --git a/addons/product/product_data.xml b/addons/product/product_data.xml
index e7cd7623f96..962f8aca560 100644
--- a/addons/product/product_data.xml
+++ b/addons/product/product_data.xml
@@ -156,6 +156,9 @@ parameter) will see those record just disappear.
Stock Weight
2
-
+
+ Product UoM
+
+
diff --git a/addons/stock/product.py b/addons/stock/product.py
index c6b5500c38c..bdaec60832e 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -21,6 +21,7 @@
from osv import fields, osv
from tools.translate import _
+import decimal_precision as dp
class product_product(osv.osv):
_inherit = "product.product"
@@ -314,10 +315,10 @@ class product_product(osv.osv):
return res
_columns = {
- 'qty_available': fields.function(_product_available, method=True, type='float', string='Real Stock', help="Current quantities of products in selected locations or all internal if none have been selected.", multi='qty_available'),
- 'virtual_available': fields.function(_product_available, method=True, type='float', string='Virtual Stock', help="Future stock for this product according to the selected locations or all internal if none have been selected. Computed as: Real Stock - Outgoing + Incoming.", multi='qty_available'),
- 'incoming_qty': fields.function(_product_available, method=True, type='float', string='Incoming', help="Quantities of products that are planned to arrive in selected locations or all internal if none have been selected.", multi='qty_available'),
- 'outgoing_qty': fields.function(_product_available, method=True, type='float', string='Outgoing', help="Quantities of products that are planned to leave in selected locations or all internal if none have been selected.", multi='qty_available'),
+ 'qty_available': fields.function(_product_available, method=True, type='float', string='Real Stock', help="Current quantities of products in selected locations or all internal if none have been selected.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
+ 'virtual_available': fields.function(_product_available, method=True, type='float', string='Virtual Stock', help="Future stock for this product according to the selected locations or all internal if none have been selected. Computed as: Real Stock - Outgoing + Incoming.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
+ 'incoming_qty': fields.function(_product_available, method=True, type='float', string='Incoming', help="Quantities of products that are planned to arrive in selected locations or all internal if none have been selected.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
+ 'outgoing_qty': fields.function(_product_available, method=True, type='float', string='Outgoing', help="Quantities of products that are planned to leave in selected locations or all internal if none have been selected.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
'track_production': fields.boolean('Track Manufacturing Lots' , help="Forces to specify a Production Lot for all moves containing this product and generated by a Manufacturing Order"),
'track_incoming': fields.boolean('Track Incoming Lots', help="Forces to specify a Production Lot for all moves containing this product and coming from a Supplier Location"),
'track_outgoing': fields.boolean('Track Outgoing Lots', help="Forces to specify a Production Lot for all moves containing this product and going to a Customer Location"),
diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py
index 3e005c3a51a..f7aab3c1895 100644
--- a/addons/stock/report/report_stock_move.py
+++ b/addons/stock/report/report_stock_move.py
@@ -135,7 +135,7 @@ class report_stock_inventory(osv.osv):
'location_id': fields.many2one('stock.location', 'Location', readonly=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
- 'product_qty':fields.float('Qty', digits=(16,2), readonly=True),
+ 'product_qty':fields.float('Quantity', digits=(16,2), readonly=True),
'value' : fields.float('Total Value', digits=(16,2), required=True),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index cb9259f08cc..31752fcd7f1 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -178,8 +178,8 @@ class stock_location(osv.osv):
# temporarily removed, as it's unused: 'allocation_method': fields.selection([('fifo', 'FIFO'), ('lifo', 'LIFO'), ('nearest', 'Nearest')], 'Allocation Method', required=True),
'complete_name': fields.function(_complete_name, method=True, type='char', size=100, string="Location Name"),
- 'stock_real': fields.function(_product_qty_available, method=True, type='float', string='Real Stock', multi="stock"),
- 'stock_virtual': fields.function(_product_qty_available, method=True, type='float', string='Virtual Stock', multi="stock"),
+ 'stock_real': fields.function(_product_qty_available, method=True, type='float', string='Real Stock', multi="stock", digits_compute=dp.get_precision('Product UoM')),
+ 'stock_virtual': fields.function(_product_qty_available, method=True, type='float', string='Virtual Stock', multi="stock", digits_compute=dp.get_precision('Product UoM')),
'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'),
'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'),
@@ -216,8 +216,8 @@ class stock_location(osv.osv):
'parent_left': fields.integer('Left Parent', select=1),
'parent_right': fields.integer('Right Parent', select=1),
- 'stock_real_value': fields.function(_product_value, method=True, type='float', string='Real Stock Value', multi="stock"),
- 'stock_virtual_value': fields.function(_product_value, method=True, type='float', string='Virtual Stock Value', multi="stock"),
+ 'stock_real_value': fields.function(_product_value, method=True, type='float', string='Real Stock Value', multi="stock", digits_compute=dp.get_precision('Account')),
+ 'stock_virtual_value': fields.function(_product_value, method=True, type='float', string='Virtual Stock Value', multi="stock", digits_compute=dp.get_precision('Account')),
'company_id': fields.many2one('res.company', 'Company', select=1, help='Let this field empty if this location is shared between all companies'),
'scrap_location': fields.boolean('Scrap Location', help='Check this box to allow using this location to put scrapped/damaged goods.'),
}
@@ -1358,7 +1358,9 @@ class stock_production_lot(osv.osv):
'prefix': fields.char('Prefix', size=64, help="Optional prefix to prepend when displaying this serial number: PREFIX/SERIAL [INT_REF]"),
'product_id': fields.many2one('product.product', 'Product', required=True),
'date': fields.datetime('Creation Date', required=True),
- 'stock_available': fields.function(_get_stock, fnct_search=_stock_search, method=True, type="float", string="Available", select="2", help="Current quantity of products with this Production Lot Number available in company warehouses"),
+ 'stock_available': fields.function(_get_stock, fnct_search=_stock_search, method=True, type="float", string="Available", select=True,
+ help="Current quantity of products with this Production Lot Number available in company warehouses",
+ digits_compute=dp.get_precision('Product UoM')),
'revisions': fields.one2many('stock.production.lot.revision', 'lot_id', 'Revisions'),
'company_id': fields.many2one('res.company', 'Company', select=True),
'move_ids': fields.one2many('stock.move', 'prodlot_id', 'Moves for this production lot', readonly=True),
@@ -1463,9 +1465,9 @@ class stock_move(osv.osv):
'date_expected': fields.datetime('Date Expected', readonly=True,required=True, help="Scheduled date for the movement of the products"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')]),
- 'product_qty': fields.float('Quantity', required=True),
+ 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True),
'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True),
- 'product_uos_qty': fields.float('Quantity (UOS)'),
+ 'product_uos_qty': fields.float('Quantity (UOS)', digits_compute=dp.get_precision('Product UoM')),
'product_uos': fields.many2one('product.uom', 'Product UOS'),
'product_packaging': fields.many2one('product.packaging', 'Packaging', help="It specifies attributes of packaging like type, quantity of packaging,etc."),
@@ -2489,7 +2491,7 @@ class stock_inventory_line(osv.osv):
'location_id': fields.many2one('stock.location', 'Location', required=True),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
- 'product_qty': fields.float('Quantity'),
+ 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM')),
'company_id': fields.related('inventory_id','company_id',type='many2one',relation='res.company',string='Company',store=True, select=True),
'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"),
'state': fields.related('inventory_id','state',type='char',string='State',readonly=True),
@@ -2592,8 +2594,8 @@ class report_products_to_received_planned(osv.osv):
_auto = False
_columns = {
'date':fields.date('Date'),
- 'qty': fields.integer('Actual Qty'),
- 'planned_qty': fields.integer('Planned Qty'),
+ 'qty': fields.float('Actual Qty', digits_compute=dp.get_precision('Product UoM')),
+ 'planned_qty': fields.float('Planned Qty', digits_compute=dp.get_precision('Product UoM')),
}
def init(self, cr):
@@ -2626,8 +2628,8 @@ class report_delivery_products_planned(osv.osv):
_auto = False
_columns = {
'date':fields.date('Date'),
- 'qty': fields.integer('Actual Qty'),
- 'planned_qty': fields.integer('Planned Qty'),
+ 'qty': fields.float('Actual Qty', digits_compute=dp.get_precision('Product UoM')),
+ 'planned_qty': fields.float('Planned Qty', digits_compute=dp.get_precision('Product UoM')),
}