Merge lp:~openerp-dev/openobject-addons/6.1-opw-583207-ksa into lp:openobject-addons/6.1

Proposed by Kirti Savalia(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-583207-ksa
Merge into: lp:openobject-addons/6.1
Diff against target: 47 lines (+7/-6)
1 file modified
stock/stock.py (+7/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-583207-ksa
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+141597@code.launchpad.net

Description of the change

Hello,

Fix the issue for Accounting enteries for the stock remains with decimal not rounded with company currency.

Steps to reproduce:
- Decimal precision in account, stock, sales and purchase = 2
- Currencies : rounding factor for company currency = 1 and Mathematic precision = 4
- Product : computer in real time and average price
- Purchase of stock with two decimal for the quantity and the unit price. The global amount is rounded to zero.
- Reception of the stock : pick-in
- check account enteries for the stock journal(not rounded)

Thanks
KSA

To post a comment you must log in.

Unmerged revisions

7120. By Kirti Savalia(OpenERP)

[FIX]:Accounting enteries for the stock remains with decimal not rounded with company currency

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-10-05 07:47:57 +0000
3+++ stock/stock.py 2013-01-02 11:14:33 +0000
4@@ -2267,6 +2267,7 @@
5 processing of the given stock move.
6 """
7 # prepare default values considering that the destination accounts have the reference_currency_id as their main currency
8+ amount = self.pool.get('res.currency').round(cr, uid, move.company_id.currency_id, reference_amount) or reference_amount
9 partner_id = (move.picking_id.address_id and move.picking_id.address_id.partner_id and move.picking_id.address_id.partner_id.id) or False
10 debit_line_vals = {
11 'name': move.name,
12@@ -2275,7 +2276,7 @@
13 'ref': move.picking_id and move.picking_id.name or False,
14 'date': time.strftime('%Y-%m-%d'),
15 'partner_id': partner_id,
16- 'debit': reference_amount,
17+ 'debit': amount,
18 'account_id': dest_account_id,
19 }
20 credit_line_vals = {
21@@ -2285,7 +2286,7 @@
22 'ref': move.picking_id and move.picking_id.name or False,
23 'date': time.strftime('%Y-%m-%d'),
24 'partner_id': partner_id,
25- 'credit': reference_amount,
26+ 'credit': amount,
27 'account_id': src_account_id,
28 }
29
30@@ -2300,14 +2301,14 @@
31 cur_obj = self.pool.get('res.currency')
32 if reference_currency_id != src_main_currency_id:
33 # fix credit line:
34- credit_line_vals['credit'] = cur_obj.compute(cr, uid, reference_currency_id, src_main_currency_id, reference_amount, context=context)
35+ credit_line_vals['credit'] = cur_obj.compute(cr, uid, reference_currency_id, src_main_currency_id, amount, context=context)
36 if (not src_acct.currency_id) or src_acct.currency_id.id == reference_currency_id:
37- credit_line_vals.update(currency_id=reference_currency_id, amount_currency=reference_amount)
38+ credit_line_vals.update(currency_id=reference_currency_id, amount_currency=amount)
39 if reference_currency_id != dest_main_currency_id:
40 # fix debit line:
41- debit_line_vals['debit'] = cur_obj.compute(cr, uid, reference_currency_id, dest_main_currency_id, reference_amount, context=context)
42+ debit_line_vals['debit'] = cur_obj.compute(cr, uid, reference_currency_id, dest_main_currency_id, amount, context=context)
43 if (not dest_acct.currency_id) or dest_acct.currency_id.id == reference_currency_id:
44- debit_line_vals.update(currency_id=reference_currency_id, amount_currency=reference_amount)
45+ debit_line_vals.update(currency_id=reference_currency_id, amount_currency=amount)
46
47 return [(0, 0, debit_line_vals), (0, 0, credit_line_vals)]
48