Skip to content

Commit

Permalink
TA#22989 add module show_project_artwork (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddufresne authored Mar 18, 2021
1 parent 7d91782 commit 25b36ce
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 0 deletions.
1 change: 1 addition & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"show_place",
"show_project",
"show_project_access",
"show_project_artwork",
"show_project_fee",
"show_project_promotion",
"show_project_role",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ COPY recording_version /mnt/extra-addons/recording_version
COPY show_place /mnt/extra-addons/show_place
COPY show_project /mnt/extra-addons/show_project
COPY show_project_access /mnt/extra-addons/show_project_access
COPY show_project_artwork /mnt/extra-addons/show_project_artwork
COPY show_project_fee /mnt/extra-addons/show_project_fee
COPY show_project_promotion /mnt/extra-addons/show_project_promotion
COPY show_project_role /mnt/extra-addons/show_project_role
Expand Down
38 changes: 38 additions & 0 deletions show_project_artwork/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Show Project Artwork
====================

This module adds a tab of projects.

This tab allows to link ``Musical Artworks`` to projects.

Tour Projects
-------------
I go to the form view of a project of type ``Tour``.

I notice a new tab ``Artworks``.

.. image:: static/description/tour_form.png

I can link artworks to the project.

.. image:: static/description/tour_form_with_artworks.png

Show Projects
-------------
I create a new project of type ``Show`` and select a tour as parent.

.. image:: static/description/show_form.png

I notice that the artworks were propagated from the parent tour.

.. image:: static/description/show_form_artworks_propagated.png

I can optionnaly add or remove artworks from the show.

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)

More information
----------------
* Meet us at https://bit.ly/numigi-com
4 changes: 4 additions & 0 deletions show_project_artwork/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2021 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
15 changes: 15 additions & 0 deletions show_project_artwork/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# © 2021 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Show Project Artwork",
"summary": "Add promotion tab to projects",
"version": "1.0.0",
"website": "https://bit.ly/numigi-com",
"author": "Numigi",
"maintainer": "Numigi",
"license": "AGPL-3",
"installable": True,
"depends": ["show_project", "musical_artwork"],
"data": ["views/project_project.xml"],
}
27 changes: 27 additions & 0 deletions show_project_artwork/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * show_project_artwork
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-18 17:54+0000\n"
"PO-Revision-Date: 2021-03-18 17:54+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: show_project_artwork
#: model:ir.model.fields,field_description:show_project_artwork.field_project_project__artwork_ids
#: model_terms:ir.ui.view,arch_db:show_project_artwork.project_form
msgid "Artworks"
msgstr "Œuvres"

#. module: show_project_artwork
#: model:ir.model,name:show_project_artwork.model_project_project
msgid "Project"
msgstr ""
4 changes: 4 additions & 0 deletions show_project_artwork/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2021 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import project_project
22 changes: 22 additions & 0 deletions show_project_artwork/models/project_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# © 2021 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class ProjectProject(models.Model):

_inherit = "project.project"

artwork_ids = fields.Many2many(
"musical.artwork",
"project_musical_artwork_rel",
"project_id",
"artwork_id",
"Artworks",
)

@api.onchange("parent_id")
def _onchange_parent_propagate_artworks(self):
if self.parent_id and self.show_type == "show":
self.artwork_ids = self.parent_id.artwork_ids
Binary file added show_project_artwork/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions show_project_artwork/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# © 2021 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
23 changes: 23 additions & 0 deletions show_project_artwork/tests/test_show_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# © 2021 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import SavepointCase


class TestShowProject(SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.artwork_1 = cls.env["musical.artwork"].create({"title": "Artwork 1"})
cls.artwork_2 = cls.env["musical.artwork"].create({"title": "Artwork 2"})
cls.tour = cls.env["project.project"].create(
{"name": "Tour Project 1", "show_type": "tour"}
)
cls.tour.artwork_ids = cls.artwork_1 | cls.artwork_2
cls.show = cls.env["project.project"].create(
{"name": "Show Project 1", "show_type": "show", "parent_id": cls.tour.id}
)

def test_artwork_propagation(self):
self.show._onchange_parent_propagate_artworks()
assert self.show.artwork_ids == self.artwork_1 | self.artwork_2
25 changes: 25 additions & 0 deletions show_project_artwork/views/project_project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<record id="project_form" model="ir.ui.view">
<field name="name">Project Form: add Artworks tab</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="show_project.project_form"/>
<field name="arch" type="xml">
<page name="show_venue" position="before">
<page
string="Artworks"
name="artworks"
attrs="{'invisible': [('show_type', 'not in', ('tour', 'show'))]}"
>
<field name="artwork_ids" nolabel="1">
<tree>
<field name="display_name"/>
</tree>
</field>
</page>
</page>
</field>
</record>

</odoo>

0 comments on commit 25b36ce

Please sign in to comment.