Skip to content

Commit

Permalink
Merge PR #708 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 10, 2024
2 parents a778b6a + d89d672 commit 1923381
Show file tree
Hide file tree
Showing 18 changed files with 1,038 additions and 0 deletions.
101 changes: 101 additions & 0 deletions sale_timesheet_timeline/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
===================================
Dates planning in sales order lines
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8e9d8f28eaf13681b5d90efd20e8c336813f849dc5e60543e3cf6e9f83637e3d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ftimesheet-lightgray.png?logo=github
:target: https://github.com/OCA/timesheet/tree/16.0/sale_timesheet_timeline
:alt: OCA/timesheet
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/timesheet-16-0/timesheet-16-0-sale_timesheet_timeline
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/timesheet&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to plan in advance the start/end dates and assignees for the sales
order lines that are services, and they are transferred to the created task (if any)
when confirming the order.

It includes a timeline view for pre-viewing and managing the planning.

In addition, this planning is shown in the order portal view.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to Sales > Orders > Quotations
#. Create a new record.
#. Add a line with a product of type "Service".
#. A new smart-button "Planning" will appear.
#. On optional fields, you will find 3 fields for setting manually the planning data:
"Task Start", "Task End" and "Task Assignees".
#. You can also click on the "Planning" button and plan the dates visually in the
timeline view.

Known issues / Roadmap
======================

- Timeline visualization in portal.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/timesheet/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/timesheet/issues/new?body=module:%20sale_timesheet_timeline%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/timesheet <https://github.com/OCA/timesheet/tree/16.0/sale_timesheet_timeline>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_timesheet_timeline/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
15 changes: 15 additions & 0 deletions sale_timesheet_timeline/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Dates planning in sales order lines",
"version": "16.0.1.0.0",
"category": "Services/Project",
"website": "https://github.com/OCA/timesheet",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"application": False,
"depends": ["sale_timesheet", "project_timeline"],
"data": ["views/sale_order_views.xml", "views/sale_portal_templates.xml"],
}
88 changes: 88 additions & 0 deletions sale_timesheet_timeline/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_timesheet_timeline
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-21 07:09+0000\n"
"PO-Revision-Date: 2024-08-21 09:11+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.0.1\n"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.view_order_form
msgid "<span class=\"o_stat_text\">Planning</span>"
msgstr "<span class=\"o_stat_text\">Planificación</span>"

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order__any_service_line
msgid "Any Service Line"
msgstr "Cualquier línea de servicio"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Assignees"
msgstr "Asignados"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "End"
msgstr "Fin"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Planning"
msgstr "Planificación"

#. module: sale_timesheet_timeline
#: model:ir.model,name:sale_timesheet_timeline.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"

#. module: sale_timesheet_timeline
#: model:ir.model,name:sale_timesheet_timeline.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"

#. module: sale_timesheet_timeline
#: model:ir.actions.act_window,name:sale_timesheet_timeline.action_sale_order_line_timeline
msgid "Sales Tasks Planning"
msgstr "Planificación de tareas de ventas"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Start"
msgstr "Inicio"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Task"
msgstr "Tarea"

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_user_ids
msgid "Task Assignees"
msgstr "Asignados a la tarea"

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_date_end
msgid "Task End"
msgstr "Fin de tarea"

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_date_start
msgid "Task Start"
msgstr "Comienzo de tarea"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.view_sale_order_line_timeline
msgid "User"
msgstr "Usuario"
86 changes: 86 additions & 0 deletions sale_timesheet_timeline/i18n/sale_timesheet_timeline.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_timesheet_timeline
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-21 07:09+0000\n"
"PO-Revision-Date: 2024-08-21 07:09+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.view_order_form
msgid "<span class=\"o_stat_text\">Planning</span>"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order__any_service_line
msgid "Any Service Line"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Assignees"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "End"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Planning"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model,name:sale_timesheet_timeline.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model,name:sale_timesheet_timeline.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.actions.act_window,name:sale_timesheet_timeline.action_sale_order_line_timeline
msgid "Sales Tasks Planning"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Start"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.sale_order_portal_content
msgid "Task"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_user_ids
msgid "Task Assignees"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_date_end
msgid "Task End"
msgstr ""

#. module: sale_timesheet_timeline
#: model:ir.model.fields,field_description:sale_timesheet_timeline.field_sale_order_line__task_date_start
msgid "Task Start"
msgstr ""

#. module: sale_timesheet_timeline
#: model_terms:ir.ui.view,arch_db:sale_timesheet_timeline.view_sale_order_line_timeline
msgid "User"
msgstr ""
3 changes: 3 additions & 0 deletions sale_timesheet_timeline/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import sale_order
42 changes: 42 additions & 0 deletions sale_timesheet_timeline/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import Command, fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

any_service_line = fields.Boolean(compute="_compute_any_service_line")

def _compute_any_service_line(self):
for record in self:
record.any_service_line = any(
[x.product_type == "service" for x in record.order_line]
)


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

task_date_start = fields.Datetime("Task Start")
task_date_end = fields.Datetime("Task End")
task_user_ids = fields.Many2many(
comodel_name="res.users",
string="Task Assignees",
copy=True,
context={"active_test": False},
domain="[('share', '=', False), ('active', '=', True)]",
)

def _timesheet_create_task_prepare_values(self, project):
# Transfer dates and assignees from sales order line
res = super()._timesheet_create_task_prepare_values(project)
if self.task_date_start:
res["planned_date_start"] = self.task_date_start
if self.task_date_end:
res["planned_date_end"] = self.task_date_end
res["date_deadline"] = self.task_date_end
if self.task_user_ids:
res["user_ids"] = [Command.link(x.id) for x in self.task_user_ids]
return res
3 changes: 3 additions & 0 deletions sale_timesheet_timeline/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
7 changes: 7 additions & 0 deletions sale_timesheet_timeline/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module allows to plan in advance the start/end dates and assignees for the sales
order lines that are services, and they are transferred to the created task (if any)
when confirming the order.

It includes a timeline view for pre-viewing and managing the planning.

In addition, this planning is shown in the order portal view.
1 change: 1 addition & 0 deletions sale_timesheet_timeline/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Timeline visualization in portal.
8 changes: 8 additions & 0 deletions sale_timesheet_timeline/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#. Go to Sales > Orders > Quotations
#. Create a new record.
#. Add a line with a product of type "Service".
#. A new smart-button "Planning" will appear.
#. On optional fields, you will find 3 fields for setting manually the planning data:
"Task Start", "Task End" and "Task Assignees".
#. You can also click on the "Planning" button and plan the dates visually in the
timeline view.
Loading

0 comments on commit 1923381

Please sign in to comment.