Merge lp:~openerp-dev/openobject-addons/trunk-bug-871314-bde into lp:openobject-addons

Proposed by Bharat Devnani (Open ERP)
Status: Rejected
Rejected by: qdp (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-871314-bde
Merge into: lp:openobject-addons
Diff against target: 79 lines (+23/-7)
2 files modified
account/account.py (+20/-4)
account/account_view.xml (+3/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-871314-bde
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Approve
Bharat Devnani (Open ERP) (community) Needs Resubmitting
qdp (OpenERP) Pending
Review via email: mp+78811@code.launchpad.net

Description of the change

Hello Sir,

I have applied the patch of Stéphane Bidoul, after applying the patch the Journal Entries can be duplicated.

Thanks & Regards,
Devnani Bharat R.

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

i reject the merge proposal, for the reasons explained in the bug.

thanks

Revision history for this message
qdp (OpenERP) (qdp) wrote :

mmhm i need to reconsider that merge prop

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Bharat,

Try to follow python coding standard, declare pool variable at beginning of method and pass context in write method too.
Above changes will make your Merge proposal more consistent.

Thanks,
Mustufa

review: Needs Fixing
5324. By Bharat Devnani (Open ERP)

[IMP] account : improved the coding style, variable name and passed the context argument in write method of account/account.py

Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Sir,

Thanks for your kind suggestion, i have improved the changes on the coding conventions, variable naming convention and also passed context argument in write methods.

Thanks & Regards,
Devnani Bharat R.

review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Seems good now.

Note: After comma there should be one space.

Thank you,
Mustufa

review: Approve
5325. By Bharat Devnani (Open ERP)

[IMP] account : improved the useability in def onchange_journal_id and onchange_period_id of account/account.py

Revision history for this message
qdp (OpenERP) (qdp) wrote :

as explained on the bug report, i choosed another solution to fix the problem so i'm rejecting the merge prop.

thanks

Unmerged revisions

5325. By Bharat Devnani (Open ERP)

[IMP] account : improved the useability in def onchange_journal_id and onchange_period_id of account/account.py

5324. By Bharat Devnani (Open ERP)

[IMP] account : improved the coding style, variable name and passed the context argument in write method of account/account.py

5323. By Stéphane Bidoul

[FIX] account : cannot duplicate journal entries

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2011-10-02 17:31:16 +0000
3+++ account/account.py 2011-10-12 05:56:27 +0000
4@@ -367,8 +367,8 @@
5
6 move_obj = self.pool.get('account.move.line')
7 move_id = move_obj.search(cr, uid, [
8- ('journal_id','=',jids[0]),
9- ('period_id','=',pids[0]),
10+ ('journal_id','=',jids[0]),
11+ ('period_id','=',pids[0]),
12 ('account_id','=', account_id),
13 (name,'>', 0.0),
14 ('name','=', _('Opening Balance'))
15@@ -930,7 +930,7 @@
16 _sql_constraints = [
17 ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),
18 ]
19-
20+
21 def _check_duration(self,cr,uid,ids,context=None):
22 obj_period = self.browse(cr, uid, ids[0], context=context)
23 if obj_period.date_stop < obj_period.date_start:
24@@ -1564,6 +1564,22 @@
25 valid_moves = [move.id for move in valid_moves]
26 return len(valid_moves) > 0 and valid_moves or False
27
28+ def onchange_journal_id(self, cr, uid, ids, journal_id, context=None):
29+ account_move_line_obj = self.pool.get('account.move.line')
30+ if journal_id:
31+ for move in self.browse(cr, uid, ids, context=context):
32+ line_ids = [line.id for line in move.line_id]
33+ account_move_line_obj.write(cr, uid, line_ids, {'journal_id': journal_id}, context=context)
34+ return {}
35+
36+ def onchange_period_id(self, cr, uid, ids, period_id, context=None):
37+ account_move_line_obj = self.pool.get('account.move.line')
38+ if period_id:
39+ for move in self.browse(cr, uid, ids, context=context):
40+ line_ids = [line.id for line in move.line_id]
41+ account_move_line_obj.write(cr, uid, line_ids, {'period_id': period_id}, context=context)
42+ return {}
43+
44 account_move()
45
46 class account_move_reconcile(osv.osv):
47@@ -2177,7 +2193,7 @@
48 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
49 except:
50 raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))
51-
52+
53 move_id = account_move_obj.create(cr, uid, {
54 'ref': entry['name'],
55 'period_id': period_id,
56
57=== modified file 'account/account_view.xml'
58--- account/account_view.xml 2011-10-11 14:03:35 +0000
59+++ account/account_view.xml 2011-10-12 05:56:27 +0000
60@@ -752,7 +752,7 @@
61 <group col="2" colspan="2">
62 <separator string="Reporting Configuration" colspan="4"/>
63 <field name="report_type" select="2"/>
64- <field name="sign" />
65+ <field name="sign" />
66 </group>
67 <group col="2" colspan="2">
68 <separator string="Closing Method" colspan="4"/>
69@@ -1318,8 +1318,8 @@
70 <field name="name" readonly="True"/>
71 <field name="ref"/>
72 <field name="to_check" groups="base.group_extended"/>
73- <field name="journal_id"/>
74- <field name="period_id"/>
75+ <field name="journal_id" on_change="onchange_journal_id(journal_id)"/>
76+ <field name="period_id" on_change="onchange_period_id(period_id)"/>
77 <field name="date"/>
78 <field name="company_id" required="1" groups="base.group_multi_company"/>
79 <field name="partner_id" invisible="1"/>

Subscribers

People subscribed via source and target branches

to all changes: