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
1=== modified file 'account/account.py'
2--- account/account.py 2011-11-14 10:39:45 +0000
3+++ account/account.py 2011-11-16 07:13:28 +0000
4@@ -2186,6 +2186,7 @@
5 account_move_obj = self.pool.get('account.move')
6 account_move_line_obj = self.pool.get('account.move.line')
7 pt_obj = self.pool.get('account.payment.term')
8+ period_obj = self.pool.get('account.period')
9
10 if context is None:
11 context = {}
12@@ -2193,14 +2194,12 @@
13 if datas.get('date', False):
14 context.update({'date': datas['date']})
15
16- period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
17- if not period_id:
18- raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
19- period_id = period_id[0]
20-
21 move_date = context.get('date', time.strftime('%Y-%m-%d'))
22 move_date = datetime.strptime(move_date,"%Y-%m-%d")
23 for model in self.browse(cr, uid, ids, context=context):
24+ context.update({'company_id': model.company_id.id})
25+ period_ids = period_obj.find(cr, uid, dt=context.get('date', False), context=context)
26+ period_id = period_ids and period_ids[0] or False
27 try:
28 entry['name'] = model.name%{'year': move_date.strftime('%Y'), 'month': move_date.strftime('%m'), 'date': move_date.strftime('%Y-%m')}
29 except:
30
31=== modified file 'account/account_view.xml'
32--- account/account_view.xml 2011-11-14 11:34:05 +0000
33+++ account/account_view.xml 2011-11-16 07:13:28 +0000
34@@ -1626,7 +1626,7 @@
35 <tree string="Journal Entry Model Line" editable="bottom">
36 <field name="sequence"/>
37 <field name="name"/>
38- <field name="account_id"/>
39+ <field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
40 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
41 <field name="partner_id"/>
42 <field name="debit"/>
43@@ -1645,12 +1645,12 @@
44 <form string="Journal Entry Model Line">
45 <field colspan="4" name="name" select="1"/>
46 <field name="sequence"/>
47- <field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
48+ <field name="account_id" domain="[('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
49 <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
50 <field name="partner_id"/>
51 <field name="debit" select="1"/>
52 <field name="credit" select="1"/>
53- <field name="quantity"/>
54+ <field name="quantity"/>
55 <field name="date_maturity"/>
56 </form>
57 </field>
58
59=== modified file 'account/wizard/account_use_model.py'
60--- account/wizard/account_use_model.py 2011-01-27 06:32:26 +0000
61+++ account/wizard/account_use_model.py 2011-11-16 07:13:28 +0000
62@@ -64,10 +64,9 @@
63 data_model = account_model_obj.browse(cr, uid, context['active_ids'], context=context)
64 for model in data_model:
65 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')}
66- period_id = account_period_obj.find(cr, uid, context=context)
67- if not period_id:
68- raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
69- period_id = period_id[0]
70+ context.update({'company_id': model.company_id.id})
71+ period_ids = account_period_obj.find(cr, uid, context=context)
72+ period_id = period_ids and period_ids[0] or False
73 move_id = account_move_obj.create(cr, uid, {
74 'ref': entry['name'],
75 'period_id': period_id,

Subscribers

People subscribed via source and target branches

to all changes: