Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how to convert task to a sale order

By
Geetha
on 8/23/16, 7:02 AM 194 views

odoo already have a module which create a Task from sale order.But i want exactly inverse of that module ,how to create a task as a sale order.

The Following details are Transferred to the Sale Order:

- Task description is posted as to  OrderLine , column  Description , one per task.

- Timesheets entries are Transferred to the Description column as well, in Following format:

Date_from - DATE_TO: Hours: Mins, DEVELOPER_NAME 

Description / Notes

Date_from - DATE_TO: Hours: Mins, DEVELOPER_NAME

Description / Notes

- Total of the time logged on Timesheets is Transferred to  Ordered Qty  column.

Thanks Pawan for your detail description,

Will you please explain me in detail that which view i have to inherit and what all the logic i have to write because i am having basic knowledge in odoo9 backend .I am writing it as answer because i don't have enough points to reply for comment

Thanks in advance

Geetha
on 8/24/16, 12:03 AM

Explaining Logic here is a bit lengthy process, anyway that is upto your skill and requirement, regarding inheriting, as said you have to be working on project.task and sale.order object

1) inherit project.task -> override write() method -> call super() method

2) use search() on sale.order to check for sale.order record for project(project.project) of respective tasks (use anal

3) if no sale.order exist for that project then create one else use existing one, (now u are having a sale.order record for that project)

4) create a sale.order.line record for current project.task recors(don't forget to add current task id in sale.order.line)

5) Please refer my answer also

6) And you are done!!

Pawan
on 8/25/16, 4:22 AM
0

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 8/23/16, 10:13 AM

Geetha,

for this you can override create method of project.task.

And you have to keep some points in mind to populate in sale.order and sale.order.line:

1) Check if there is already a sale order created for that project, if not, create one and if yes skip this part...(here you have to be sure that your system does not allow more than one SO(sale order) for a project.)

     1.1) if creating new SO, populate projects analytic account in SO 'analytic account' field.

2) create a new Sale order line for that respective task with the field you mentioned above..

     (Note: here one important point is that your "Ordered qauantity" field should be updated whenever you timesheet hours are updating, for that you can change the field to functional field to be updated depending on timesheet hours field change)

3) add a field task_id in Sale.order.line and populate it with current task id(this will surely be useful for you in future)

This should solve your purpose and later u can make amendments as required

All the best :)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/23/16, 7:02 AM
Seen: 194 times
Last updated: 11/1/16, 2:24 AM