-
Notifications
You must be signed in to change notification settings - Fork 1
[16.0] [MIG] queue_management_display: Migration to 16.0 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
21d4ded
[ADD] queue_management_display: add new module
kluna1998 ff6e9a6
[ADD] queue_management_display: Connection with RaspBerry
kluna1998 afe1979
[ADD] queue_management_display: Change Data Source Display
kluna1998 c80ba51
[IMP] queue_management_display: improvement call button
kluna1998 be3bf37
[ADD] queue_mamagement_display: add template selection for a new display
kluna1998 94acd9b
[IMP] queue_management_display: add demo data
kluna1998 b51fd21
[FIX] queue_management_display: Fix active_id
etobella 932c180
[IMP] queue_management_display
etobella fff6aad
[FIX] queue_management_display: Fix permissions
etobella 92fdabb
[IMP] queue_management_display: Fixing bugs
etobella f6f08fc
[FIX] queue_management_display: Fix actions
etobella 24fad5d
[FIX] queue_management_display: do not check location if multiple tok…
etobella 14a24b9
[IMP] queue_management_display: Add display description
etobella 1e9f2d8
[IMP] queue_management_display: pre-commit auto fixes
luisDIXMIT fa86700
[MIG] queue_management_display: Migration to 16.0
luisDIXMIT e313db0
[MIG] queue_management_display: Finish migration of OWL
etobella de3330d
[FIX] queue_management: Fix views
etobella 0832ece
[FIX] Update from template
etobella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,6 @@ | |
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| <div class="oe_chatter" /> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
| :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
|
|
||
| ======================== | ||
| Queue Management Display | ||
| ======================== | ||
|
|
||
| Management of queue displays |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright 2022 CreuBlanca | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "Queue Management Display", | ||
| "version": "16.0.1.0.0", | ||
| "license": "AGPL-3", | ||
| "website": "https://github.com/tegin/kiwi", | ||
| "author": "CreuBlanca", | ||
| "depends": ["queue_management", "bus", "base_sparse_field"], | ||
| "data": [ | ||
| "views/queue_token_location.xml", | ||
| "views/queue_location.xml", | ||
| "security/ir.model.access.csv", | ||
| "views/queue_display.xml", | ||
| "views/queue_management.xml", | ||
| ], | ||
| # "qweb": ["static/src/xml/queue_management.xml"], | ||
| "demo": ["demo/data.xml"], | ||
| "assets": { | ||
| "web.assets_backend": [ | ||
| "/queue_management_display/static/src/**/*.esm.js", | ||
| "/queue_management_display/static/src/**/*.xml", | ||
| "/queue_management_display/static/src/**/*.scss", | ||
| ] | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright 2022 CreuBlanca | ||
| License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
| <odoo noupdate="1"> | ||
| <record id="queue_display_demo_1" model="queue.display"> | ||
| <field name="name">Display DEMO</field> | ||
| <field name="description">Display CreuBlanca</field> | ||
| <field | ||
| name="location_ids" | ||
| eval="[(4,ref('queue_management.queue_location_demo_1')), | ||
| (4,ref('queue_management.queue_location_demo_2'))]" | ||
| /> | ||
| </record> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| from . import queue_display | ||
| from . import queue_location | ||
| from . import queue_token_location | ||
| from . import queue_location_group | ||
| from . import queue_token_location_action | ||
| from . import ir_websocket |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import re | ||
|
|
||
| from odoo import models | ||
| from odoo.exceptions import AccessDenied | ||
|
|
||
|
|
||
| class IrWebsocket(models.AbstractModel): | ||
| _inherit = "ir.websocket" | ||
|
|
||
| def _build_bus_channel_list(self, channels): | ||
| if self.env.uid: | ||
| # Do not alter original list. | ||
| channels = list(channels) | ||
| for channel in channels: | ||
| if isinstance(channel, str): | ||
| match = re.match(r"queue.display:(\d+)", channel) | ||
| if match: | ||
| res_id = int(match[1]) | ||
|
|
||
| # Verify access to the edition channel. | ||
| if not self.env.user._is_internal(): | ||
| raise AccessDenied() | ||
|
|
||
| document = self.env["queue.display"].browse([res_id]) | ||
| if not document.exists(): | ||
| continue | ||
|
|
||
| document.check_access_rights("read") | ||
| document.check_access_rule("read") | ||
| document.check_access_rights("write") | ||
| document.check_access_rule("write") | ||
|
|
||
| channels.append( | ||
| (self.env.registry.db_name, document._name, document.id) | ||
| ) | ||
| return super()._build_bus_channel_list(channels) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # Copyright 2022 CreuBlanca | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from datetime import timedelta | ||
|
|
||
| from lxml import etree | ||
|
|
||
| from odoo import api, fields, models | ||
|
|
||
|
|
||
| class QueueDisplay(models.Model): | ||
|
|
||
| _name = "queue.display" | ||
| _description = "Queue Display" # TODO | ||
|
|
||
| name = fields.Char() | ||
| description = fields.Text() | ||
| location_ids = fields.Many2many("queue.location") | ||
| show_items = fields.Integer(default=10) | ||
| max_time = fields.Float(default=24) # Time maximum | ||
| shiny_time = fields.Float(default=0.05) # By default, 3 minutes | ||
| items = fields.Serialized(compute="_compute_items") | ||
| kind = fields.Selection( | ||
| [("notification", "Notification screen"), ("control", "Control Screen")], | ||
| default="notification", | ||
| required=True, | ||
| ) | ||
| qweb = fields.Text(default=lambda r: r._default_qweb()) | ||
| parsed_qweb = fields.Html(compute="_compute_parsed_qweb") | ||
| css = fields.Text() | ||
| audio_file = fields.Binary() | ||
| audio_filename = fields.Char() | ||
|
|
||
| def get_data(self): | ||
| self.ensure_one() | ||
| return { | ||
| "id": self.id, | ||
| "name": self.name, | ||
| "description": self.description, | ||
| "parsed_qweb": self.parsed_qweb, | ||
| "items": self.items, | ||
| "css": self.css, | ||
| "audio_file": self.audio_file, | ||
| "shiny_time": self.shiny_time, | ||
| "max_time": self.max_time, | ||
| "show_items": self.show_items, | ||
| } | ||
|
|
||
| @api.depends("qweb") | ||
| def _compute_parsed_qweb(self): | ||
| qweb = self.env["ir.qweb"] | ||
| for record in self: | ||
| record.parsed_qweb = qweb._render( | ||
| etree.fromstring(record.qweb), {"data": self} | ||
| ) | ||
|
|
||
| def _default_qweb(self): | ||
| return """ | ||
| <div class="row o_queue_management_display_header"> | ||
| <div class="col-2 queue_logo"> | ||
| <img t-attf-src="/logo.png?company=#{company_id}" t-attf-alt="#{company}" /> | ||
| </div> | ||
| <div class="col-8 o_queue_management_display_header_title"> | ||
| <h1 t-esc="data.description" /> | ||
| </div> | ||
| <div class="col-2 o_queue_management_display_header_datetime"> | ||
| <div class="o_queue_management_display_header_clock" /> | ||
| </div> | ||
| </div> | ||
| <div class="row o_queue_management_display_body"> | ||
| <div class="col-4 o_queue_management_display_body_content"> | ||
| <div class="o_queue_management_display_body_content_header row"> | ||
| <t t-call="queue_management_display.queue_display_token"> | ||
| <t t-set="token">Token</t> | ||
| <t t-set="location">Location</t> | ||
| </t> | ||
|
|
||
| </div> | ||
| <div class="o_queue_management_display_body_content_body row" /> | ||
| </div> | ||
| <div class="col-8 o_queue_management_display_advertising"> | ||
| <!-- TODO: Add your video here --> | ||
| </div> | ||
| </div> | ||
| <div class="row o_queue_management_display_footer"> | ||
| <!-- TODO: Add Your Social Media data here --> | ||
| </div> | ||
| """ | ||
|
|
||
| def open_display(self): | ||
| """ | ||
| Open XML id depending on wich type os self.kind you have choosed. | ||
| """ | ||
| self.ensure_one() | ||
| action = self.env["ir.actions.act_window"]._for_xml_id( | ||
| "queue_management_display.queue_display_fullscreen_%s_act_window" | ||
| % self.kind | ||
| ) | ||
| action["res_id"] = self.id | ||
| return action | ||
|
|
||
| @api.depends() | ||
| def _compute_items(self): | ||
| for record in self: | ||
| record.items = {"tokens": record._get_display_tokens()} | ||
|
|
||
| def _get_display_tokens(self): | ||
| actions = self.env["queue.token.location.action"].search( | ||
| [ | ||
| ("location_id", "in", self.location_ids.ids), | ||
| ( | ||
| "date", | ||
| ">", | ||
| fields.Datetime.now() + timedelta(hours=-self.max_time), | ||
| ), | ||
| ("action", "=", "call"), | ||
| ], | ||
| order="date desc", | ||
| ) | ||
| token_locations = self.env["queue.token.location"] | ||
| final_actions = self.env["queue.token.location.action"] | ||
| for action in actions: | ||
| if action.token_location_id not in token_locations: | ||
| token_locations |= action.token_location_id | ||
| final_actions |= action | ||
| if len(token_locations) >= self.show_items: | ||
| break | ||
| return [ | ||
| { | ||
| "id": action.token_location_id.id, | ||
| "token": action.token_id.name, | ||
| "location": action.location_id.display_description | ||
| or action.location_id.name, | ||
| "last_call": fields.Datetime.to_string(action.date), | ||
| "last_call_int": action.date.timestamp(), | ||
| } | ||
| for action in final_actions | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Copyright 2022 CreuBlanca | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class QueueLocation(models.Model): | ||
|
|
||
| _inherit = "queue.location" | ||
|
|
||
| display_ids = fields.Many2many("queue.display") | ||
| display_description = fields.Char() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Copyright 2022 CreuBlanca | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import models | ||
|
|
||
|
|
||
| class QueueLocationGroup(models.Model): | ||
|
|
||
| _inherit = "queue.location.group" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He eliminado la carpeta templates que contenía assets.xml y los he añadido aquí. No se si la estructura de static/src es la correcta. WDYT?