Merge lp:~openerp-dev/openobject-addons/6.0-opw-57608-ira into lp:openobject-addons/6.0

Proposed by Ila Rana(Open ERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 5059
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-57608-ira
Merge into: lp:openobject-addons/6.0
Diff against target: 12 lines (+2/-0)
1 file modified
hr_timesheet_sheet/hr_timesheet_sheet.py (+2/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-57608-ira
Reviewer Review Type Date Requested Status
Xavier ALT (community) Needs Fixing
Naresh(OpenERP) (community) Approve
Review via email: mp+93344@code.launchpad.net

Description of the change

Hello Naresh,

The proper company_id of analytic_line object is not restored in postgres. So the issue of "Timesheet: company_id not updated in analytic.account.line" is resolved now through this branch.

Thanks,
Ila Rana

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

just a note use vals.update(company_id=company[0]) its good practice to do this

Revision history for this message
Xavier ALT (dex-phx) wrote :

Hello Ila,

Two things that needd to be fixed:

- You're reading the "company_id" in an account.analytic.account, but the "company_id" field is not required on that object, so make sure there is one, otherwise the final "company[0]" will crash.

- You should move that code into "hr_timesheet" module, because here we're inheriting from "hr.analytic.timesheet" object, and your code don't depend on new fields introduce by "hr_timesheet_sheet" module.

Regards,
Xavier

review: Needs Fixing

Unmerged revisions

5059. By Ila Rana(Open ERP)

[FIX]Timesheet: company_id not updated in analytic.account.line in postgres(57608)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
2--- hr_timesheet_sheet/hr_timesheet_sheet.py 2011-11-23 09:52:46 +0000
3+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2012-02-16 07:21:18 +0000
4@@ -478,6 +478,8 @@
5 ts = self.pool.get('hr_timesheet_sheet.sheet').browse(cr, uid, vals['sheet_id'])
6 if not ts.state in ('draft', 'new'):
7 raise osv.except_osv(_('Error !'), _('You can not modify an entry in a confirmed timesheet !'))
8+ company = self.pool.get('account.analytic.account').read(cr, uid, [vals['account_id']], ['company_id'])[0]['company_id']
9+ vals.update({'company_id': company[0]})
10 return super(hr_timesheet_line,self).create(cr, uid, vals, *args, **kwargs)
11
12 def unlink(self, cr, uid, ids, *args, **kwargs):