-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] pos_event_registration: reimplement module from scratch
- Loading branch information
Showing
15 changed files
with
747 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,85 @@ | ||
======================== | ||
Register Event Attendees | ||
======================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:08590e08c3c68789632c46cdc7ca9fa7e784bbd2f83e1b5929113a77a96492e3 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-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-it--projects--llc%2Fpos--addons-lightgray.png?logo=github | ||
:target: https://github.com/it-projects-llc/pos-addons/tree/17.0/pos_event_registration | ||
:alt: it-projects-llc/pos-addons | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
Sell Tickets via POS | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
- Open "Point of Sale" -> Products -> Products | ||
|
||
- Choose any product or create new one | ||
|
||
- In "Sale" tab | ||
|
||
- Enable "Available in POS" | ||
- Set "Category", which products will be used in POS | ||
- Set "Linked Event" | ||
- Set "Linked Event Ticket" | ||
|
||
- Save | ||
|
||
Usage | ||
===== | ||
|
||
- Open "Point of Sale" | ||
- Open any "POS" | ||
- Choose "Customer" | ||
- Sell product with assigned event ticket | ||
- RESULT: event registration with chosen customer is created | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/it-projects-llc/pos-addons/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/it-projects-llc/pos-addons/issues/new?body=module:%20pos_event_registration%0Aversion:%2017.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 | ||
------- | ||
|
||
* IT-Projects LLC | ||
|
||
Contributors | ||
------------ | ||
|
||
- Eugene Molotov (https://github.com/em230418) | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is part of the `it-projects-llc/pos-addons <https://github.com/it-projects-llc/pos-addons/tree/17.0/pos_event_registration>`_ project on GitHub. | ||
|
||
You are welcome to contribute. |
This file contains 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 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,15 @@ | ||
{ | ||
"name": "Register Event Attendees", | ||
"summary": "Process Attendees and Sell Tickets via POS", | ||
"category": "Point of Sale", | ||
"version": "17.0.0.1.0", | ||
"author": "IT-Projects LLC", | ||
"support": "[email protected]", | ||
"website": "https://github.com/it-projects-llc/pos-addons", | ||
"license": "LGPL-3", | ||
"depends": [ | ||
"point_of_sale", | ||
"event_sale", | ||
], | ||
"data": ["views/product_view.xml"], | ||
} |
This file contains 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,2 @@ | ||
from . import product_template | ||
from . import pos_order |
This file contains 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,49 @@ | ||
import logging | ||
|
||
from odoo import api, models | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class PosOrder(models.Model): | ||
_inherit = "pos.order" | ||
|
||
@api.model | ||
def _process_order(self, *args, **kw): | ||
order_id = super()._process_order(*args, **kw) | ||
order = self.env["pos.order"].sudo().browse(order_id) | ||
partner = order.partner_id | ||
Registrations = self.env["event.registration"].sudo() | ||
|
||
event_products = order.lines.filtered("product_id.pos_event_ticket").mapped( | ||
"product_id" | ||
) | ||
|
||
if not event_products: | ||
return order_id | ||
|
||
for line in order.lines: | ||
product = line.product_id | ||
if product not in event_products: | ||
continue | ||
|
||
ticket = product.pos_event_ticket | ||
|
||
qty = int(line.qty) | ||
for i in range(qty): | ||
name = not i and partner.name or partner.name + " person " + str(i + 1) | ||
vals = { | ||
"event_id": ticket.event_id.id, | ||
"partner_id": partner.id, | ||
"event_ticket_id": product.pos_event_ticket.id, | ||
"email": partner.email, | ||
"name": name, | ||
"state": "open", | ||
} | ||
_logger.info("Creating Attendee with vals %s", vals) | ||
if "attendee_partner_id" in Registrations._fields: | ||
vals["attendee_partner_id"] = partner.id | ||
|
||
Registrations.create(vals) | ||
|
||
return order.id |
This file contains 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,16 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
pos_event = fields.Many2one("event.event", string="Linked Event") | ||
pos_event_ticket = fields.Many2one( | ||
"event.event.ticket", | ||
string="Linked Event Ticket", | ||
help="When customer buys this product in POS, he is automatically registered as attendee with given ticket", # noqa: E501 | ||
) | ||
|
||
@api.onchange("pos_event") | ||
def _onchange_pos_event(self): | ||
self.update({"pos_event_ticket": False}) |
This file contains 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,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains 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,10 @@ | ||
- Open "Point of Sale" -> Products -> Products | ||
- Choose any product or create new one | ||
- In "Sale" tab | ||
|
||
* Enable "Available in POS" | ||
* Set "Category", which products will be used in POS | ||
* Set "Linked Event" | ||
* Set "Linked Event Ticket" | ||
|
||
- Save |
This file contains 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 @@ | ||
- Eugene Molotov (https://github.com/em230418) |
This file contains 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 @@ | ||
Sell Tickets via POS |
This file contains 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,5 @@ | ||
- Open "Point of Sale" | ||
- Open any "POS" | ||
- Choose "Customer" | ||
- Sell product with assigned event ticket | ||
- RESULT: event registration with chosen customer is created |
Oops, something went wrong.