diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index d43bc75be7a..94c92574edd 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -95,7 +95,6 @@ class sale_configuration(osv.osv_memory): 'module_project_timesheet': fields.boolean("Project Timesheet"), 'module_project_mrp': fields.boolean("Project MRP"), 'module_project': fields.boolean("Project"), - 'decimal_precision': fields.integer('Decimal Precision on Price',help="As an example, a decimal precision of 2 will allow prices like: 9.99 EUR, whereas a decimal precision of 4 will allow prices like: 0.0231 EUR per unit."), } def _check_decimal(self, cr, uid, ids, context=None): for decimal in self.browse(cr, uid, ids, context=context): @@ -136,14 +135,6 @@ class sale_configuration(osv.osv_memory): 'time_unit': _get_default_time_unit, } - def get_default_dp(self, cr, uid, fields, context=None): - dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product','decimal_sale') - return {'decimal_precision': dp.digits} - - def set_default_dp(self, cr, uid, ids, context=None): - config = self.browse(cr, uid, ids[0], context) - dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product','decimal_sale') - dp.write({'digits': config.decimal_precision}) def set_sale_defaults(self, cr, uid, ids, context=None): ir_values = self.pool.get('ir.values') diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml index 2078c141b69..7874d18bd34 100644 --- a/addons/sale/res_config_view.xml +++ b/addons/sale/res_config_view.xml @@ -33,7 +33,6 @@ - diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 0a3ebbe72ac..746276a9c1a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -247,19 +247,19 @@ class sale_order(osv.osv): fnct_search=_invoiced_search, type='boolean', help="It indicates that an invoice has been paid."), 'note': fields.text('Terms and conditions'), - 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Sale Price'), string='Untaxed Amount', + 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount', store = { 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10), 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), }, multi='sums', help="The amount without tax."), - 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Sale Price'), string='Taxes', + 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Taxes', store = { 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10), 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), }, multi='sums', help="The tax amount."), - 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Sale Price'), string='Total', + 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total', store = { 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10), 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), @@ -1113,8 +1113,8 @@ class sale_order_line(osv.osv): 'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True), 'invoiced': fields.boolean('Invoiced', readonly=True), 'procurement_id': fields.many2one('procurement.order', 'Procurement'), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}), - 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Sale Price')), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit'), readonly=True, states={'draft': [('readonly', False)]}), + 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')), 'tax_id': fields.many2many('account.tax', 'sale_order_tax', 'order_line_id', 'tax_id', 'Taxes', readonly=True, states={'draft': [('readonly', False)]}), 'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="If 'on order', it triggers a procurement when the sale order is confirmed to create a task, purchase order or manufacturing order linked to this sale order line."), @@ -1126,7 +1126,7 @@ class sale_order_line(osv.osv): 'product_uos': fields.many2one('product.uom', 'Product UoS'), 'product_packaging': fields.many2one('product.packaging', 'Packaging'), 'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True), - 'discount': fields.float('Discount (%)', digits=(16, 2), readonly=True, states={'draft': [('readonly', False)]}), + 'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Discount'), readonly=True, states={'draft': [('readonly', False)]}), 'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'), 'notes': fields.text('Notes'), 'th_weight': fields.float('Weight', readonly=True, states={'draft': [('readonly', False)]}), diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index f3d9bd65a91..47c6236d9a4 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -36,7 +36,7 @@ class sale_advance_payment_inv(osv.osv_memory): _columns = { 'product_id': fields.many2one('product.product', 'Advance Product', help="Select a product of type service which is called 'Advance Product'. You may have to create it and set it as a default value on this field."), - 'amount': fields.float('Advance Amount', digits_compute= dp.get_precision('Sale Price'), required=True, help="The amount to be invoiced in advance."), + 'amount': fields.float('Advance Amount', digits_compute= dp.get_precision('Account'), required=True, help="The amount to be invoiced in advance."), 'qtty': fields.float('Quantity', digits=(16, 2), required=True), 'advance_payment_method':fields.selection([('percentage','Percentage'), ('fixed','Fixed Price')], 'Type', required=True, help="Use Fixed Price if you want to give specific amound in Advance, Use Percentage if you want to give percentage of Total Invoice Amount."), }