Skip to content

Commit ecb3978

Browse files
author
docker-odoo
committed
Merge commit 'refs/pull/1205/head' of https://github.com/oca/pos into 16.0-9288
2 parents f808797 + d6a1b82 commit ecb3978

File tree

90 files changed

+6790
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6790
-0
lines changed

pos_event_sale/README.rst

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
====================
2+
Point of Sale Events
3+
====================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
17+
:target: https://github.com/OCA/pos/tree/15.0/pos_event_sale
18+
:alt: OCA/pos
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_event_sale
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/184/15.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
Sell events tickets from the Point of Sale
29+
30+
**Table of contents**
31+
32+
.. contents::
33+
:local:
34+
35+
Configuration
36+
=============
37+
38+
Go to *Point of Sale > Configuration > Point of Sale* and enable *Sell Events*
39+
on the desired PoS.
40+
41+
Optionally, you can choose to filter on a list of Event Types.
42+
43+
Enable *Available in PoS* on all event products related to event tickets you
44+
want to sell in PoS. If the ticket product is not available on the pos,
45+
the ticket won't be available neither.
46+
47+
Usage
48+
=====
49+
50+
51+
- Click on the Add Event button, or on any Event product.
52+
53+
.. image:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_event_sale/static/description/add_event_button.png
54+
55+
- Use the calendar widget to filter the events, and click on one.
56+
57+
.. image:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_event_sale/static/description/event_calendar.png
58+
59+
- Add as many Tickets as you want
60+
61+
.. image:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_event_sale/static/description/ticket_selector.png
62+
63+
Known issues / Roadmap
64+
======================
65+
66+
67+
* Handle event registration details. It could be another popup right
68+
before going to payment (similar to core `event_sale` workflow).
69+
70+
Bug Tracker
71+
===========
72+
73+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_.
74+
In case of trouble, please check there if your issue has already been reported.
75+
If you spotted it first, help us smashing it by providing a detailed and welcomed
76+
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_event_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
77+
78+
Do not contact contributors directly about support or help with technical issues.
79+
80+
Credits
81+
=======
82+
83+
Authors
84+
~~~~~~~
85+
86+
* Camptocamp
87+
88+
Contributors
89+
~~~~~~~~~~~~
90+
91+
* `Camptocamp <https://www.camptocamp.com>`_
92+
93+
* Iván Todorovich <[email protected]>
94+
95+
* `Moka Tourisme <https://www.mokatourisme.fr>`_
96+
97+
* Grégory Schreiner <[email protected]>
98+
99+
Maintainers
100+
~~~~~~~~~~~
101+
102+
This module is maintained by the OCA.
103+
104+
.. image:: https://odoo-community.org/logo.png
105+
:alt: Odoo Community Association
106+
:target: https://odoo-community.org
107+
108+
OCA, or the Odoo Community Association, is a nonprofit organization whose
109+
mission is to support the collaborative development of Odoo features and
110+
promote its widespread use.
111+
112+
.. |maintainer-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px
113+
:target: https://github.com/ivantodorovich
114+
:alt: ivantodorovich
115+
116+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
117+
118+
|maintainer-ivantodorovich|
119+
120+
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/15.0/pos_event_sale>`_ project on GitHub.
121+
122+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

pos_event_sale/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .hooks import post_init_hook, pre_init_hook
2+
from . import models
3+
from . import reports

pos_event_sale/__manifest__.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2021 Camptocamp (https://www.camptocamp.com).
2+
# @author Iván Todorovich <[email protected]>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Point of Sale Events",
7+
"summary": "Sell events from Point of Sale",
8+
"author": "Camptocamp, Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/pos",
10+
"category": "Marketing",
11+
"version": "16.0.1.0.0",
12+
"license": "AGPL-3",
13+
"maintainers": ["ivantodorovich"],
14+
"depends": ["event_sale", "point_of_sale"],
15+
"data": [
16+
"security/security.xml",
17+
"reports/report_pos_order.xml",
18+
"views/event_registration.xml",
19+
"views/event_event.xml",
20+
"views/pos_order.xml",
21+
"views/res_config_settings.xml",
22+
],
23+
"assets": {
24+
"point_of_sale.assets": [
25+
"web/static/lib/fullcalendar/core/main.css",
26+
"web/static/lib/fullcalendar/daygrid/main.css",
27+
"web/static/lib/fullcalendar/core/main.js",
28+
"web/static/lib/fullcalendar/daygrid/main.js",
29+
"web/static/lib/fullcalendar/interaction/main.js",
30+
"pos_event_sale/static/src/js/**/*.js",
31+
"pos_event_sale/static/src/scss/**/*.scss",
32+
"pos_event_sale/static/src/xml/**/*.xml",
33+
],
34+
"web.assets_tests": [
35+
"pos_event_sale/static/tests/tours/**/*",
36+
],
37+
},
38+
"pre_init_hook": "pre_init_hook",
39+
"post_init_hook": "post_init_hook",
40+
}

pos_event_sale/hooks.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2022 Moka Tourisme (https://www.mokatourisme.fr).
2+
# @author Iván Todorovich <[email protected]>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
import logging
6+
7+
from odoo import SUPERUSER_ID, api
8+
from odoo.tools.sql import column_exists, create_column
9+
10+
_logger = logging.getLogger(__name__)
11+
12+
13+
def pre_init_hook(cr):
14+
"""Store currency_id in database for each existing pos_order_line"""
15+
if not column_exists(cr, "pos_order_line", "currency_id"):
16+
_logger.info("Pre-computing pos.order.line.currency_id..")
17+
create_column(cr, "pos_order_line", "currency_id", "int4")
18+
cr.execute(
19+
"""
20+
WITH pos_order_line_currency AS (
21+
SELECT
22+
pol.id AS id,
23+
COALESCE(aj.currency_id, rc.currency_id) AS currency_id
24+
FROM pos_order_line AS pol
25+
JOIN pos_order AS po ON pol.order_id = po.id
26+
JOIN pos_session AS ps ON po.session_id = ps.id
27+
JOIN pos_config AS pc ON ps.config_id = pc.id
28+
JOIN res_company AS rc ON pc.company_id = rc.id
29+
LEFT JOIN account_journal AS aj ON pc.journal_id = aj.id
30+
)
31+
UPDATE pos_order_line
32+
SET currency_id = pos_order_line_currency.currency_id
33+
FROM pos_order_line_currency
34+
WHERE pos_order_line.id = pos_order_line_currency.id
35+
"""
36+
)
37+
38+
39+
def post_init_hook(cr, __):
40+
"""Set the Event Registration product available for POS"""
41+
env = api.Environment(cr, SUPERUSER_ID, {})
42+
product = env.ref("event_sale.product_product_event", raise_if_not_found=False)
43+
if product:
44+
_logger.info("Setting default Event Product as available in Point of Sale..")
45+
product.available_in_pos = True

0 commit comments

Comments
 (0)