Skip to content

Commit

Permalink
Merge PR OCA#1196 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by rafaelbn
  • Loading branch information
OCA-git-bot committed Jan 10, 2024
2 parents db2285f + 357e2b2 commit b31cadc
Show file tree
Hide file tree
Showing 18 changed files with 999 additions and 0 deletions.
113 changes: 113 additions & 0 deletions project_sale_order_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
=======================
Project Sale Order Link
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b2179f3be8466974a70b11a42b3e9a62e60356bed6f50fd9d668f280841b48bc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/15.0/project_sale_order_link
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-15-0/project-15-0-project_sale_order_link
: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/project&target_branch=15.0
:alt: Try me on Runboat

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

This module is glue module that allow you to see all order linked to project, project tasks or employee map.

Now you have 2 available fields referencing related sale orders and sale order lines on each project.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

Currently a sales order can be linked to a project in the following ways:

* A sale order item is selected in project.
* A sale order item is selected in project task.
* A sale order item is selected in timesheet.
* A sale order item is selected in sale line/Employee map

But in the project you can only see the selected order in the project itself.

Usage
=====

To use this module, you need to:

#. Go to Project > Configuration > Projects.
#. Click on a project.
#. Click on Smartbutton to see sale orders linked.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/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/project/issues/new?body=module:%20project_sale_order_link%0Aversion:%2015.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
~~~~~~~

* Moduon

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

* Emilio Pascual (`Moduon <https://www.moduon.team/>`__)
* Rafael Blasco (`Moduon <https://www.moduon.team/>`__)

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.

.. |maintainer-EmilioPascual| image:: https://github.com/EmilioPascual.png?size=40px
:target: https://github.com/EmilioPascual
:alt: EmilioPascual

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-EmilioPascual|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions project_sale_order_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions project_sale_order_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

{
"name": "Project Sale Order Link",
"summary": "Sales order linked to project, tasks or employee map",
"version": "15.0.1.0.0",
"development_status": "Alpha",
"category": "Project",
"website": "https://github.com/OCA/project",
"author": "Moduon, Odoo Community Association (OCA)",
"maintainers": ["EmilioPascual"],
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"sale_timesheet",
],
"data": [
"views/project_views.xml",
],
}
38 changes: 38 additions & 0 deletions project_sale_order_link/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_sale_order_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-13 15:39+0000\n"
"PO-Revision-Date: 2023-11-13 16:42+0100\n"
"Last-Translator: Emilio Pascual <emilio@moduom.team>\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: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4\n"

#. module: project_sale_order_link
#: model:ir.model.fields,field_description:project_sale_order_link.field_project_project__order_line_link_ids
msgid "Order Line Link"
msgstr "Links Item Pedido de Venta"

#. module: project_sale_order_link
#: model:ir.model,name:project_sale_order_link.model_project_project
msgid "Project"
msgstr "Proyecto"

#. module: project_sale_order_link
#: model:ir.model.fields,field_description:project_sale_order_link.field_project_project__sale_order_link_ids
msgid "Sale Order Link"
msgstr "Links Pedidos de Venta"

#. module: project_sale_order_link
#: model_terms:ir.ui.view,arch_db:project_sale_order_link.edit_project_inherit_project_sale_order_link
msgid "Sales Order Linked"
msgstr "Pedido de Venta Relacionado"
36 changes: 36 additions & 0 deletions project_sale_order_link/i18n/project_sale_order_link.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_sale_order_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-13 15:39+0000\n"
"PO-Revision-Date: 2023-11-13 15:39+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: project_sale_order_link
#: model:ir.model.fields,field_description:project_sale_order_link.field_project_project__order_line_link_ids
msgid "Order Line Link"
msgstr ""

#. module: project_sale_order_link
#: model:ir.model,name:project_sale_order_link.model_project_project
msgid "Project"
msgstr ""

#. module: project_sale_order_link
#: model:ir.model.fields,field_description:project_sale_order_link.field_project_project__sale_order_link_ids
msgid "Sale Order Link"
msgstr ""

#. module: project_sale_order_link
#: model_terms:ir.ui.view,arch_db:project_sale_order_link.edit_project_inherit_project_sale_order_link
msgid "Sales Order Linked"
msgstr ""
1 change: 1 addition & 0 deletions project_sale_order_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import project
59 changes: 59 additions & 0 deletions project_sale_order_link/models/project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2023 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)


from odoo import api, fields, models


class Project(models.Model):
_inherit = "project.project"

order_line_link_ids = fields.Many2many(
"sale.order.line",
"project_project_sale_order_line_related_rel",
compute="_compute_order_link_ids",
compute_sudo=True,
store=True,
)
sale_order_link_ids = fields.Many2many(
"sale.order",
"project_project_sale_order_related_rel",
compute="_compute_order_link_ids",
compute_sudo=True,
store=True,
)

@api.depends(
"sale_line_id",
"task_ids.sale_line_id",
"timesheet_ids.so_line",
"sale_line_employee_ids.sale_line_id",
)
def _compute_order_link_ids(self):
for project in self:
order_lines = self.env["sale.order.line"]
order_lines |= (
project.sale_line_id
| project.task_ids.sale_line_id
| project.timesheet_ids.so_line
| project.sale_line_employee_ids.sale_line_id
)
project.order_line_link_ids = order_lines.ids
project.sale_order_link_ids = order_lines.order_id.ids

def action_view_so_link(self):
self.ensure_one()
so_ids = self.with_context().sale_order_link_ids.ids
action_window = {
"type": "ir.actions.act_window",
"res_model": "sale.order",
"name": "Sales Order",
"views": [[False, "tree"], [False, "form"]],
"context": {"create": False, "show_sale": True},
"domain": [["id", "in", so_ids]],
}
if len(so_ids) == 1:
action_window["views"] = [[False, "form"]]
action_window["res_id"] = so_ids[0]

return action_window
8 changes: 8 additions & 0 deletions project_sale_order_link/readme/CONTEXT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Currently a sales order can be linked to a project in the following ways:

* A sale order item is selected in project.
* A sale order item is selected in project task.
* A sale order item is selected in timesheet.
* A sale order item is selected in sale line/Employee map

But in the project you can only see the selected order in the project itself.
2 changes: 2 additions & 0 deletions project_sale_order_link/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Emilio Pascual (`Moduon <https://www.moduon.team/>`__)
* Rafael Blasco (`Moduon <https://www.moduon.team/>`__)
3 changes: 3 additions & 0 deletions project_sale_order_link/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module is glue module that allow you to see all order linked to project, project tasks or employee map.

Now you have 2 available fields referencing related sale orders and sale order lines on each project.
5 changes: 5 additions & 0 deletions project_sale_order_link/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

#. Go to Project > Configuration > Projects.
#. Click on a project.
#. Click on Smartbutton to see sale orders linked.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b31cadc

Please sign in to comment.