Merge lp:~openerp-dev/openobject-addons/trunk-bug-810548-mdi into lp:openobject-addons

Proposed by DJ Patel (OpenERP)
Status: Merged
Merged at revision: 5703
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-810548-mdi
Merge into: lp:openobject-addons
Diff against target: 25 lines (+4/-3)
1 file modified
account/account_invoice.py (+4/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-810548-mdi
Reviewer Review Type Date Requested Status
Purnendu Singh (OpenERP) (community) Approve
DJ Patel (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Pending
Review via email: mp+81941@code.launchpad.net

This proposal supersedes a proposal from 2011-10-19.

Description of the change

Hello Sir,

Here i put a constraint for period related to the company.
Because, if period is not found for the company, it will take the default company's period.

Divyesh Makwana(MDI)

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

not good patch, you must use the function find(self, cr, uid, dt=None, context=None) of account_period.

review: Needs Fixing
Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote : Posted in a previous version of this proposal

Hello Sir,

I have done the changes, as per your suggestion.

Thanks and Regards,

Divyesh Makwana(MDI)

review: Needs Resubmitting
Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) wrote : Posted in a previous version of this proposal

9 + period_ids = period_obj.find(cr, uid, inv.date_invoice)
20 + period_id = period_ids[0]

can be optimize by

                period_id = period_obj.find(cr, uid, inv.date_invoice)[0]

review: Needs Fixing
Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote : Posted in a previous version of this proposal

Hello Sir,

I have done the changes, as per your suggestion.

Thanks and Regards,

Divyesh Makwana(MDI)

review: Needs Resubmitting
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

This does not fixes the bug.

Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote :

Hello Sir,

I have passes the "company_id" in context.

Thanks and Regards,

Divyesh Makwana(MDI)

review: Needs Resubmitting
Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2011-11-11 13:27:53 +0000
3+++ account/account_invoice.py 2011-11-14 11:56:17 +0000
4@@ -795,6 +795,7 @@
5 """Creates invoice related analytics and financial move lines"""
6 ait_obj = self.pool.get('account.invoice.tax')
7 cur_obj = self.pool.get('res.currency')
8+ period_obj = self.pool.get('account.period')
9 context = {}
10 for inv in self.browse(cr, uid, ids):
11 if not inv.journal_id.sequence_id:
12@@ -923,10 +924,10 @@
13 'narration':inv.comment
14 }
15 period_id = inv.period_id and inv.period_id.id or False
16+ ctx.update({'company_id': inv.company_id.id})
17 if not period_id:
18- period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d')), ('company_id', '=', inv.company_id.id)])
19- if period_ids:
20- period_id = period_ids[0]
21+ period_ids = period_obj.find(cr, uid, inv.date_invoice, context=ctx)
22+ period_id = period_ids and period_ids[0] or False
23 if period_id:
24 move['period_id'] = period_id
25 for i in line:

Subscribers

People subscribed via source and target branches

to all changes: