Merge lp:~openerp-commiter/openobject-addons/NHOMAR_bug559747 into lp:openobject-addons/5.0

Proposed by Nhomar - Vauxoo
Status: Rejected
Rejected by: qdp (OpenERP)
Proposed branch: lp:~openerp-commiter/openobject-addons/NHOMAR_bug559747
Merge into: lp:openobject-addons/5.0
Diff against target: 110 lines (+49/-34)
1 file modified
account_voucher/account.py (+49/-34)
To merge this branch: bzr merge lp:~openerp-commiter/openobject-addons/NHOMAR_bug559747
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo (community) Disapprove
qdp (OpenERP) Needs Information
OpenERP Core Team Pending
Review via email: mp+23145@code.launchpad.net

Description of the change

Description:

https://bugs.launchpad.net/openobject-addons/+bug/559747

It was tested in our production enviroment, with all variants. We think is working fine.

To post a comment you must log in.
Revision history for this message
qdp (OpenERP) (qdp) wrote :

Hi Nhomar,

heu? did you really intend to make this merge proposal on the addons v5 ? If yes, then i must say that we are only accepting bugfixes for stable version. This aint really one. I'm rejecting your merge proposal, please if you wanted to propose it for trunk, make a new one with the correct destination (after you checked it's still worth).

Thanks for you understanding,
Quentin

review: Needs Information
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

Je. See date of the commit "2010-04-09" One YEar ago ;-)

review: Disapprove

Unmerged revisions

2698. By Nhomar Hernandez <nhomar@satelite>

[BUG] [account_voucher] Checking the amount for Openning Balance shows information not useful. Fixed the import _ too

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher/account.py'
2--- account_voucher/account.py 2010-01-20 17:19:31 +0000
3+++ account_voucher/account.py 2010-04-10 03:25:29 +0000
4@@ -28,6 +28,7 @@
5 import mx.DateTime
6 from mx.DateTime import RelativeDateTime
7 from tools import config
8+from tools.translate import _
9
10 class account_account(osv.osv):
11 _inherit = "account.account"
12@@ -115,7 +116,18 @@
13 move_line['credit'] = vals['open_bal'] or False
14 self.pool.get('account.move.line').create(cr,uid,move_line)
15 return account_id
16-
17+
18+ def _check_moves_lines(self, cr, uid, ids, method, context):
19+ moves = self.pool.get('account.move')
20+ line_obj = self.pool.get('account.move.line')
21+ account_ids = self.search(cr, uid, [('id', 'child_of', ids)])
22+ if line_obj.search(cr, uid, [('account_id', 'in', account_ids),('move_id.journal_id.type','<>','situation')]):
23+
24+ if method == 'write':
25+ raise osv.except_osv(_('Error !'), _('You cannot load or change by this method the opening balance amount for an account with move lines. Please try editing the opening move.'))
26+ elif method == 'unlink':
27+ raise osv.except_osv(_('Error !'), _('You cannot do this action in an account with lines of moves!. Please try editing the openning move.'))
28+
29 def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
30 res_temp={}
31 if vals.has_key('name'):
32@@ -136,42 +148,45 @@
33 if vals.has_key('open_bal'):
34 self_obj= self.browse(cr,uid,ids)
35 move_pool=self.pool.get('account.move')
36+ move_pool_line=self.pool.get('account.move')
37 if vals:
38 for obj in self_obj:
39 flg=0
40- if obj.journal_id and obj.journal_id.type == 'situation':
41- move=move_pool.search(cr,uid,[('journal_id','=',obj.journal_id.id)])
42- if move:
43- move_obj=move_pool.browse(cr,uid,move[0])
44- move=move[0]
45- else:
46- name = self.pool.get('ir.sequence').get_id(cr, uid, obj.journal_id.sequence_id.id)
47- move_data = {'name': name, 'journal_id': obj.journal_id.id}
48- move=self.pool.get('account.move').create(cr,uid,move_data)
49- move_obj=move_pool.browse(cr,uid,move)
50- move_line_data={'name':obj.journal_id.name,
51- 'debit':obj.debit or 0.0,
52- 'credit':obj.credit or 0.0,
53- 'account_id':obj.id,
54- 'move_id':move,
55- 'journal_id':obj.journal_id.id,
56- 'period_id':move_obj.period_id.id,
57- }
58- if obj.type1:
59- if obj.type1 == 'dr':
60- move_line_data['debit'] = obj.open_bal
61- elif obj.type1 == 'cr':
62- move_line_data['credit'] = obj.open_bal
63- if move_obj and move:
64- for move_line in move_obj.line_id:
65- if move_line.account_id.id == obj.id:
66- if move_line_data['debit'] == 0.0 and move_line_data['credit']== 0.0:
67- self.pool.get('account.move.line').unlink(cr,uid,[move_line.id])
68- else:
69- self.pool.get('account.move.line').write(cr,uid,[move_line.id],move_line_data)
70- flg=1
71- if not flg:
72- self.pool.get('account.move.line').create(cr,uid,move_line_data)
73+ if obj.journal_id and obj.journal_id.type == 'situation':
74+ move=move_pool.search(cr,uid,[('journal_id','=',obj.journal_id.id)])
75+ self._check_moves_lines(cr, uid, ids, "write", context)
76+ #move_lines=move_pool_line.search(cr,uid,[('account_id','=',obj.id),('move_id','<>',move.id)])
77+ if move:
78+ move_obj=move_pool.browse(cr,uid,move[0])
79+ move=move[0]
80+ else:
81+ name = self.pool.get('ir.sequence').get_id(cr, uid, obj.journal_id.sequence_id.id)
82+ move_data = {'name': name, 'journal_id': obj.journal_id.id}
83+ move=self.pool.get('account.move').create(cr,uid,move_data)
84+ move_obj=move_pool.browse(cr,uid,move)
85+ move_line_data={'name':obj.journal_id.name,
86+ 'debit':obj.debit or 0.0,
87+ 'credit':obj.credit or 0.0,
88+ 'account_id':obj.id,
89+ 'move_id':move,
90+ 'journal_id':obj.journal_id.id,
91+ 'period_id':move_obj.period_id.id,
92+ }
93+ if obj.type1:
94+ if obj.type1 == 'dr':
95+ move_line_data['debit'] = obj.open_bal
96+ elif obj.type1 == 'cr':
97+ move_line_data['credit'] = obj.open_bal
98+ if move_obj and move:
99+ for move_line in move_obj.line_id:
100+ if move_line.account_id.id == obj.id:
101+ if move_line_data['debit'] == 0.0 and move_line_data['credit']== 0.0:
102+ self.pool.get('account.move.line').unlink(cr,uid,[move_line.id])
103+ else:
104+ self.pool.get('account.move.line').write(cr,uid,[move_line.id],move_line_data)
105+ flg=1
106+ if not flg:
107+ self.pool.get('account.move.line').create(cr,uid,move_line_data)
108 return True
109
110 def onchange_type(self, cr, uid, ids,user_type,type1):