Merge lp:~rr.clearcorp/openerp-ccorp-addons/7.0-account_exchange_rates_adjustment into lp:openerp-ccorp-addons/7.0

Proposed by Ronald Rubi
Status: Merged
Merged at revision: 900
Proposed branch: lp:~rr.clearcorp/openerp-ccorp-addons/7.0-account_exchange_rates_adjustment
Merge into: lp:openerp-ccorp-addons/7.0
Diff against target: 57 lines (+10/-5)
2 files modified
account_exchange_rates_adjustment/account_exchange_rates_adjustment.py (+3/-2)
res_currency_sequence/res_currency_sequence.py (+7/-3)
To merge this branch: bzr merge lp:~rr.clearcorp/openerp-ccorp-addons/7.0-account_exchange_rates_adjustment
Reviewer Review Type Date Requested Status
ClearCorp drivers Pending
Review via email: mp+226154@code.launchpad.net

Description of the change

[FIX] account_exchange_rates_adjustment - Add partial reconcile in adjustment. res_currency_sequence - Add date in context, method get_exchange_rate

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_exchange_rates_adjustment/account_exchange_rates_adjustment.py'
2--- account_exchange_rates_adjustment/account_exchange_rates_adjustment.py 2014-06-09 22:03:28 +0000
3+++ account_exchange_rates_adjustment/account_exchange_rates_adjustment.py 2014-07-09 15:20:16 +0000
4@@ -225,7 +225,7 @@
5
6 #Create move line
7 move_line = {
8- 'name': line.name or '',
9+ 'name': 'Adj ' + line.name or 'Adj',
10 'ref': line.ref or '',
11 'debit': debit,
12 'credit': credit,
13@@ -240,7 +240,8 @@
14 'company_id': line.company_id.id,
15 'adjustment': line.id,
16 }
17- new_move_line_id = move_line_obj.create(cr, uid, move_line, context=context)
18+ new_move_line_id = move_line_obj.create(cr, uid, move_line, context=context)
19+ move_line_obj.reconcile_partial(cr, uid, [line.id, new_move_line_id], 'auto', context)
20 lines_created_ids.append(new_move_line_id)
21
22 return lines_created_ids
23
24=== modified file 'res_currency_sequence/res_currency_sequence.py'
25--- res_currency_sequence/res_currency_sequence.py 2014-04-02 17:06:19 +0000
26+++ res_currency_sequence/res_currency_sequence.py 2014-07-09 15:20:16 +0000
27@@ -20,6 +20,7 @@
28 #
29 ##############################################################################
30 import time
31+import copy
32 from osv import osv, fields
33 from tools.translate import _
34
35@@ -90,16 +91,19 @@
36 res_obj = self.pool.get('res.currency.rate')
37 result = 0.00
38
39+ copy_context = copy.copy(context)
40+ copy_context.update({'date':name})
41+
42 res_currency_base_id = self.search(cr, uid, [('base', '=', True)])
43 res_currency_base = self.browse(cr, uid, res_currency_base_id)[0]
44
45 if res_currency_initial.id == res_currency_base.id:
46- exchange_rate_dict = self.pool.get('res.currency')._current_rate(cr, uid, [res_currency_finally.id], name, arg=None, context=context)
47+ exchange_rate_dict = self.pool.get('res.currency')._current_rate(cr, uid, [res_currency_finally.id], name, arg=None, context=copy_context)
48 result = exchange_rate_dict[res_currency_finally.id]
49
50 elif res_currency_initial.id != res_currency_finally.id:
51- currency_rate_initial = self.pool.get('res.currency')._current_rate(cr, uid, [res_currency_initial.id], name, arg=None, context=context)[res_currency_initial.id]
52- currency_rate_finally = self.pool.get('res.currency')._current_rate(cr, uid, [res_currency_finally.id], name, arg=None, context=context)[res_currency_finally.id]
53+ currency_rate_initial = self.pool.get('res.currency')._current_rate(cr, uid, [res_currency_initial.id], name, arg=None, context=copy_context)[res_currency_initial.id]
54+ currency_rate_finally = self.pool.get('res.currency')._current_rate(cr, uid, [res_currency_finally.id], name, arg=None, context=copy_context)[res_currency_finally.id]
55 result = currency_rate_initial * currency_rate_finally
56 else:
57 result = 1.00

Subscribers

People subscribed via source and target branches