Bharat Devnani (Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-871314-bde into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #871314 in OpenERP Addons: "cannot duplicate journal entries"
https://bugs.launchpad.net/openobject-addons/+bug/871314
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-871314-bde/+merge/78811
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.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-871314-bde/+merge/78811
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-871314-bde.
=== modified file 'account/account.py'
--- account/account.py 2011-10-02 10:54:04 +0000
+++ account/account.py 2011-10-10 10:03:24 +0000
@@ -367,8 +367,8 @@
move_obj = self.pool.get('account.move.line')
move_id = move_obj.search(cr, uid, [
- ('journal_id','=',jids[0]),
- ('period_id','=',pids[0]),
+ ('journal_id','=',jids[0]),
+ ('period_id','=',pids[0]),
('account_id','=', account_id),
(name,'>', 0.0),
('name','=', _('Opening Balance'))
@@ -930,7 +930,7 @@
_sql_constraints = [
('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),
]
-
+
def _check_duration(self,cr,uid,ids,context=None):
obj_period = self.browse(cr, uid, ids[0], context=context)
if obj_period.date_stop < obj_period.date_start:
@@ -1564,6 +1564,22 @@
valid_moves = [move.id for move in valid_moves]
return len(valid_moves) > 0 and valid_moves or False
+ def onchange_journal_id(self, cr, uid, ids, journal_id, context=None):
+ if journal_id:
+ line_obj = self.pool.get('account.move.line')
+ for move in self.browse(cr,uid,ids,context):
+ line_ids = [line.id for line in move.line_id]
+ line_obj.write(cr,uid,line_ids,{'journal_id': journal_id})
+ return {}
+
+ def onchange_period_id(self, cr, uid, ids, period_id, context=None):
+ if period_id:
+ line_obj = self.pool.get('account.move.line')
+ for move in self.browse(cr,uid,ids,context):
+ line_ids = [line.id for line in move.line_id]
+ line_obj.write(cr,uid,line_ids,{'period_id': period_id})
+ return {}
+
account_move()
class account_move_reconcile(osv.osv):
@@ -2177,7 +2193,7 @@
entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
except:
raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))
-
+
move_id = account_move_obj.create(cr, uid, {
'ref': entry['name'],
'period_id': period_id,
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2011-10-05 09:05:18 +0000
+++ account/account_view.xml 2011-10-10 10:03:24 +0000
@@ -752,7 +752,7 @@
<group col="2" colspan="2">
<separator string="Reporting Configuration" colspan="4"/>
<field name="report_type" select="2"/>
- <field name="sign" />
+ <field name="sign" />
</group>
<group col="2" colspan="2">
<separator string="Closing Method" colspan="4"/>
@@ -1318,8 +1318,8 @@
<field name="name" readonly="True"/>
<field name="ref"/>
<field name="to_check" groups="base.group_extended"/>
- <field name="journal_id"/>
- <field name="period_id"/>
+ <field name="journal_id" on_change="onchange_journal_id(journal_id)"/>
+ <field name="period_id" on_change="onchange_period_id(period_id)"/>
<field name="date"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="partner_id" invisible="1"/>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp