Merge lp:~openerp-dev/openobject-addons/6.0-opw-382052-han into lp:openobject-addons/6.0

Proposed by Hardik Ansodariya (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 5041
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-382052-han
Merge into: lp:openobject-addons/6.0
Diff against target: 24 lines (+6/-0)
1 file modified
project_mrp/project_procurement.py (+6/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-382052-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Hardik Ansodariya (OpenERP) Pending
Xavier ALT Pending
Review via email: mp+99310@code.launchpad.net

This proposal supersedes a proposal from 2012-03-20.

Description of the change

Hello,

Fixed the issue of when we have a product in type 'Service' that generates a task
when confirming a Sales Order, the name of the partner is not kept from the
order

Thanks
Hardik

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Xavier ALT (dex-phx) wrote : Posted in a previous version of this proposal

Hello,

Better than searching for sale order with "name" like procurement "origin", we could use "procurement_id" on sale.order.line. Looking at sale/sale.py, line 731, the _exact_ "procurement_id" is written on sale.order.line just after it's creation.

And also, make sure if we do not found any sale.order.line, we should not browse it + task 'partner_id' field should stay as False.

Cheers,
Xavier

review: Needs Fixing
Revision history for this message
Hardik Ansodariya (OpenERP) (han-tinyerp) wrote : Posted in a previous version of this proposal

Hello Xavier,

I have fixed the issue as per your suggestion.

kindly review it.

Thanks
Hardik

review: Needs Resubmitting
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote : Posted in a previous version of this proposal

Hello Hardik,

what if there is no sale order line ?

you should check for Sale order line existence if no then the partner_id should be False

something like:
If line_id:
then browse for line_id and get the partner id.

Thanks,
Naresh

review: Needs Fixing
Revision history for this message
Hardik Ansodariya (OpenERP) (han-tinyerp) wrote : Posted in a previous version of this proposal

Hello,

Add validation if line_id then get partner_id otherwise partner_id False.

Thanks

review: Needs Resubmitting
5041. By Hardik Ansodariya (OpenERP)

[Fixed] project_mrp: Add validation if line_id then get partner_id else False (Maintanace Case: 382052)

Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve

Unmerged revisions

5041. By Hardik Ansodariya (OpenERP)

[Fixed] project_mrp: Add validation if line_id then get partner_id else False (Maintanace Case: 382052)

5040. By Hardik Ansodariya (OpenERP)

[Fixed] project_mrp: Add validation if line_id then get partner_id else False (Maintanace Case: 382052)

5039. By Hardik Ansodariya (OpenERP)

[FIX] project_mrp: project_mrp: when confirming a Sales Order, the name of the partner is not kept by using procurement_id (Maintenance Case : 382052)

5038. By Hardik Ansodariya (OpenERP)

[FIX] project_mrp: when confirming a Sales Order, the name of the partner is not kept from the :(Maintenance Case : 382052)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project_mrp/project_procurement.py'
2--- project_mrp/project_procurement.py 2011-05-07 11:24:17 +0000
3+++ project_mrp/project_procurement.py 2012-03-26 12:59:16 +0000
4@@ -35,7 +35,12 @@
5 def action_produce_assign_service(self, cr, uid, ids, context=None):
6 task_obj = self.pool.get('project.task')
7 uom_obj = self.pool.get('product.uom')
8+ sale_order_line_obj = self.pool.get('sale.order.line')
9+ partner_id = False
10 for procurement in self.browse(cr, uid, ids, context=context):
11+ line_id = sale_order_line_obj.search(cr, uid, [('procurement_id', '=', procurement.id)],context=context)
12+ if line_id:
13+ partner_id = sale_order_line_obj.browse(cr, uid, line_id, context=context)[0].order_id.partner_id.id
14 self.write(cr, uid, [procurement.id], {'state': 'running'})
15 planned_hours = procurement.product_qty
16 proj_uom_id = procurement.company_id.project_time_mode_id.id
17@@ -55,6 +60,7 @@
18 'date_deadline': procurement.date_planned,
19 'project_id': procurement.product_id.project_id and procurement.product_id.project_id.id or False,
20 'company_id': procurement.company_id.id,
21+ 'partner_id': partner_id
22 },context=context)
23 self.write(cr, uid, [procurement.id],{'task_id':task_id})
24 return task_id