Skip to content

Commit

Permalink
temp rebasing PR 786 (ac40bb2)
Browse files Browse the repository at this point in the history
  • Loading branch information
roboadhoc committed Feb 21, 2024
2 parents 52dbfec + ac40bb2 commit 67d0d50
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sale_timesheet_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
Sales Timesheet UX
==================

* When confirming a sale order with service products with Service tracking = "Create a task in sales order's project", if the SO has an analytic account that is related to ONE project, then we don't create a project but instead link the new tasks to this project.
* When confirming a sale order with a service product type with service tracking = "Create a task in sales order's project (Project & Task option)", now both the proyect and the task will remain related to the SO when billable is turned off from the proyect settings (works both for a new proyect and task as for a new task in an existing proyect).
* When confirming a sale order with a product with Product Type = "Service" and Create on Order = "Project & Task", if the SO has an analytic account that is related to one project, then the system won't create a new project but use the analytic's account project to create the task inside.
* When confirming a sale order with a product with Product Type = "Service" and Create on Order = "Project & Task" both the proyect and the task will remain related to the SO when "Billable" is turned off from the project settings (works both for a new proyect and task as for a new task in an existing proyect).
* Se protegen las lineas de las ordenes de ventas que estan asociadas a los partes de horas en los siguientes casos (no se borran las horas imputadas a esa linea de la OV) (esta proteccion se habilita desde las configuraciones del parte de horas):

1) Si a un proyecto se le desmarga el facturable en su configuración: si un proyecto esta como facturable, y tiene tareas con partes de horas asociados a ordenes de venta, al destildarle el facturable la orden de venta seguira teniendo cargadas las horas imputadas en esa tarea.
Expand Down
2 changes: 1 addition & 1 deletion sale_timesheet_ux/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Sales Timesheet UX",
"summary": "",
"version": "16.0.1.1.0",
"version": "16.0.1.2.0",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"author": "ADHOC SA",
Expand Down
22 changes: 22 additions & 0 deletions sale_timesheet_ux/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,25 @@ def _get_timesheet(self):
if self._context.get('write_allow_billiable'):
recs = recs.filtered(lambda x: not x.is_so_line_edited)
return recs

def _compute_sale_order_id(self):
# Store allow_billable task's state to mantain the relation
# between the task with the SO that originated it when allow_billable is changed in project
billable_condition = {x: x.allow_billable for x in self}
self.allow_billable = True
super()._compute_sale_order_id()
for k, v in billable_condition.items():
k.allow_billable = v

def _compute_sale_line(self):
# Override this method to combine the behavior between sale_project and sale_timesheet
# so the change of value of "allow_billable" to True doesn't unlink the sale_line_id of the task
# with the SO that originated it
billable_tasks = self.filtered('allow_billable')
for task in billable_tasks:
if not task.sale_line_id:
# if the display_project_id is set then it means the task is classic task or a subtask with another project than its parent.
task.sale_line_id = task.display_project_id.sale_line_id or task.parent_id.sale_line_id or task.project_id.sale_line_id or task.milestone_id.sale_line_id
# check sale_line_id and customer are coherent
if task.sale_line_id.order_partner_id.commercial_partner_id != task.partner_id.commercial_partner_id:
task.sale_line_id = False

0 comments on commit 67d0d50

Please sign in to comment.