Merge lp:~openerp-dev/openobject-addons/trunk-bug-812027-ara into lp:openobject-addons

Proposed by Ashvin Rathod (OpenERP)
Status: Rejected
Rejected by: qdp (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-812027-ara
Merge into: lp:openobject-addons
Diff against target: 75 lines (+10/-12)
3 files modified
account/account.py (+4/-5)
account/account_view.xml (+3/-3)
account/wizard/account_use_model.py (+3/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-812027-ara
Reviewer Review Type Date Requested Status
Purnendu Singh (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Needs Fixing
Mustufa Rangwala (Open ERP) (community) Approve
Ashvin Rathod (OpenERP) (community) Needs Resubmitting
Review via email: mp+69447@code.launchpad.net

Description of the change

Hello,

Fix: Multicompany - recurring entries - generate entries

Thanks,
ara

To post a comment you must log in.
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

Hello,

I have also add domain on account_id field for recurring lines.

Thanks,
ara

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

Thanks for the work Ashvin,
But you can improve your patch using limit=1 in search criteria for periods.

review: Needs Fixing
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

Hello,

I have add search criteria for periods.

Thanks,
ara

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

no, you must continue using find and give company_id in the context in order to have the search made using that company_id.

review: Needs Fixing
Revision history for this message
qdp (OpenERP) (qdp) wrote :

As we are trying to keep a clean merge proposal list on which review is needed, i'm also setting your merge proposal in "work in progress". Set it back to "needs review" when your work is over and it will automatcally appears in our TODO-list.

Thanks,
Quentin

Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) wrote :

Hello,

As per suggestion find function of account_period object is used to get proper period.

I will place a new mp for the issue raised in comment #1 by Kevin McMenamin on bug.

Thanks and regards,
Purnendu Singh

review: Needs Resubmitting
Revision history for this message
qdp (OpenERP) (qdp) wrote :

hi,

that was closer.. but while having a look more in detail at the code, i saw that the whole function generate() was copied/pasted into account/wizard/account_use_model.py! Thus i refactored.

Having your merge proposal now a bit far away from what has been merged, i have to reject it. For the <sake of clarity>.

Thanks

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account/account.py'
--- account/account.py 2011-11-14 10:39:45 +0000
+++ account/account.py 2011-11-16 07:13:28 +0000
@@ -2186,6 +2186,7 @@
2186 account_move_obj = self.pool.get('account.move')2186 account_move_obj = self.pool.get('account.move')
2187 account_move_line_obj = self.pool.get('account.move.line')2187 account_move_line_obj = self.pool.get('account.move.line')
2188 pt_obj = self.pool.get('account.payment.term')2188 pt_obj = self.pool.get('account.payment.term')
2189 period_obj = self.pool.get('account.period')
21892190
2190 if context is None:2191 if context is None:
2191 context = {}2192 context = {}
@@ -2193,14 +2194,12 @@
2193 if datas.get('date', False):2194 if datas.get('date', False):
2194 context.update({'date': datas['date']})2195 context.update({'date': datas['date']})
21952196
2196 period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
2197 if not period_id:
2198 raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
2199 period_id = period_id[0]
2200
2201 move_date = context.get('date', time.strftime('%Y-%m-%d'))2197 move_date = context.get('date', time.strftime('%Y-%m-%d'))
2202 move_date = datetime.strptime(move_date,"%Y-%m-%d")2198 move_date = datetime.strptime(move_date,"%Y-%m-%d")
2203 for model in self.browse(cr, uid, ids, context=context):2199 for model in self.browse(cr, uid, ids, context=context):
2200 context.update({'company_id': model.company_id.id})
2201 period_ids = period_obj.find(cr, uid, dt=context.get('date', False), context=context)
2202 period_id = period_ids and period_ids[0] or False
2204 try:2203 try:
2205 entry['name'] = model.name%{'year': move_date.strftime('%Y'), 'month': move_date.strftime('%m'), 'date': move_date.strftime('%Y-%m')}2204 entry['name'] = model.name%{'year': move_date.strftime('%Y'), 'month': move_date.strftime('%m'), 'date': move_date.strftime('%Y-%m')}
2206 except:2205 except:
22072206
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2011-11-14 11:34:05 +0000
+++ account/account_view.xml 2011-11-16 07:13:28 +0000
@@ -1626,7 +1626,7 @@
1626 <tree string="Journal Entry Model Line" editable="bottom">1626 <tree string="Journal Entry Model Line" editable="bottom">
1627 <field name="sequence"/>1627 <field name="sequence"/>
1628 <field name="name"/>1628 <field name="name"/>
1629 <field name="account_id"/>1629 <field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
1630 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>1630 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
1631 <field name="partner_id"/>1631 <field name="partner_id"/>
1632 <field name="debit"/>1632 <field name="debit"/>
@@ -1645,12 +1645,12 @@
1645 <form string="Journal Entry Model Line">1645 <form string="Journal Entry Model Line">
1646 <field colspan="4" name="name" select="1"/>1646 <field colspan="4" name="name" select="1"/>
1647 <field name="sequence"/>1647 <field name="sequence"/>
1648 <field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>1648 <field name="account_id" domain="[('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
1649 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>1649 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
1650 <field name="partner_id"/>1650 <field name="partner_id"/>
1651 <field name="debit" select="1"/>1651 <field name="debit" select="1"/>
1652 <field name="credit" select="1"/>1652 <field name="credit" select="1"/>
1653 <field name="quantity"/>1653 <field name="quantity"/>
1654 <field name="date_maturity"/>1654 <field name="date_maturity"/>
1655 </form>1655 </form>
1656 </field>1656 </field>
16571657
=== modified file 'account/wizard/account_use_model.py'
--- account/wizard/account_use_model.py 2011-01-27 06:32:26 +0000
+++ account/wizard/account_use_model.py 2011-11-16 07:13:28 +0000
@@ -64,10 +64,9 @@
64 data_model = account_model_obj.browse(cr, uid, context['active_ids'], context=context)64 data_model = account_model_obj.browse(cr, uid, context['active_ids'], context=context)
65 for model in data_model:65 for model in data_model:
66 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')}66 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')}
67 period_id = account_period_obj.find(cr, uid, context=context)67 context.update({'company_id': model.company_id.id})
68 if not period_id:68 period_ids = account_period_obj.find(cr, uid, context=context)
69 raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))69 period_id = period_ids and period_ids[0] or False
70 period_id = period_id[0]
71 move_id = account_move_obj.create(cr, uid, {70 move_id = account_move_obj.create(cr, uid, {
72 'ref': entry['name'],71 'ref': entry['name'],
73 'period_id': period_id,72 'period_id': period_id,

Subscribers

People subscribed via source and target branches

to all changes: