Merge lp:~akretion-team/openobject-addons/trunk-ref-precision into lp:openobject-addons
- trunk-ref-precision
- Merge into trunk
Proposed by
Benoit Guillot - http://www.akretion.com
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7252 | ||||
Proposed branch: | lp:~akretion-team/openobject-addons/trunk-ref-precision | ||||
Merge into: | lp:openobject-addons | ||||
Diff against target: |
594 lines (+69/-96) 23 files modified
account/account_invoice.py (+3/-3) delivery/delivery.py (+3/-2) hr_expense/hr_expense.py (+3/-3) hr_timesheet_invoice/report/report_analytic.py (+1/-1) marketing_campaign/marketing_campaign.py (+3/-3) marketing_campaign/report/campaign_analysis.py (+2/-2) membership/membership.py (+2/-2) membership/wizard/membership_invoice.py (+1/-1) mrp/report/price.py (+1/-1) mrp_repair/mrp_repair.py (+5/-5) product/pricelist.py (+4/-4) product/product.py (+7/-7) product/product_data.xml (+4/-4) product/report/product_pricelist.py (+1/-1) purchase/purchase.py (+5/-5) purchase/report/order.rml (+5/-5) purchase/res_config.py (+0/-9) purchase/res_config_view.xml (+1/-1) sale/report/sale_order.rml (+10/-10) sale/res_config.py (+0/-18) sale/res_config_view.xml (+0/-1) sale/sale.py (+7/-7) sale/wizard/sale_make_invoice_advance.py (+1/-1) |
||||
To merge this branch: | bzr merge lp:~akretion-team/openobject-addons/trunk-ref-precision | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
qdp (OpenERP) | Pending | ||
OpenERP Core Team | Pending | ||
Review via email: mp+114413@code.launchpad.net |
Commit message
Description of the change
This merge proposal removes the two precisions : 'Sale Price' and 'Purchase Price'. It adds the precisions 'Product Price' and 'Discount'. It replaces the sale and purchase precisions by account precision, exept on the product price. It add the decimal precision on the quantity in some fields.
To post a comment you must log in.
Revision history for this message
qdp (OpenERP) (qdp) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account/account_invoice.py' |
2 | --- account/account_invoice.py 2012-07-10 21:21:15 +0000 |
3 | +++ account/account_invoice.py 2012-07-11 13:59:24 +0000 |
4 | @@ -1351,11 +1351,11 @@ |
5 | 'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'), |
6 | 'product_id': fields.many2one('product.product', 'Product', ondelete='set null'), |
7 | '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."), |
8 | - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Account')), |
9 | + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')), |
10 | 'price_subtotal': fields.function(_amount_line, string='Subtotal', type="float", |
11 | digits_compute= dp.get_precision('Account'), store=True), |
12 | - 'quantity': fields.float('Quantity', required=True), |
13 | - 'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Account')), |
14 | + 'quantity': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), |
15 | + 'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Discount')), |
16 | 'invoice_line_tax_id': fields.many2many('account.tax', 'account_invoice_line_tax', 'invoice_line_id', 'tax_id', 'Taxes', domain=[('parent_id','=',False)]), |
17 | 'note': fields.text('Notes'), |
18 | 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'), |
19 | |
20 | === modified file 'delivery/delivery.py' |
21 | --- delivery/delivery.py 2012-04-03 08:27:56 +0000 |
22 | +++ delivery/delivery.py 2012-07-11 13:59:24 +0000 |
23 | @@ -22,6 +22,7 @@ |
24 | import time |
25 | from osv import fields,osv |
26 | from tools.translate import _ |
27 | +import decimal_precision as dp |
28 | |
29 | class delivery_carrier(osv.osv): |
30 | _name = "delivery.carrier" |
31 | @@ -237,8 +238,8 @@ |
32 | 'max_value': fields.float('Maximum Value', required=True), |
33 | 'price_type': fields.selection([('fixed','Fixed'),('variable','Variable')], 'Price Type', required=True), |
34 | 'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable Factor', required=True), |
35 | - 'list_price': fields.float('Sale Price', required=True), |
36 | - 'standard_price': fields.float('Cost Price', required=True), |
37 | + 'list_price': fields.float('Sale Price', digits_compute= dp.get_precision('Product Price'), required=True), |
38 | + 'standard_price': fields.float('Cost Price', digits_compute= dp.get_precision('Product Price'), required=True), |
39 | } |
40 | _defaults = { |
41 | 'type': lambda *args: 'weight', |
42 | |
43 | === modified file 'hr_expense/hr_expense.py' |
44 | --- hr_expense/hr_expense.py 2012-07-05 09:29:21 +0000 |
45 | +++ hr_expense/hr_expense.py 2012-07-11 13:59:24 +0000 |
46 | @@ -72,7 +72,7 @@ |
47 | 'account_move_id': fields.many2one('account.move', 'Ledger Posting'), |
48 | 'line_ids': fields.one2many('hr.expense.line', 'expense_id', 'Expense Lines', readonly=True, states={'draft':[('readonly',False)]} ), |
49 | 'note': fields.text('Note'), |
50 | - 'amount': fields.function(_amount, string='Total Amount'), |
51 | + 'amount': fields.function(_amount, string='Total Amount', digits_compute= dp.get_precision('Account')), |
52 | 'invoice_id': fields.many2one('account.invoice', "Employee's Invoice"), |
53 | 'currency_id': fields.many2one('res.currency', 'Currency', required=True), |
54 | 'department_id':fields.many2one('hr.department','Department'), |
55 | @@ -258,8 +258,8 @@ |
56 | 'date_value': fields.date('Date', required=True), |
57 | 'expense_id': fields.many2one('hr.expense.expense', 'Expense', ondelete='cascade', select=True), |
58 | 'total_amount': fields.function(_amount, string='Total', digits_compute=dp.get_precision('Account')), |
59 | - 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Account')), |
60 | - 'unit_quantity': fields.float('Quantities' ), |
61 | + 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Product Price')), |
62 | + 'unit_quantity': fields.float('Quantities', digits_compute= dp.get_precision('Product Unit of Measure')), |
63 | 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]), |
64 | 'uom_id': fields.many2one('product.uom', 'Unit of Measure'), |
65 | 'description': fields.text('Description'), |
66 | |
67 | === modified file 'hr_timesheet_invoice/report/report_analytic.py' |
68 | --- hr_timesheet_invoice/report/report_analytic.py 2012-05-22 16:10:55 +0000 |
69 | +++ hr_timesheet_invoice/report/report_analytic.py 2012-07-11 13:59:24 +0000 |
70 | @@ -72,7 +72,7 @@ |
71 | 'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True), |
72 | 'product_uom_id':fields.many2one('product.uom', 'Unit of Measure', readonly=True), |
73 | 'unit_amount': fields.float('Units', readonly=True), |
74 | - 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Sale Price')), |
75 | + 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Product Price')), |
76 | 'amount': fields.float('Amount', readonly=True, digits_compute=dp.get_precision('Account')), |
77 | 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), |
78 | ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True), |
79 | |
80 | === modified file 'marketing_campaign/marketing_campaign.py' |
81 | --- marketing_campaign/marketing_campaign.py 2012-06-29 11:00:19 +0000 |
82 | +++ marketing_campaign/marketing_campaign.py 2012-07-11 13:59:24 +0000 |
83 | @@ -120,7 +120,7 @@ |
84 | 'Status',), |
85 | 'activity_ids': fields.one2many('marketing.campaign.activity', |
86 | 'campaign_id', 'Activities'), |
87 | - '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')), |
88 | + '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')), |
89 | } |
90 | |
91 | _defaults = { |
92 | @@ -435,8 +435,8 @@ |
93 | 'from_ids': fields.one2many('marketing.campaign.transition', |
94 | 'activity_to_id', |
95 | 'Previous Activities'), |
96 | - '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')), |
97 | - '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')), |
98 | + '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')), |
99 | + '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')), |
100 | 'signal': fields.char('Signal', size=128, |
101 | help='An activity with a signal can be called programmatically. Be careful, the workitem is always created when a signal is sent'), |
102 | 'keep_if_condition_not_met': fields.boolean("Don't Delete Workitems", |
103 | |
104 | === modified file 'marketing_campaign/report/campaign_analysis.py' |
105 | --- marketing_campaign/report/campaign_analysis.py 2012-05-04 11:57:48 +0000 |
106 | +++ marketing_campaign/report/campaign_analysis.py 2012-07-11 13:59:24 +0000 |
107 | @@ -63,8 +63,8 @@ |
108 | 'country_id': fields.related('partner_id', 'country_id', |
109 | type='many2one', relation='res.country',string='Country'), |
110 | 'total_cost' : fields.function(_total_cost, string='Cost', |
111 | - type="float", digits_compute=dp.get_precision('Purchase Price')), |
112 | - 'revenue': fields.float('Revenue', readonly=True, digits_compute=dp.get_precision('Sale Price')), |
113 | + type="float", digits_compute=dp.get_precision('Account')), |
114 | + 'revenue': fields.float('Revenue', readonly=True, digits_compute=dp.get_precision('Account')), |
115 | 'count' : fields.integer('# of Actions', readonly=True), |
116 | 'state': fields.selection([('todo', 'To Do'), |
117 | ('exception', 'Exception'), ('done', 'Done'), |
118 | |
119 | === modified file 'membership/membership.py' |
120 | --- membership/membership.py 2012-06-29 13:48:22 +0000 |
121 | +++ membership/membership.py 2012-07-11 13:59:24 +0000 |
122 | @@ -146,7 +146,7 @@ |
123 | 'date_to': fields.date('To', readonly=True), |
124 | 'date_cancel': fields.date('Cancel date'), |
125 | 'date': fields.date('Join Date', help="Date on which member has joined the membership"), |
126 | - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price'), required=True, help='Amount for the membership'), |
127 | + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Product Price'), required=True, help='Amount for the membership'), |
128 | 'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True), |
129 | 'account_invoice_id': fields.related('account_invoice_line', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice', readonly=True), |
130 | 'state': fields.function(_state, |
131 | @@ -447,7 +447,7 @@ |
132 | class product_template(osv.osv): |
133 | _inherit = 'product.template' |
134 | _columns = { |
135 | - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price')), |
136 | + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Product Price')), |
137 | } |
138 | |
139 | product_template() |
140 | |
141 | === modified file 'membership/wizard/membership_invoice.py' |
142 | --- membership/wizard/membership_invoice.py 2011-11-09 11:31:31 +0000 |
143 | +++ membership/wizard/membership_invoice.py 2012-07-11 13:59:24 +0000 |
144 | @@ -29,7 +29,7 @@ |
145 | _description = "Membership Invoice" |
146 | _columns = { |
147 | 'product_id': fields.many2one('product.product','Membership', required=True), |
148 | - 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price'), required=True), |
149 | + 'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Product Price'), required=True), |
150 | } |
151 | def onchange_product(self, cr, uid, ids, product_id=False): |
152 | """This function returns value of product's member price based on product id. |
153 | |
154 | === modified file 'mrp/report/price.py' |
155 | --- mrp/report/price.py 2012-04-25 08:54:15 +0000 |
156 | +++ mrp/report/price.py 2012-07-11 13:59:24 +0000 |
157 | @@ -138,7 +138,7 @@ |
158 | </row> |
159 | """ % (_('Components'), _('Components suppliers'), _('Quantity'),_('Cost Price per Unit of Measure'), _('Supplier Price per Unit of Measure')) |
160 | |
161 | - purchase_price_digits = rml_obj.get_digits(dp='Purchase Price') |
162 | + purchase_price_digits = rml_obj.get_digits(dp='Product Price') |
163 | |
164 | for product in product_pool.browse(cr, uid, ids, context=context): |
165 | product_uom_name = to_xml(product.uom_id.name) |
166 | |
167 | === modified file 'mrp_repair/mrp_repair.py' |
168 | --- mrp_repair/mrp_repair.py 2012-06-07 14:59:10 +0000 |
169 | +++ mrp_repair/mrp_repair.py 2012-07-11 13:59:24 +0000 |
170 | @@ -640,10 +640,10 @@ |
171 | 'to_invoice': fields.boolean('To Invoice'), |
172 | 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], required=True), |
173 | 'invoiced': fields.boolean('Invoiced',readonly=True), |
174 | - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price')), |
175 | - 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Sale Price')), |
176 | + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')), |
177 | + 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), |
178 | 'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'), |
179 | - 'product_uom_qty': fields.float('Quantity (Unit of Measure)', digits=(16,2), required=True), |
180 | + 'product_uom_qty': fields.float('Quantity (Unit of Measure)', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), |
181 | 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), |
182 | 'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number',domain="[('product_id','=',product_id)]"), |
183 | 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), |
184 | @@ -732,10 +732,10 @@ |
185 | 'repair_id': fields.many2one('mrp.repair', 'Repair Order Reference', required=True, ondelete='cascade', select=True), |
186 | 'name': fields.char('Description', size=64, select=True,required=True), |
187 | 'product_id': fields.many2one('product.product', 'Product'), |
188 | - 'product_uom_qty': fields.float('Quantity', digits=(16,2), required=True), |
189 | + 'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True), |
190 | 'price_unit': fields.float('Unit Price', required=True), |
191 | 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), |
192 | - 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Sale Price')), |
193 | + 'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')), |
194 | 'tax_id': fields.many2many('account.tax', 'repair_fee_line_tax', 'repair_fee_line_id', 'tax_id', 'Taxes'), |
195 | 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True), |
196 | 'to_invoice': fields.boolean('To Invoice'), |
197 | |
198 | === modified file 'product/pricelist.py' |
199 | --- product/pricelist.py 2012-07-09 16:21:24 +0000 |
200 | +++ product/pricelist.py 2012-07-11 13:59:24 +0000 |
201 | @@ -407,18 +407,18 @@ |
202 | 'base_pricelist_id': fields.many2one('product.pricelist', 'If Other Pricelist'), |
203 | |
204 | 'price_surcharge': fields.float('Price Surcharge', |
205 | - digits_compute= dp.get_precision('Sale Price')), |
206 | + digits_compute= dp.get_precision('Product Price')), |
207 | 'price_discount': fields.float('Price Discount', digits=(16,4)), |
208 | 'price_round': fields.float('Price Rounding', |
209 | - digits_compute= dp.get_precision('Sale Price'), |
210 | + digits_compute= dp.get_precision('Product Price'), |
211 | help="Sets the price so that it is a multiple of this value.\n" \ |
212 | "Rounding is applied after the discount and before the surcharge.\n" \ |
213 | "To have prices that end in 9.99, set rounding 10, surcharge -0.01" \ |
214 | ), |
215 | 'price_min_margin': fields.float('Min. Price Margin', |
216 | - digits_compute= dp.get_precision('Sale Price')), |
217 | + digits_compute= dp.get_precision('Product Price')), |
218 | 'price_max_margin': fields.float('Max. Price Margin', |
219 | - digits_compute= dp.get_precision('Sale Price')), |
220 | + digits_compute= dp.get_precision('Product Price')), |
221 | 'company_id': fields.related('price_version_id','company_id',type='many2one', |
222 | readonly=True, relation='res.company', string='Company', store=True) |
223 | } |
224 | |
225 | === modified file 'product/product.py' |
226 | --- product/product.py 2012-07-09 13:40:24 +0000 |
227 | +++ product/product.py 2012-07-11 13:59:24 +0000 |
228 | @@ -297,8 +297,8 @@ |
229 | '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."), |
230 | 'rental': fields.boolean('Can be Rent'), |
231 | 'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"), |
232 | - '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."), |
233 | - '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"), |
234 | + '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."), |
235 | + '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"), |
236 | 'volume': fields.float('Volume', help="The volume in m3."), |
237 | 'weight': fields.float('Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The gross weight in Kg."), |
238 | 'weight_net': fields.float('Net Weight', digits_compute=dp.get_precision('Stock Weight'), help="The net weight in Kg."), |
239 | @@ -510,8 +510,8 @@ |
240 | 'virtual_available': fields.function(_product_virtual_available, type='float', string='Quantity Available'), |
241 | 'incoming_qty': fields.function(_product_incoming_qty, type='float', string='Incoming'), |
242 | 'outgoing_qty': fields.function(_product_outgoing_qty, type='float', string='Outgoing'), |
243 | - 'price': fields.function(_product_price, type='float', string='Pricelist', digits_compute=dp.get_precision('Sale Price')), |
244 | - 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Sale Price')), |
245 | + 'price': fields.function(_product_price, type='float', string='Pricelist', digits_compute=dp.get_precision('Product Price')), |
246 | + 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Product Price')), |
247 | 'code': fields.function(_product_code, type='char', string='Reference'), |
248 | 'partner_ref' : fields.function(_product_partner_ref, type='char', string='Customer ref'), |
249 | 'default_code' : fields.char('Reference', size=64, select=True), |
250 | @@ -520,8 +520,8 @@ |
251 | 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade"), |
252 | 'ean13': fields.char('EAN13', size=13, help="The numbers encoded in EAN-13 bar codes are product identification numbers."), |
253 | '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."), |
254 | - 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Sale Price')), |
255 | - 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Sale Price')), |
256 | + 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Product Price')), |
257 | + 'price_margin': fields.float('Variant Price Margin', digits_compute=dp.get_precision('Product Price')), |
258 | 'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'), |
259 | 'name_template': fields.related('product_tmpl_id', 'name', string="Name", type='char', size=128, store=True, select=True), |
260 | 'color': fields.integer('Color Index'), |
261 | @@ -845,7 +845,7 @@ |
262 | 'name': fields.char('Description', size=64), |
263 | 'suppinfo_id': fields.many2one('product.supplierinfo', 'Partner Information', required=True, ondelete='cascade'), |
264 | '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."), |
265 | - '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"), |
266 | + '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"), |
267 | } |
268 | _order = 'min_quantity asc' |
269 | pricelist_partnerinfo() |
270 | |
271 | === modified file 'product/product_data.xml' |
272 | --- product/product_data.xml 2012-06-28 06:40:05 +0000 |
273 | +++ product/product_data.xml 2012-07-11 13:59:24 +0000 |
274 | @@ -144,12 +144,12 @@ |
275 | <field eval="'product.pricelist,'+str(ref('list0'))" name="value"/> |
276 | </record> |
277 | |
278 | - <record forcecreate="True" id="decimal_sale" model="decimal.precision"> |
279 | - <field name="name">Sale Price</field> |
280 | + <record forcecreate="True" id="decimal_price" model="decimal.precision"> |
281 | + <field name="name">Product Price</field> |
282 | <field name="digits">2</field> |
283 | </record> |
284 | - <record forcecreate="True" id="decimal_purchase" model="decimal.precision"> |
285 | - <field name="name">Purchase Price</field> |
286 | + <record forcecreate="True" id="decimal_discount" model="decimal.precision"> |
287 | + <field name="name">Discount</field> |
288 | <field name="digits">2</field> |
289 | </record> |
290 | <record forcecreate="True" id="decimal_account" model="decimal.precision"> |
291 | |
292 | === modified file 'product/report/product_pricelist.py' |
293 | --- product/report/product_pricelist.py 2011-01-17 08:00:48 +0000 |
294 | +++ product/report/product_pricelist.py 2012-07-11 13:59:24 +0000 |
295 | @@ -112,7 +112,7 @@ |
296 | return res |
297 | |
298 | def _get_price(self,pricelist_id, product_id,qty): |
299 | - sale_price_digits = self.get_digits(dp='Sale Price') |
300 | + sale_price_digits = self.get_digits(dp='Product Price') |
301 | pool = pooler.get_pool(self.cr.dbname) |
302 | price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, context=self.localcontext) |
303 | if price_dict[pricelist_id]: |
304 | |
305 | === modified file 'purchase/purchase.py' |
306 | --- purchase/purchase.py 2012-07-02 16:13:23 +0000 |
307 | +++ purchase/purchase.py 2012-07-11 13:59:24 +0000 |
308 | @@ -190,15 +190,15 @@ |
309 | 'purchase.order.line': (_get_order, ['date_planned'], 10), |
310 | } |
311 | ), |
312 | - 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Untaxed Amount', |
313 | + 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount', |
314 | store={ |
315 | 'purchase.order.line': (_get_order, None, 10), |
316 | }, multi="sums", help="The amount without tax"), |
317 | - 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Taxes', |
318 | + 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Taxes', |
319 | store={ |
320 | 'purchase.order.line': (_get_order, None, 10), |
321 | }, multi="sums", help="The tax amount"), |
322 | - 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Total', |
323 | + 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total', |
324 | store={ |
325 | 'purchase.order.line': (_get_order, None, 10), |
326 | }, multi="sums",help="The total amount"), |
327 | @@ -804,8 +804,8 @@ |
328 | 'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True), |
329 | 'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'), |
330 | 'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'), |
331 | - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Purchase Price')), |
332 | - 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Purchase Price')), |
333 | + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')), |
334 | + 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')), |
335 | 'notes': fields.text('Notes'), |
336 | 'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'), |
337 | 'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',), |
338 | |
339 | === modified file 'purchase/report/order.rml' |
340 | --- purchase/report/order.rml 2012-03-30 09:08:37 +0000 |
341 | +++ purchase/report/order.rml 2012-07-11 13:59:24 +0000 |
342 | @@ -274,10 +274,10 @@ |
343 | <para style="terp_default_Right_9">[[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] </para> |
344 | </td> |
345 | <td> |
346 | - <para style="terp_default_Right_9">[[ formatLang(line.price_unit, digits=get_digits(dp='Purchase Price') ) ]]</para> |
347 | + <para style="terp_default_Right_9">[[ formatLang(line.price_unit, digits=get_digits(dp='Product Price') ) ]]</para> |
348 | </td> |
349 | <td> |
350 | - <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Purchase Price'), currency_obj=o.pricelist_id.currency_id ) ]]</para> |
351 | + <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]]</para> |
352 | </td> |
353 | </tr> |
354 | <tr> |
355 | @@ -323,7 +323,7 @@ |
356 | <para style="terp_default_9">Net Total :</para> |
357 | </td> |
358 | <td> |
359 | - <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Purchase Price'), currency_obj=o.pricelist_id.currency_id ) ]]</para> |
360 | + <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]]</para> |
361 | </td> |
362 | </tr> |
363 | <tr> |
364 | @@ -336,7 +336,7 @@ |
365 | <para style="terp_default_9">Taxes :</para> |
366 | </td> |
367 | <td> |
368 | - <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Purchase Price', currency_obj=o.pricelist_id.currency_id) ]]</para> |
369 | + <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> |
370 | </td> |
371 | </tr> |
372 | <tr> |
373 | @@ -349,7 +349,7 @@ |
374 | <para style="terp_default_Bold_9">Total :</para> |
375 | </td> |
376 | <td> |
377 | - <para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total, digits=get_digits(dp='Purchase Price') , currency_obj=o.pricelist_id.currency_id) ]]</para> |
378 | + <para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total, digits=get_digits(dp='Account') , currency_obj=o.pricelist_id.currency_id) ]]</para> |
379 | </td> |
380 | </tr> |
381 | </blockTable> |
382 | |
383 | === modified file 'purchase/report/order.sxw' |
384 | Binary files purchase/report/order.sxw 2012-03-23 06:29:20 +0000 and purchase/report/order.sxw 2012-07-11 13:59:24 +0000 differ |
385 | === modified file 'purchase/res_config.py' |
386 | --- purchase/res_config.py 2012-06-25 12:34:21 +0000 |
387 | +++ purchase/res_config.py 2012-07-11 13:59:24 +0000 |
388 | @@ -59,21 +59,12 @@ |
389 | help="""Purchase Requisitions are used when you want to request quotations from several suppliers for a given set of products. |
390 | You can configure per product if you directly do a Request for Quotation |
391 | to one supplier or if you want a purchase requisition to negotiate with several suppliers."""), |
392 | - '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."), |
393 | } |
394 | |
395 | _defaults = { |
396 | 'default_invoice_method': 'manual', |
397 | } |
398 | |
399 | - def get_default_dp(self, cr, uid, fields, context=None): |
400 | - dp = self.pool.get('ir.model.data').get_object(cr,uid, 'product','decimal_purchase') |
401 | - return {'decimal_precision': dp.digits} |
402 | - |
403 | - def set_default_dp(self, cr, uid, ids, context=None): |
404 | - config = self.browse(cr, uid, ids[0], context) |
405 | - dp = self.pool.get('ir.model.data').get_object(cr,uid, 'product','decimal_purchase') |
406 | - dp.write({'digits': config.decimal_precision}) |
407 | |
408 | |
409 | |
410 | |
411 | === modified file 'purchase/res_config_view.xml' |
412 | --- purchase/res_config_view.xml 2012-07-06 14:54:10 +0000 |
413 | +++ purchase/res_config_view.xml 2012-07-11 13:59:24 +0000 |
414 | @@ -14,7 +14,7 @@ |
415 | </header> |
416 | <group string="Invoicing"> |
417 | <field name="default_invoice_method"/> |
418 | - <field name="decimal_precision"/> |
419 | + |
420 | </group> |
421 | <group string="Purchase Order"> |
422 | <group> |
423 | |
424 | === modified file 'sale/report/sale_order.rml' |
425 | --- sale/report/sale_order.rml 2012-05-04 12:13:26 +0000 |
426 | +++ sale/report/sale_order.rml 2012-07-11 13:59:24 +0000 |
427 | @@ -266,13 +266,13 @@ |
428 | <para style="terp_default_Right_9">[[ 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 ]]</para> |
429 | </td> |
430 | <td> |
431 | - <para style="terp_default_Right_9">[[ formatLang(line.price_unit ) ]]</para> |
432 | - </td> |
433 | - <td> |
434 | - <para style="terp_default_Centre_9">[[ formatLang(line.discount) ]]</para> |
435 | - </td> |
436 | - <td> |
437 | - <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'), currency_obj=o.pricelist_id.currency_id) ]] </para> |
438 | + <para style="terp_default_Right_9">[[ formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]]</para> |
439 | + </td> |
440 | + <td> |
441 | + <para style="terp_default_Centre_9">[[ formatLang(line.discount, digits=get_digits(dp='Discount'))]]</para> |
442 | + </td> |
443 | + <td> |
444 | + <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) ]] </para> |
445 | </td> |
446 | </tr> |
447 | <tr> |
448 | @@ -318,7 +318,7 @@ |
449 | <para style="terp_default_9">Net Total :</para> |
450 | </td> |
451 | <td> |
452 | - <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para> |
453 | + <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> |
454 | </td> |
455 | </tr> |
456 | <tr> |
457 | @@ -331,7 +331,7 @@ |
458 | <para style="terp_default_9">Taxes :</para> |
459 | </td> |
460 | <td> |
461 | - <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para> |
462 | + <para style="terp_default_Right_9">[[ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> |
463 | </td> |
464 | </tr> |
465 | <tr> |
466 | @@ -344,7 +344,7 @@ |
467 | <para style="terp_default_Bold_9">Total :</para> |
468 | </td> |
469 | <td> |
470 | - <para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) ]]</para> |
471 | + <para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> |
472 | </td> |
473 | </tr> |
474 | </blockTable> |
475 | |
476 | === modified file 'sale/report/sale_order.sxw' |
477 | Binary files sale/report/sale_order.sxw 2012-03-23 06:56:03 +0000 and sale/report/sale_order.sxw 2012-07-11 13:59:24 +0000 differ |
478 | === modified file 'sale/res_config.py' |
479 | --- sale/res_config.py 2012-06-28 11:34:23 +0000 |
480 | +++ sale/res_config.py 2012-07-11 13:59:24 +0000 |
481 | @@ -95,17 +95,7 @@ |
482 | 'module_project_timesheet': fields.boolean("Project Timesheet"), |
483 | 'module_project_mrp': fields.boolean("Project MRP"), |
484 | 'module_project': fields.boolean("Project"), |
485 | - '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."), |
486 | } |
487 | - def _check_decimal(self, cr, uid, ids, context=None): |
488 | - for decimal in self.browse(cr, uid, ids, context=context): |
489 | - if decimal.decimal_precision > 20: |
490 | - return False |
491 | - return True |
492 | - |
493 | - _constraints = [ |
494 | - (_check_decimal, 'Digits must be between 0 to 20 ', ['decimal_precision']), |
495 | - ] |
496 | |
497 | def default_get(self, cr, uid, fields, context=None): |
498 | ir_model_data = self.pool.get('ir.model.data') |
499 | @@ -136,14 +126,6 @@ |
500 | 'time_unit': _get_default_time_unit, |
501 | } |
502 | |
503 | - def get_default_dp(self, cr, uid, fields, context=None): |
504 | - dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product','decimal_sale') |
505 | - return {'decimal_precision': dp.digits} |
506 | - |
507 | - def set_default_dp(self, cr, uid, ids, context=None): |
508 | - config = self.browse(cr, uid, ids[0], context) |
509 | - dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product','decimal_sale') |
510 | - dp.write({'digits': config.decimal_precision}) |
511 | |
512 | def set_sale_defaults(self, cr, uid, ids, context=None): |
513 | ir_values = self.pool.get('ir.values') |
514 | |
515 | === modified file 'sale/res_config_view.xml' |
516 | --- sale/res_config_view.xml 2012-06-28 11:34:23 +0000 |
517 | +++ sale/res_config_view.xml 2012-07-11 13:59:24 +0000 |
518 | @@ -33,7 +33,6 @@ |
519 | <field name="group_sale_pricelist"/> |
520 | <field name="group_multiple_shops"/> |
521 | <field name="module_warning"/> |
522 | - <field name="decimal_precision"/> |
523 | </group> |
524 | <group> |
525 | <field name="default_picking_policy" attrs="{'invisible':[('group_invoice_deli_orders','=',False)]}"/> |
526 | |
527 | === modified file 'sale/sale.py' |
528 | --- sale/sale.py 2012-07-11 12:38:48 +0000 |
529 | +++ sale/sale.py 2012-07-11 13:59:24 +0000 |
530 | @@ -247,19 +247,19 @@ |
531 | fnct_search=_invoiced_search, type='boolean', help="It indicates that an invoice has been paid."), |
532 | 'note': fields.text('Terms and conditions'), |
533 | |
534 | - 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Sale Price'), string='Untaxed Amount', |
535 | + 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount', |
536 | store = { |
537 | 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10), |
538 | 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), |
539 | }, |
540 | multi='sums', help="The amount without tax."), |
541 | - 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Sale Price'), string='Taxes', |
542 | + 'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Taxes', |
543 | store = { |
544 | 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10), |
545 | 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), |
546 | }, |
547 | multi='sums', help="The tax amount."), |
548 | - 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Sale Price'), string='Total', |
549 | + 'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total', |
550 | store = { |
551 | 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10), |
552 | 'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10), |
553 | @@ -1114,8 +1114,8 @@ |
554 | 'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True), |
555 | 'invoiced': fields.boolean('Invoiced', readonly=True), |
556 | 'procurement_id': fields.many2one('procurement.order', 'Procurement'), |
557 | - 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}), |
558 | - 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Sale Price')), |
559 | + 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price'), readonly=True, states={'draft': [('readonly', False)]}), |
560 | + 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')), |
561 | 'tax_id': fields.many2many('account.tax', 'sale_order_tax', 'order_line_id', 'tax_id', 'Taxes', readonly=True, states={'draft': [('readonly', False)]}), |
562 | 'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True, readonly=True, states={'draft': [('readonly', False)]}, |
563 | 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."), |
564 | @@ -1127,7 +1127,7 @@ |
565 | 'product_uos': fields.many2one('product.uom', 'Product UoS'), |
566 | 'product_packaging': fields.many2one('product.packaging', 'Packaging'), |
567 | 'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True), |
568 | - 'discount': fields.float('Discount (%)', digits=(16, 2), readonly=True, states={'draft': [('readonly', False)]}), |
569 | + 'discount': fields.float('Discount (%)', digits_compute= dp.get_precision('Discount'), readonly=True, states={'draft': [('readonly', False)]}), |
570 | 'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'), |
571 | 'notes': fields.text('Notes'), |
572 | 'th_weight': fields.float('Weight', readonly=True, states={'draft': [('readonly', False)]}), |
573 | @@ -1206,7 +1206,7 @@ |
574 | pu = 0.0 |
575 | if uosqty: |
576 | pu = round(line.price_unit * line.product_uom_qty / uosqty, |
577 | - self.pool.get('decimal.precision').precision_get(cr, uid, 'Sale Price')) |
578 | + self.pool.get('decimal.precision').precision_get(cr, uid, 'Product Price')) |
579 | fpos = line.order_id.fiscal_position or False |
580 | account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, account_id) |
581 | if not account_id: |
582 | |
583 | === modified file 'sale/wizard/sale_make_invoice_advance.py' |
584 | --- sale/wizard/sale_make_invoice_advance.py 2012-05-23 17:15:27 +0000 |
585 | +++ sale/wizard/sale_make_invoice_advance.py 2012-07-11 13:59:24 +0000 |
586 | @@ -36,7 +36,7 @@ |
587 | |
588 | _columns = { |
589 | '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."), |
590 | - 'amount': fields.float('Advance Amount', digits_compute= dp.get_precision('Sale Price'), required=True, help="The amount to be invoiced in advance."), |
591 | + 'amount': fields.float('Advance Amount', digits_compute= dp.get_precision('Account'), required=True, help="The amount to be invoiced in advance."), |
592 | 'qtty': fields.float('Quantity', digits=(16, 2), required=True), |
593 | '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."), |
594 | } |
merged in trunk in revision 7252
thanks for the contribution!
Quentin