From 7cb6f34e8817a991803ab16fc995b1617b311c02 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 14:24:01 +0200 Subject: [PATCH 01/17] [REF] remove sale and purchase precision and replace it by price unit precision. Add discount precision. bzr revid: benoit.guillot@akretion.com.br-20120710122401-mt3fvdlqy7d2zz5y --- addons/product/pricelist.py | 8 ++++---- addons/product/product.py | 14 +++++++------- addons/product/product_data.xml | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index ea29292f445..2e86192bc7a 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -408,18 +408,18 @@ class product_pricelist_item(osv.osv): 'base_pricelist_id': fields.many2one('product.pricelist', 'If Other Pricelist'), 'price_surcharge': fields.float('Price Surcharge', - digits_compute= dp.get_precision('Sale Price')), + digits_compute= dp.get_precision('Price Unit')), 'price_discount': fields.float('Price Discount', digits=(16,4)), 'price_round': fields.float('Price Rounding', - digits_compute= dp.get_precision('Sale Price'), + digits_compute= dp.get_precision('Price Unit'), help="Sets the price so that it is a multiple of this value.\n" \ "Rounding is applied after the discount and before the surcharge.\n" \ "To have prices that end in 9.99, set rounding 10, surcharge -0.01" \ ), 'price_min_margin': fields.float('Min. Price Margin', - digits_compute= dp.get_precision('Sale Price')), + digits_compute= dp.get_precision('Price Unit')), 'price_max_margin': fields.float('Max. Price Margin', - digits_compute= dp.get_precision('Sale Price')), + digits_compute= dp.get_precision('Price Unit')), 'company_id': fields.related('price_version_id','company_id',type='many2one', readonly=True, relation='res.company', string='Company', store=True) } diff --git a/addons/product/product.py b/addons/product/product.py index a81074aa56e..4506387cd1c 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -297,8 +297,8 @@ class product_template(osv.osv): 'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procurement Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."), 'rental': fields.boolean('Can be Rent'), 'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"), - 'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Sale Price'), help="Base price for computing the customer price. Sometimes called the catalog price."), - 'standard_price': fields.float('Cost Price', required=True, digits_compute=dp.get_precision('Purchase Price'), help="Product's cost for accounting stock valuation. It is the base price for the supplier price.", groups="base.group_user"), + 'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Price Unit'), help="Base price for computing the customer price. Sometimes called the catalog price."), + 'standard_price': fields.float('Cost Price', required=True, digits_compute=dp.get_precision('Price Unit'), help="Product's cost for accounting stock valuation. It is the base price for the supplier price.", groups="base.group_user"), '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."), @@ -510,8 +510,8 @@ class product_product(osv.osv): 'virtual_available': fields.function(_product_virtual_available, type='float', string='Quantity Available'), 'incoming_qty': fields.function(_product_incoming_qty, type='float', string='Incoming'), 'outgoing_qty': fields.function(_product_outgoing_qty, type='float', string='Outgoing'), - 'price': fields.function(_product_price, type='float', string='Pricelist', digits_compute=dp.get_precision('Sale Price')), - 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Sale Price')), + 'price': fields.function(_product_price, type='float', string='Pricelist', digits_compute=dp.get_precision('Price Unit')), + 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Price Unit')), 'code': fields.function(_product_code, type='char', string='Reference'), 'partner_ref' : fields.function(_product_partner_ref, type='char', string='Customer ref'), 'default_code' : fields.char('Reference', size=64, select=True), @@ -520,8 +520,8 @@ class product_product(osv.osv): 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade"), 'ean13': fields.char('EAN13', size=13, help="The numbers encoded in EAN-13 bar codes are product identification numbers."), 'packaging' : fields.one2many('product.packaging', 'product_id', 'Logistical Units', help="Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."), - 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Sale Price')), - 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Sale Price')), + 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Price Unit')), + 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Price Unit')), 'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'), 'name_template': fields.related('product_tmpl_id', 'name', string="Name", type='char', size=128, store=True, select=True), 'color': fields.integer('Color Index'), @@ -845,7 +845,7 @@ class pricelist_partnerinfo(osv.osv): 'name': fields.char('Description', size=64), 'suppinfo_id': fields.many2one('product.supplierinfo', 'Partner Information', required=True, ondelete='cascade'), 'min_quantity': fields.float('Quantity', required=True, help="The minimal quantity to trigger this rule, expressed in the supplier Unit of Measure if any or in the default Unit of Measure of the product otherrwise."), - 'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price'), help="This price will be considered as a price for the supplier Unit of Measure if any or the default Unit of Measure of the product otherwise"), + 'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Price Unit'), help="This price will be considered as a price for the supplier Unit of Measure if any or the default Unit of Measure of the product otherwise"), } _order = 'min_quantity asc' pricelist_partnerinfo() diff --git a/addons/product/product_data.xml b/addons/product/product_data.xml index 8f10b7b2762..27ef14923ee 100644 --- a/addons/product/product_data.xml +++ b/addons/product/product_data.xml @@ -144,12 +144,12 @@ parameter) will see those record just disappear. - - Sale Price + + Price Unit 2 - - Purchase Price + + Discount 2 From e67b4b6949986cc9358bd048186d2bd0294a2b99 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 14:24:31 +0200 Subject: [PATCH 02/17] [REF] replace sale price precision by price unit and account precision. Remove sale precision from config view bzr revid: benoit.guillot@akretion.com.br-20120710122431-z6kfajvt7yik9kt2 --- addons/sale/res_config.py | 9 --------- addons/sale/res_config_view.xml | 1 - addons/sale/sale.py | 12 ++++++------ addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) 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."), } From 1686d1ee3e81581d00e5fee53a71b457275ee172 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 14:24:57 +0200 Subject: [PATCH 03/17] [REF] replace purchase price precision by price unit and account precision. Remove purchase precision from config view bzr revid: benoit.guillot@akretion.com.br-20120710122457-nv77lhcit0fxyu04 --- addons/purchase/purchase.py | 10 +++++----- addons/purchase/res_config.py | 9 --------- addons/purchase/res_config_view.xml | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e74ca83a92b..461682016fb 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -190,15 +190,15 @@ class purchase_order(osv.osv): 'purchase.order.line': (_get_order, ['date_planned'], 10), } ), - 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Untaxed Amount', + 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount', store={ 'purchase.order.line': (_get_order, None, 10), }, multi="sums", help="The amount without tax"), - 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Taxes', + 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Taxes', store={ 'purchase.order.line': (_get_order, None, 10), }, multi="sums", help="The tax amount"), - 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Total', + 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total', store={ 'purchase.order.line': (_get_order, None, 10), }, multi="sums",help="The total amount"), @@ -804,8 +804,8 @@ class purchase_order_line(osv.osv): 'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True), 'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'), 'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Purchase Price')), - 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Purchase Price')), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')), + 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')), 'notes': fields.text('Notes'), 'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'), 'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',), diff --git a/addons/purchase/res_config.py b/addons/purchase/res_config.py index c5e72db9f1a..be9afaaf36b 100644 --- a/addons/purchase/res_config.py +++ b/addons/purchase/res_config.py @@ -59,21 +59,12 @@ class purchase_config_settings(osv.osv_memory): help="""Purchase Requisitions are used when you want to request quotations from several suppliers for a given set of products. You can configure per product if you directly do a Request for Quotation to one supplier or if you want a purchase requisition to negotiate with several suppliers."""), - '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."), } _defaults = { 'default_invoice_method': 'manual', } - def get_default_dp(self, cr, uid, fields, context=None): - dp = self.pool.get('ir.model.data').get_object(cr,uid, 'product','decimal_purchase') - 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_purchase') - dp.write({'digits': config.decimal_precision}) diff --git a/addons/purchase/res_config_view.xml b/addons/purchase/res_config_view.xml index 1e8588bf618..aa2383d7b1d 100644 --- a/addons/purchase/res_config_view.xml +++ b/addons/purchase/res_config_view.xml @@ -14,7 +14,7 @@ - + From 0cabce52dc924270f0e92bff287ff2f2e2296106 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 14:25:52 +0200 Subject: [PATCH 04/17] [REF] add price unit, discount and unity of mesure precision for fields in invoice line bzr revid: benoit.guillot@akretion.com.br-20120710122552-e32ugjdjbe6h2uh9 --- addons/account/account_invoice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index c6011979f8d..be016d6700c 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1351,11 +1351,11 @@ class account_invoice_line(osv.osv): 'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'), 'product_id': fields.many2one('product.product', 'Product', ondelete='set null'), 'account_id': fields.many2one('account.account', 'Account', required=True, domain=[('type','<>','view'), ('type', '<>', 'closed')], help="The income or expense account related to the selected product."), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Account')), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')), 'price_subtotal': fields.function(_amount_line, string='Subtotal', type="float", digits_compute= dp.get_precision('Account'), store=True), - 'quantity': fields.float('Quantity', required=True), - 'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Account')), + 'quantity': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), + 'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Discount')), 'invoice_line_tax_id': fields.many2many('account.tax', 'account_invoice_line_tax', 'invoice_line_id', 'tax_id', 'Taxes', domain=[('parent_id','=',False)]), 'note': fields.text('Notes'), 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'), From 05cb32962c67cee707619a793cc86cd3dd7e5ea9 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 14:28:46 +0200 Subject: [PATCH 05/17] [REF] ref decimal precision on expense fields bzr revid: benoit.guillot@akretion.com.br-20120710122846-8582vh8p8bimgufo --- addons/hr_expense/hr_expense.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index b1192701dfb..dbf3c34f4c1 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -72,7 +72,7 @@ class hr_expense_expense(osv.osv): 'account_move_id': fields.many2one('account.move', 'Ledger Posting'), 'line_ids': fields.one2many('hr.expense.line', 'expense_id', 'Expense Lines', readonly=True, states={'draft':[('readonly',False)]} ), 'note': fields.text('Note'), - 'amount': fields.function(_amount, string='Total Amount'), + 'amount': fields.function(_amount, string='Total Amount', digits_compute= dp.get_precision('Account')), 'invoice_id': fields.many2one('account.invoice', "Employee's Invoice"), 'currency_id': fields.many2one('res.currency', 'Currency', required=True), 'department_id':fields.many2one('hr.department','Department'), @@ -258,8 +258,8 @@ class hr_expense_line(osv.osv): 'date_value': fields.date('Date', required=True), 'expense_id': fields.many2one('hr.expense.expense', 'Expense', ondelete='cascade', select=True), 'total_amount': fields.function(_amount, string='Total', digits_compute=dp.get_precision('Account')), - 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Account')), - 'unit_quantity': fields.float('Quantities' ), + 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Price Unit')), + 'unit_quantity': fields.float('Quantities', digits_compute= dp.get_precision('Product Unit of Measure')), 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]), 'uom_id': fields.many2one('product.uom', 'Unit of Measure'), 'description': fields.text('Description'), From 0c82624467e1c26b98da03247ebf501c80b7ea0d Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 14:34:00 +0200 Subject: [PATCH 06/17] [REF] replace sale price precision by price unit precision bzr revid: benoit.guillot@akretion.com.br-20120710123400-w634cm3p75v8gcxm --- addons/hr_timesheet_invoice/report/report_analytic.py | 2 +- addons/marketing_campaign/marketing_campaign.py | 6 +++--- addons/marketing_campaign/report/campaign_analysis.py | 4 ++-- addons/membership/membership.py | 4 ++-- addons/membership/wizard/membership_invoice.py | 2 +- addons/mrp_repair/mrp_repair.py | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/hr_timesheet_invoice/report/report_analytic.py b/addons/hr_timesheet_invoice/report/report_analytic.py index 0ff758189ff..5a6b5cd472b 100644 --- a/addons/hr_timesheet_invoice/report/report_analytic.py +++ b/addons/hr_timesheet_invoice/report/report_analytic.py @@ -72,7 +72,7 @@ class report_account_analytic_line_to_invoice(osv.osv): 'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True), 'product_uom_id':fields.many2one('product.uom', 'Unit of Measure', readonly=True), 'unit_amount': fields.float('Units', readonly=True), - 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Sale Price')), + 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Price Unit')), 'amount': fields.float('Amount', readonly=True, digits_compute=dp.get_precision('Account')), 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True), diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py index 417bd694624..ea8d5552e41 100644 --- a/addons/marketing_campaign/marketing_campaign.py +++ b/addons/marketing_campaign/marketing_campaign.py @@ -120,7 +120,7 @@ Normal - the campaign runs normally and automatically sends all emails and repor 'Status',), 'activity_ids': fields.one2many('marketing.campaign.activity', 'campaign_id', 'Activities'), - 'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting.", digits_compute=dp.get_precision('Purchase Price')), + 'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting.", digits_compute=dp.get_precision('Price Unit')), } _defaults = { @@ -435,8 +435,8 @@ class marketing_campaign_activity(osv.osv): 'from_ids': fields.one2many('marketing.campaign.transition', 'activity_to_id', 'Previous Activities'), - 'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section", digits_compute=dp.get_precision('Purchase Price')), - 'revenue': fields.float('Revenue', help="Set an expected revenue if you consider that every campaign item that has reached this point has generated a certain revenue. You can get revenue statistics in the Reporting section", digits_compute=dp.get_precision('Sale Price')), + 'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section", digits_compute=dp.get_precision('Price Unit')), + 'revenue': fields.float('Revenue', help="Set an expected revenue if you consider that every campaign item that has reached this point has generated a certain revenue. You can get revenue statistics in the Reporting section", digits_compute=dp.get_precision('Account')), 'signal': fields.char('Signal', size=128, help='An activity with a signal can be called programmatically. Be careful, the workitem is always created when a signal is sent'), 'keep_if_condition_not_met': fields.boolean("Don't Delete Workitems", diff --git a/addons/marketing_campaign/report/campaign_analysis.py b/addons/marketing_campaign/report/campaign_analysis.py index 0330cd1f7d3..d469be9c25e 100644 --- a/addons/marketing_campaign/report/campaign_analysis.py +++ b/addons/marketing_campaign/report/campaign_analysis.py @@ -63,8 +63,8 @@ class campaign_analysis(osv.osv): 'country_id': fields.related('partner_id', 'country_id', type='many2one', relation='res.country',string='Country'), 'total_cost' : fields.function(_total_cost, string='Cost', - type="float", digits_compute=dp.get_precision('Purchase Price')), - 'revenue': fields.float('Revenue', readonly=True, digits_compute=dp.get_precision('Sale Price')), + type="float", digits_compute=dp.get_precision('Account')), + 'revenue': fields.float('Revenue', readonly=True, digits_compute=dp.get_precision('Account')), 'count' : fields.integer('# of Actions', readonly=True), 'state': fields.selection([('todo', 'To Do'), ('exception', 'Exception'), ('done', 'Done'), diff --git a/addons/membership/membership.py b/addons/membership/membership.py index dc4eadbada9..bf127cb3c5d 100644 --- a/addons/membership/membership.py +++ b/addons/membership/membership.py @@ -146,7 +146,7 @@ class membership_line(osv.osv): 'date_to': fields.date('To', readonly=True), 'date_cancel': fields.date('Cancel date'), 'date': fields.date('Join Date', help="Date on which member has joined the membership"), - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price'), required=True, help='Amount for the membership'), + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Price Unit'), required=True, help='Amount for the membership'), 'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True), 'account_invoice_id': fields.related('account_invoice_line', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice', readonly=True), 'state': fields.function(_state, @@ -447,7 +447,7 @@ Partner() class product_template(osv.osv): _inherit = 'product.template' _columns = { - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price')), + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Price Unit')), } product_template() diff --git a/addons/membership/wizard/membership_invoice.py b/addons/membership/wizard/membership_invoice.py index d0be223158f..80bfdfd50e2 100644 --- a/addons/membership/wizard/membership_invoice.py +++ b/addons/membership/wizard/membership_invoice.py @@ -29,7 +29,7 @@ class membership_invoice(osv.osv_memory): _description = "Membership Invoice" _columns = { 'product_id': fields.many2one('product.product','Membership', required=True), - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price'), required=True), + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Price Unit'), required=True), } def onchange_product(self, cr, uid, ids, product_id=False): """This function returns value of product's member price based on product id. diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 6f14ba22bea..1cb1aa884ce 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -640,8 +640,8 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): 'to_invoice': fields.boolean('To Invoice'), 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], required=True), 'invoiced': fields.boolean('Invoiced',readonly=True), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price')), - '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')), + 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), 'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'), 'product_uom_qty': fields.float('Quantity (Unit of Measure)', digits=(16,2), required=True), 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), @@ -735,7 +735,7 @@ class mrp_repair_fee(osv.osv, ProductChangeMixin): 'product_uom_qty': fields.float('Quantity', digits=(16,2), required=True), 'price_unit': fields.float('Unit Price', required=True), 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), - 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Sale Price')), + 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), 'tax_id': fields.many2many('account.tax', 'repair_fee_line_tax', 'repair_fee_line_id', 'tax_id', 'Taxes'), 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), 'to_invoice': fields.boolean('To Invoice'), From dfa4806290c120191fe826570d071c72eec10e64 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 21:54:38 +0200 Subject: [PATCH 07/17] [FIX] remove useless code bzr revid: benoit.guillot@akretion.com.br-20120710195438-m7k2kkwbukzmc3bs --- addons/sale/res_config.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index 94c92574edd..3dcbcfe8257 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -96,15 +96,6 @@ class sale_configuration(osv.osv_memory): 'module_project_mrp': fields.boolean("Project MRP"), 'module_project': fields.boolean("Project"), } - def _check_decimal(self, cr, uid, ids, context=None): - for decimal in self.browse(cr, uid, ids, context=context): - if decimal.decimal_precision > 20: - return False - return True - - _constraints = [ - (_check_decimal, 'Digits must be between 0 to 20 ', ['decimal_precision']), - ] def default_get(self, cr, uid, fields, context=None): ir_model_data = self.pool.get('ir.model.data') From 9c3eefeaa2d1b701f5554f834e43d9aa2bbe4d75 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 21:55:00 +0200 Subject: [PATCH 08/17] [IMP] add decimal precision on quantities bzr revid: benoit.guillot@akretion.com.br-20120710195500-x02qvubxb8tlrjue --- addons/mrp_repair/mrp_repair.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 1cb1aa884ce..62336aa4d4c 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -643,7 +643,7 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')), 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), 'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'), - 'product_uom_qty': fields.float('Quantity (Unit of Measure)', digits=(16,2), required=True), + 'product_uom_qty': fields.float('Quantity (Unit of Measure)', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), 'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number',domain="[('product_id','=',product_id)]"), 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), @@ -732,7 +732,7 @@ class mrp_repair_fee(osv.osv, ProductChangeMixin): 'repair_id': fields.many2one('mrp.repair', 'Repair Order Reference', required=True, ondelete='cascade', select=True), 'name': fields.char('Description', size=64, select=True,required=True), 'product_id': fields.many2one('product.product', 'Product'), - 'product_uom_qty': fields.float('Quantity', digits=(16,2), required=True), + 'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), 'price_unit': fields.float('Unit Price', required=True), 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), From 40647cd70fdb563dfac6195749961f15cd5e1095 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 10 Jul 2012 21:55:36 +0200 Subject: [PATCH 09/17] [FIX] fix a bug in trunk bzr revid: benoit.guillot@akretion.com.br-20120710195536-3hgyx3ozn0t9hnms --- addons/mail/static/src/js/mail.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 88f0b9ade43..c6a142e8596 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -540,11 +540,12 @@ openerp.mail = function(session) { this._super.apply(this, arguments); var self = this; this.reinit(); - if (! this.view.datarecord.id || - instance.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) { - this.$element.find('.oe_mail_thread').hide(); - return; - } + if (! this.view.datarecord.id) { this.$element.find('.oe_mail_thread').hide(); return; } +// if (! this.view.datarecord.id || +// instance.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) { +// this.$element.find('.oe_mail_thread').hide(); +// return; +// } // fetch followers var fetch_sub_done = this.fetch_subscribers(); // create and render Thread widget From df01b9a032f71f975ea1b867ff6759e3603b59f8 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 01:17:00 +0200 Subject: [PATCH 10/17] [FIX] replace sale price precision by price unit in the method prepare_order_line_invoice_line bzr revid: benoit.guillot@akretion.com.br-20120710231700-m4kdn9khr4di6oy0 --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 746276a9c1a..11af165880f 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1205,7 +1205,7 @@ class sale_order_line(osv.osv): pu = 0.0 if uosqty: pu = round(line.price_unit * line.product_uom_qty / uosqty, - self.pool.get('decimal.precision').precision_get(cr, uid, 'Sale Price')) + self.pool.get('decimal.precision').precision_get(cr, uid, 'Price Unit')) fpos = line.order_id.fiscal_position or False account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, account_id) if not account_id: From 65cde7728ebcaf06e60d3a0c34bdbbad2ecf01c0 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 01:18:47 +0200 Subject: [PATCH 11/17] [ADD] add decimal precision on price fields in the module delivery bzr revid: benoit.guillot@akretion.com.br-20120710231847-9ni8g0bbn380l3m3 --- addons/delivery/delivery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 75eb766f011..1b0b55ff175 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -237,8 +237,8 @@ class delivery_grid_line(osv.osv): 'max_value': fields.float('Maximum Value', required=True), 'price_type': fields.selection([('fixed','Fixed'),('variable','Variable')], 'Price Type', required=True), 'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable Factor', required=True), - 'list_price': fields.float('Sale Price', required=True), - 'standard_price': fields.float('Cost Price', required=True), + 'list_price': fields.float('Sale Price', digits_compute= dp.get_precision('Price Unit'), required=True), + 'standard_price': fields.float('Cost Price', digits_compute= dp.get_precision('Price Unit'), required=True), } _defaults = { 'type': lambda *args: 'weight', From 5b280dded9fb69f4a30e562fd80958aecf3296b4 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 11:00:27 +0200 Subject: [PATCH 12/17] [FIX] fix typo bzr revid: benoit.guillot@akretion.com.br-20120711090027-iq2cmu2tae7e62m7 --- addons/mail/static/src/js/mail.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index c6a142e8596..2140bbe474a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -540,12 +540,11 @@ openerp.mail = function(session) { this._super.apply(this, arguments); var self = this; this.reinit(); - if (! this.view.datarecord.id) { this.$element.find('.oe_mail_thread').hide(); return; } -// if (! this.view.datarecord.id || -// instance.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) { -// this.$element.find('.oe_mail_thread').hide(); -// return; -// } + if (! this.view.datarecord.id || + session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) { + this.$element.find('.oe_mail_thread').hide(); + return; + } // fetch followers var fetch_sub_done = this.fetch_subscribers(); // create and render Thread widget From 915510435954a6ebeb726cc9de6c15f2b43cfd1e Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 11:01:36 +0200 Subject: [PATCH 13/17] [FIX] fix bad precision for report bzr revid: benoit.guillot@akretion.com.br-20120711090136-2k1tuzxtdtx0drlk --- addons/mrp/report/price.py | 2 +- addons/product/report/product_pricelist.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index 9b3b724306f..98fa605380e 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -138,7 +138,7 @@ class report_custom(report_rml): """ % (_('Components'), _('Components suppliers'), _('Quantity'),_('Cost Price per Unit of Measure'), _('Supplier Price per Unit of Measure')) - purchase_price_digits = rml_obj.get_digits(dp='Purchase Price') + purchase_price_digits = rml_obj.get_digits(dp='Price Unit') for product in product_pool.browse(cr, uid, ids, context=context): product_uom_name = to_xml(product.uom_id.name) diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index 7e9748c2523..42f41fe8ff8 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -112,7 +112,7 @@ class product_pricelist(report_sxw.rml_parse): return res def _get_price(self,pricelist_id, product_id,qty): - sale_price_digits = self.get_digits(dp='Sale Price') + sale_price_digits = self.get_digits(dp='Price Unit') pool = pooler.get_pool(self.cr.dbname) price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, context=self.localcontext) if price_dict[pricelist_id]: From 58b4fdb0965935af496a1899a5552ed719362d9b Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 12:08:02 +0200 Subject: [PATCH 14/17] [FIX] fix forgetting of import decimal_precision, reported by the runbot ! bzr revid: benoit.guillot@akretion.com.br-20120711100802-mo5qlxwzrf3v8mnb --- addons/delivery/delivery.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 1b0b55ff175..48fab9cd5a6 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -22,6 +22,7 @@ import time from osv import fields,osv from tools.translate import _ +import decimal_precision as dp class delivery_carrier(osv.osv): _name = "delivery.carrier" From dc3ae0488b93fc219d0a56cdae1545b4c7d16961 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 15:06:15 +0200 Subject: [PATCH 15/17] [IMP] replace 'Price Unit name by 'Product Price' bzr revid: benoit.guillot@akretion.com.br-20120711130615-25ascb8dfllo4r7j --- addons/account/account_invoice.py | 2 +- addons/delivery/delivery.py | 4 ++-- addons/hr_expense/hr_expense.py | 2 +- .../hr_timesheet_invoice/report/report_analytic.py | 2 +- addons/marketing_campaign/marketing_campaign.py | 4 ++-- addons/membership/membership.py | 4 ++-- addons/membership/wizard/membership_invoice.py | 2 +- addons/mrp/report/price.py | 2 +- addons/mrp_repair/mrp_repair.py | 2 +- addons/product/pricelist.py | 8 ++++---- addons/product/product.py | 14 +++++++------- addons/product/product_data.xml | 2 +- addons/product/report/product_pricelist.py | 2 +- addons/purchase/purchase.py | 2 +- addons/sale/sale.py | 4 ++-- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index be016d6700c..93e77d3c5a1 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1351,7 +1351,7 @@ class account_invoice_line(osv.osv): 'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'), 'product_id': fields.many2one('product.product', 'Product', ondelete='set null'), 'account_id': fields.many2one('account.account', 'Account', required=True, domain=[('type','<>','view'), ('type', '<>', 'closed')], help="The income or expense account related to the selected product."), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')), 'price_subtotal': fields.function(_amount_line, string='Subtotal', type="float", digits_compute= dp.get_precision('Account'), store=True), 'quantity': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 48fab9cd5a6..dd51e062b3a 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -238,8 +238,8 @@ class delivery_grid_line(osv.osv): 'max_value': fields.float('Maximum Value', required=True), 'price_type': fields.selection([('fixed','Fixed'),('variable','Variable')], 'Price Type', required=True), 'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable Factor', required=True), - 'list_price': fields.float('Sale Price', digits_compute= dp.get_precision('Price Unit'), required=True), - 'standard_price': fields.float('Cost Price', digits_compute= dp.get_precision('Price Unit'), required=True), + 'list_price': fields.float('Sale Price', digits_compute= dp.get_precision('Product Price'), required=True), + 'standard_price': fields.float('Cost Price', digits_compute= dp.get_precision('Product Price'), required=True), } _defaults = { 'type': lambda *args: 'weight', diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index dbf3c34f4c1..1d5fd244632 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -258,7 +258,7 @@ class hr_expense_line(osv.osv): 'date_value': fields.date('Date', required=True), 'expense_id': fields.many2one('hr.expense.expense', 'Expense', ondelete='cascade', select=True), 'total_amount': fields.function(_amount, string='Total', digits_compute=dp.get_precision('Account')), - 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Price Unit')), + 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Product Price')), 'unit_quantity': fields.float('Quantities', digits_compute= dp.get_precision('Product Unit of Measure')), 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]), 'uom_id': fields.many2one('product.uom', 'Unit of Measure'), diff --git a/addons/hr_timesheet_invoice/report/report_analytic.py b/addons/hr_timesheet_invoice/report/report_analytic.py index 5a6b5cd472b..469e13e71b6 100644 --- a/addons/hr_timesheet_invoice/report/report_analytic.py +++ b/addons/hr_timesheet_invoice/report/report_analytic.py @@ -72,7 +72,7 @@ class report_account_analytic_line_to_invoice(osv.osv): 'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True), 'product_uom_id':fields.many2one('product.uom', 'Unit of Measure', readonly=True), 'unit_amount': fields.float('Units', readonly=True), - 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Price Unit')), + 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Product Price')), 'amount': fields.float('Amount', readonly=True, digits_compute=dp.get_precision('Account')), 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True), diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py index ea8d5552e41..8806ead1e24 100644 --- a/addons/marketing_campaign/marketing_campaign.py +++ b/addons/marketing_campaign/marketing_campaign.py @@ -120,7 +120,7 @@ Normal - the campaign runs normally and automatically sends all emails and repor 'Status',), 'activity_ids': fields.one2many('marketing.campaign.activity', 'campaign_id', 'Activities'), - 'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting.", digits_compute=dp.get_precision('Price Unit')), + 'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting.", digits_compute=dp.get_precision('Product Price')), } _defaults = { @@ -435,7 +435,7 @@ class marketing_campaign_activity(osv.osv): 'from_ids': fields.one2many('marketing.campaign.transition', 'activity_to_id', 'Previous Activities'), - 'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section", digits_compute=dp.get_precision('Price Unit')), + 'variable_cost': fields.float('Variable Cost', help="Set a variable cost if you consider that every campaign item that has reached this point has entailed a certain cost. You can get cost statistics in the Reporting section", digits_compute=dp.get_precision('Product Price')), 'revenue': fields.float('Revenue', help="Set an expected revenue if you consider that every campaign item that has reached this point has generated a certain revenue. You can get revenue statistics in the Reporting section", digits_compute=dp.get_precision('Account')), 'signal': fields.char('Signal', size=128, help='An activity with a signal can be called programmatically. Be careful, the workitem is always created when a signal is sent'), diff --git a/addons/membership/membership.py b/addons/membership/membership.py index bf127cb3c5d..d394dee19f7 100644 --- a/addons/membership/membership.py +++ b/addons/membership/membership.py @@ -146,7 +146,7 @@ class membership_line(osv.osv): 'date_to': fields.date('To', readonly=True), 'date_cancel': fields.date('Cancel date'), 'date': fields.date('Join Date', help="Date on which member has joined the membership"), - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Price Unit'), required=True, help='Amount for the membership'), + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Product Price'), required=True, help='Amount for the membership'), 'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True), 'account_invoice_id': fields.related('account_invoice_line', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice', readonly=True), 'state': fields.function(_state, @@ -447,7 +447,7 @@ Partner() class product_template(osv.osv): _inherit = 'product.template' _columns = { - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Price Unit')), + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Product Price')), } product_template() diff --git a/addons/membership/wizard/membership_invoice.py b/addons/membership/wizard/membership_invoice.py index 80bfdfd50e2..4ef16b99d82 100644 --- a/addons/membership/wizard/membership_invoice.py +++ b/addons/membership/wizard/membership_invoice.py @@ -29,7 +29,7 @@ class membership_invoice(osv.osv_memory): _description = "Membership Invoice" _columns = { 'product_id': fields.many2one('product.product','Membership', required=True), - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Price Unit'), required=True), + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Product Price'), required=True), } def onchange_product(self, cr, uid, ids, product_id=False): """This function returns value of product's member price based on product id. diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index 98fa605380e..527505d8ea5 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -138,7 +138,7 @@ class report_custom(report_rml): """ % (_('Components'), _('Components suppliers'), _('Quantity'),_('Cost Price per Unit of Measure'), _('Supplier Price per Unit of Measure')) - purchase_price_digits = rml_obj.get_digits(dp='Price Unit') + purchase_price_digits = rml_obj.get_digits(dp='Product Price') for product in product_pool.browse(cr, uid, ids, context=context): product_uom_name = to_xml(product.uom_id.name) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 62336aa4d4c..9d7861630d6 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -640,7 +640,7 @@ class mrp_repair_line(osv.osv, ProductChangeMixin): 'to_invoice': fields.boolean('To Invoice'), 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], required=True), 'invoiced': fields.boolean('Invoiced',readonly=True), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')), 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), 'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'), 'product_uom_qty': fields.float('Quantity (Unit of Measure)', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 2e86192bc7a..46d765eeeb2 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -408,18 +408,18 @@ class product_pricelist_item(osv.osv): 'base_pricelist_id': fields.many2one('product.pricelist', 'If Other Pricelist'), 'price_surcharge': fields.float('Price Surcharge', - digits_compute= dp.get_precision('Price Unit')), + digits_compute= dp.get_precision('Product Price')), 'price_discount': fields.float('Price Discount', digits=(16,4)), 'price_round': fields.float('Price Rounding', - digits_compute= dp.get_precision('Price Unit'), + digits_compute= dp.get_precision('Product Price'), help="Sets the price so that it is a multiple of this value.\n" \ "Rounding is applied after the discount and before the surcharge.\n" \ "To have prices that end in 9.99, set rounding 10, surcharge -0.01" \ ), 'price_min_margin': fields.float('Min. Price Margin', - digits_compute= dp.get_precision('Price Unit')), + digits_compute= dp.get_precision('Product Price')), 'price_max_margin': fields.float('Max. Price Margin', - digits_compute= dp.get_precision('Price Unit')), + digits_compute= dp.get_precision('Product Price')), 'company_id': fields.related('price_version_id','company_id',type='many2one', readonly=True, relation='res.company', string='Company', store=True) } diff --git a/addons/product/product.py b/addons/product/product.py index 4506387cd1c..fe00d346116 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -297,8 +297,8 @@ class product_template(osv.osv): 'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procurement Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."), 'rental': fields.boolean('Can be Rent'), 'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"), - 'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Price Unit'), help="Base price for computing the customer price. Sometimes called the catalog price."), - 'standard_price': fields.float('Cost Price', required=True, digits_compute=dp.get_precision('Price Unit'), help="Product's cost for accounting stock valuation. It is the base price for the supplier price.", groups="base.group_user"), + 'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), help="Base price for computing the customer price. Sometimes called the catalog price."), + 'standard_price': fields.float('Cost Price', required=True, digits_compute=dp.get_precision('Product Price'), help="Product's cost for accounting stock valuation. It is the base price for the supplier price.", groups="base.group_user"), '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."), @@ -510,8 +510,8 @@ class product_product(osv.osv): 'virtual_available': fields.function(_product_virtual_available, type='float', string='Quantity Available'), 'incoming_qty': fields.function(_product_incoming_qty, type='float', string='Incoming'), 'outgoing_qty': fields.function(_product_outgoing_qty, type='float', string='Outgoing'), - 'price': fields.function(_product_price, type='float', string='Pricelist', digits_compute=dp.get_precision('Price Unit')), - 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Price Unit')), + 'price': fields.function(_product_price, type='float', string='Pricelist', digits_compute=dp.get_precision('Product Price')), + 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Product Price')), 'code': fields.function(_product_code, type='char', string='Reference'), 'partner_ref' : fields.function(_product_partner_ref, type='char', string='Customer ref'), 'default_code' : fields.char('Reference', size=64, select=True), @@ -520,8 +520,8 @@ class product_product(osv.osv): 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade"), 'ean13': fields.char('EAN13', size=13, help="The numbers encoded in EAN-13 bar codes are product identification numbers."), 'packaging' : fields.one2many('product.packaging', 'product_id', 'Logistical Units', help="Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."), - 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Price Unit')), - 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Price Unit')), + 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Product Price')), + 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Product Price')), 'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'), 'name_template': fields.related('product_tmpl_id', 'name', string="Name", type='char', size=128, store=True, select=True), 'color': fields.integer('Color Index'), @@ -845,7 +845,7 @@ class pricelist_partnerinfo(osv.osv): 'name': fields.char('Description', size=64), 'suppinfo_id': fields.many2one('product.supplierinfo', 'Partner Information', required=True, ondelete='cascade'), 'min_quantity': fields.float('Quantity', required=True, help="The minimal quantity to trigger this rule, expressed in the supplier Unit of Measure if any or in the default Unit of Measure of the product otherrwise."), - 'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Price Unit'), help="This price will be considered as a price for the supplier Unit of Measure if any or the default Unit of Measure of the product otherwise"), + 'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Product Price'), help="This price will be considered as a price for the supplier Unit of Measure if any or the default Unit of Measure of the product otherwise"), } _order = 'min_quantity asc' pricelist_partnerinfo() diff --git a/addons/product/product_data.xml b/addons/product/product_data.xml index 27ef14923ee..b9e084305fc 100644 --- a/addons/product/product_data.xml +++ b/addons/product/product_data.xml @@ -145,7 +145,7 @@ parameter) will see those record just disappear. - Price Unit + Product Price 2 diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index 42f41fe8ff8..c19c12c06d7 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -112,7 +112,7 @@ class product_pricelist(report_sxw.rml_parse): return res def _get_price(self,pricelist_id, product_id,qty): - sale_price_digits = self.get_digits(dp='Price Unit') + sale_price_digits = self.get_digits(dp='Product Price') pool = pooler.get_pool(self.cr.dbname) price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, context=self.localcontext) if price_dict[pricelist_id]: diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 461682016fb..8004cd57f37 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -804,7 +804,7 @@ class purchase_order_line(osv.osv): 'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True), 'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'), 'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'), - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')), 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')), 'notes': fields.text('Notes'), 'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'), diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 11af165880f..ec88a379af6 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1113,7 +1113,7 @@ 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('Price Unit'), readonly=True, states={'draft': [('readonly', False)]}), + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price'), 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)]}, @@ -1205,7 +1205,7 @@ class sale_order_line(osv.osv): pu = 0.0 if uosqty: pu = round(line.price_unit * line.product_uom_qty / uosqty, - self.pool.get('decimal.precision').precision_get(cr, uid, 'Price Unit')) + self.pool.get('decimal.precision').precision_get(cr, uid, 'Product Price')) fpos = line.order_id.fiscal_position or False account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, account_id) if not account_id: From ae2c24909c707a07a95fc4293889fd14407504a2 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 15:45:08 +0200 Subject: [PATCH 16/17] [IMP] modif decimal on report for purchase and sale order bzr revid: benoit.guillot@akretion.com.br-20120711134508-ldft5u32b98opxet --- addons/purchase/report/order.rml | 10 +++++----- addons/sale/report/sale_order.rml | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 6c3250c59c6..6ceb2d73387 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -274,10 +274,10 @@ [[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] - [[ formatLang(line.price_unit, digits=get_digits(dp='Purchase Price') ) ]] + [[ formatLang(line.price_unit, digits=get_digits(dp='Product Price') ) ]] - [[ formatLang(line.price_subtotal, digits=get_digits(dp='Purchase Price'), currency_obj=o.pricelist_id.currency_id ) ]] + [[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]] @@ -323,7 +323,7 @@ Net Total : - [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Purchase Price'), currency_obj=o.pricelist_id.currency_id ) ]] + [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]] @@ -336,7 +336,7 @@ Taxes : - [[ formatLang(o.amount_tax, dp='Purchase Price', currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] @@ -349,7 +349,7 @@ Total : - [[ formatLang(o.amount_total, digits=get_digits(dp='Purchase Price') , currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_total, digits=get_digits(dp='Account') , currency_obj=o.pricelist_id.currency_id) ]] diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml index 31f823888d6..6030820b6f7 100644 --- a/addons/sale/report/sale_order.rml +++ b/addons/sale/report/sale_order.rml @@ -266,13 +266,13 @@ [[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]] - [[ formatLang(line.price_unit ) ]] + [[ formatLang(line.price_unit ), digits=get_digits(dp='Product Price')]] - [[ formatLang(line.discount) ]] + [[ formatLang(line.discount), digits=get_digits(dp='Discount')]] - [[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'), currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]] @@ -318,7 +318,7 @@ Net Total : - [[ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] @@ -331,7 +331,7 @@ Taxes : - [[ formatLang(o.amount_tax, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] @@ -344,7 +344,7 @@ Total : - [[ formatLang(o.amount_total, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]] From b18ed241e1801af516ee94b0a64423a8b1d57b80 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Wed, 11 Jul 2012 15:57:03 +0200 Subject: [PATCH 17/17] [FIX] fix report bzr revid: benoit.guillot@akretion.com.br-20120711135703-kuhxzsshe141owyl --- addons/sale/report/sale_order.rml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml index 6030820b6f7..ca770c15df3 100644 --- a/addons/sale/report/sale_order.rml +++ b/addons/sale/report/sale_order.rml @@ -266,10 +266,10 @@ [[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]] - [[ formatLang(line.price_unit ), digits=get_digits(dp='Product Price')]] + [[ formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]] - [[ formatLang(line.discount), digits=get_digits(dp='Discount')]] + [[ formatLang(line.discount, digits=get_digits(dp='Discount'))]] [[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]]