Skip to Content
Menu
This question has been flagged
2 Replies
3496 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.

Avatar
Discard

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

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!!

Best Answer

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 :)

Avatar
Discard