Commit Graph
25 Commits
Author SHA1 Message Date
David Monnom (moda) 808a73742c [IMP] pos_self_order: improve qr code PDF
In order to improve the self order user experience, QR code generation
has been improved. Now, the user can reset the access_token linked to
the QR code and then regenerate them, he can also redownload the QR code
whenever he wishes.

The content of the QR code PDF has also been changed. Now, for each
table a QR code is generated and inserted in the PDF with the name of
the table and its unique identifier (access_token).

closes odoo/odoo#129100

Taskid: 3377335
Related: odoo/upgrade#4958
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-08-21 14:14:47 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Joseph Caburnay e628b6507f [FIX] pos_{online_payment_}self_order: price based on company taxes
**Steps to reproduce:**

- Install pos_self_order.
- Create a product with a price of any price, say 100.
- Assign a tax of 10% to the product.
- Create a new company and switch to it.
- With the same product, add a new tax, say 20%.
- Go back to the original company.
- Open a bar (restaurant pos.config) that allows self order which also loads the
  product.
- Open self order page and add the product.
- [BUG] The product's price is not only 10%-taxed, but also 20%-taxed.

**Explanation and fix**

The issue is caused by use of sudo almost everywhere in the context of
pos_self_order. This commit removes/reduces this use of sudo in many places and
contextualize the records involved in the calculation such as pos.config,
product.product, etc. to be the ones of the company and the user who opened the
current pos.session.

After this changes, only the taxes that belong to the company of the pos.config
record are used in the price and tax calculations.

closes odoo/odoo#131140

X-original-commit: 7ce7f3e21ad8f457742e27f88b7146c7d8fff5f3
Signed-off-by: David Monnom (moda) <moda@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-08-08 08:56:25 +02:00
Loukas Wets (lowe) 2f69782681 [FIX] pos_self_order: condition opening product window
Nothing will happen if you click on a product without image, sale comment
and attributes in selfOder if no table was selected before.

To reproduce the issue:
1. Create a product without image, sale comment and attributes (Fill in product name, price, availible in pos)
2. Open a new selfOrder page (without a table selected)
3. Click on the product

Issue: nothing happens, the product cannot be ordered. If no product meets
at least one of the three conditions (image, sale comment or attributes),
it will not be possible to select the table, and thus self-ordering will
be impossible. In fact the table selection only happens during the first
order.

closes odoo/odoo#130614

X-original-commit: 186d60e57da5a5b0182131a936838821a01a7a5f
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-08-03 09:23:44 +02:00
Aaron Bohy 2b21fbe782 [REF] point_of_sale,pos_*: use batched from web
Part-of: odoo/odoo#114024
2023-07-24 20:17:56 +02:00
Theo VINCENT (thvi) b81a049a4e [ADD] pos_online_payment_self_order, *: add module
*: pos_self_order

Adds online payment support for self-order flow in the Point of Sale app.

 - Adds a configurable online payment method specific to the self-order flow, which is optional in "Pay after meal" mode, required in "Pay after each" mode.
The POS config of a restaurant can use 2 different online payment methods, one for the frontend cashier flow, and another for the self-order flow, or can use the same for both.
By default, if an online payment method is configured for the self-order flow, any new order paid online will be paid with that payment method.
But if the cashier requests an online payment with a different online payment method, that payment method will be used for that order during the time the cashier keeps his online payment popup open (without cancelling the online payment) (after cancelling the online payment, the order could potentially still be paid online, and if so it will use the online payment method of the self-order if one is configured, otherwise the online payment method of the cashier flow).
 - Allows the customer to open the online payment page of an order from the self-order UI.
In "Pay after meal" mode, if an online payment method is configured, the "Pay" button is displayed when the customer order is saved on the server, otherwise the "Order" button is displayed (even when the order has been sent to the server and then modified without sending it again).
Otherwise, if no online payment method is configured, the "Pay at cashier" unclickable button is displayed.
In "Pay after each" mode, the "Pay" button is displayed everytime.
 - Replaces the self_order_after_each_cart_tour test.

closes odoo/odoo#127869

Task-id: 3171698
Related: odoo/enterprise#44055
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
2023-07-20 14:22:57 +02:00
David Monnom (moda) 3afb21cc81 [IMP] pos_self_order: cancel order button
Previously, users could not cancel/delete their order once it had begun.
Only order lines not sent to the server could be deleted one by one.

Now, a "cancel" button has been added to the self shopping cart screen.
This button only appears when the order has not yet been sent to the
server. If the order has already been sent, it can only be cancelled
from a PoS.

closes odoo/odoo#128044

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2023-07-19 19:37:52 +02:00
Pierre Pulinckx (pipu) 8bfa76a842 [REF] *: Unify _t and _lt
The goal of this commit is to prepare ground to remove
lazytranslate function _lt() and keep only _t()
for a better understanding of the use of the translation function.

In this commit,

the translate function _t() has been updated to return the translation
if they are loaded. If not, it throws an error.
the lazytranslate function _lt() returns _t() function.
Corollaries :
Steps in test tours are now a function that returns an array of steps
to avoid any interpolation of _t in this ones before translations has
been loaded.

Example :

registry.category("web_tour.tours").add("example", {
    test: true,
    steps: () => [
        {...},
        {...},
    ],
});

task-3292454

closes odoo/odoo#124157

Related: odoo/enterprise#43153
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-07-19 13:13:16 +02:00
David Monnom (moda) b0668f106e [FIX] pos_self_order: some bugs fixes
- Corrected incorrect use of access_token in an order.
- Correction of order change calculation in self_order.

closes odoo/odoo#125941

Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
2023-07-13 19:28:01 +02:00
David Monnom (moda) 0a6cac7002 [IMP] pos_self_order: ux improvements
- Remove the notification and add a persistent banner at the top of the
screen when the restaurant is closed.
- Change the size of the product card to make it more compact and
smaller.
- Added a little shadow to the element fixed at the top and bottom.
- Corrected the alignment of price and quantity in the product list.
- In the card, the calculated price is now below the product list.
- The "add to cart" button is now dynamic, and will be
"remove from cart" if if the requested quantity is 0.
- Make the "my orders" button visible in meal mode and in each mode.

Part-of: odoo/odoo#125941
2023-07-13 19:28:01 +02:00
David Monnom (moda) 0ae2b9a3f2 [IMP] pos_self_order: change authorisation token
Previously, access_token were linked to tables. These tables were linked
to a floor_plan, which could be linked to several pos_configs.

The only way to access the self-order was to obtain a valid table
access_token. This behaviour was not correct because sometimes we would
allow table selection directly in the interface or commands without
a table.

Now, access_token is managed by pos_config. When a user has this token,
they can place commands and select the table they want if the option is
enabled.

closes odoo/odoo#126186

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-07-03 21:56:04 +02:00
David Monnom (moda) 2222b6911e [IMP] pos_self_order: add bus notification for self order
Previously, when an order was paid for at the restaurant counter,
the self-orderer received no update that the order had
been paid for.

Now, if the customer self-order page is still open on their phone,
it will receive a notification via websocket that the order has been
paid for from the restaurant counter.The order will no longer be
editable.

In the event that they have already closed the self-order when paying
at the counter, the next time they return to this page. An RPC request
will be made with the access_token of the old order and the
states will be aligned.

closes odoo/odoo#125921

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-27 16:26:53 +02:00
David Monnom (moda) 010b8967e1 [FIX] pos_self_order: category sequence
Correction of the order in which categories are displayed in the self
following the deletion of the "order" argument on the product search
in a previous PR.

closes odoo/odoo#125743

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-22 18:29:44 +02:00
David Monnom (moda) 52fe2ff3b7 [FIX] pos_self_order: Prevent the order from being sent twice
Added protection for the order button so that it cannot be inadvertently
clicked twice.

Part-of: odoo/odoo#125743
2023-06-22 18:29:44 +02:00
David Monnom (moda) 004affffda [IMP] pos_self_order: ux improvements
Improvement of several aspects of the self-order UX:
- Changed the sentence indicating that the self-order is menu only.
- Added a shadow to the header.
- Reduced the size of the product image in the product list.
- Reduced the size of the product title in the product list.
- Reduced the size of the product image when you are on the page to add
it to the shopping basket.
- Added a shadow above the sticky area on a product's main page.
- The quantity of a product already added to the basket has been moved
from next to the title to next to the price.
- The review button now floats above the product list and no longer has
a background colour.
- In the basket, taxes and the total are now displayed after
orderlines and no longer sticky at the bottom.
- When the quantity of a product in the cart is changed to 0, the button
is now called "remove from cart".

Part-of: odoo/odoo#125743
2023-06-22 18:29:43 +02:00
David Monnom (moda) 99ad5a9410 [IMP] pos_self_order: align front-end and back-end field name
Previously in the front-end there was a notion of "tag" which used
product categories. This led to misunderstandings, because in the
backend there was a notion of tag and category for the products.

Now, the name of the category field is aligned in the backend and
the frontend.

The product model ID field has also been changed from product_id to
id during loading.

Part-of: odoo/odoo#125743
2023-06-22 18:29:43 +02:00
David Monnom (moda) 0c86b3e392 [FIX] pos_self_order: various bugs fixes
Here is the list of bugs that have been fixed:
- Search, when you click on the search button, the input isn't
autofocused.

- The tag list now scrolls automatically so that the selected tag is
always visible on the screen.

- The back button did not work when the self was opened from a page
containing the back button. This is because we are using the browser
history. In this case, when the user clicks back, we send them to
the home page.

- Automatic tag selection during scrolling has been improved.

Part-of: odoo/odoo#125743
2023-06-22 18:29:43 +02:00
vlst 42087c6fa1 [IMP] point_of_sale: Allow products to be part of multiple pos categories
Currently, a product can only be part of one `pos_category`.
This PR changes the relationship between the `product` and the `pos_category` from a `One2many` to a `Many2many`.

closes odoo/odoo#122907

Task: 3138825
Related: odoo/enterprise#41791
Related: odoo/upgrade#4739
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-21 13:45:50 +02:00
David Monnom (moda) a0aff5bda2 [IMP] pos_self_order: refacto, models and serverside price calculation
General refactoring of the codebase. Inline of certain components
that had no logic in the JS side, the XML of these components was
directly added to the place where they were called.

Simplification of the python controller, inline of many functions and
separation of the logic. There is now one function that manages new
orders and another that manages and updates existing orders if we are
in "pay after meal" mode. In "pay after each" mode, orders cannot be
edited.

Addition of different models, product, order and orderlines in order to
facilitate the use of these objects between the backend and the
frontend.

Added price calculation on the serverside because we can't trust the
data coming from the customer in the self since no identification
is required.

Management of last change sent added. Thanks to this, users will no
longer be able to click on the order button if no changes have been
made to the order.

closes odoo/odoo#122901

Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-06-16 14:59:31 +02:00
Pierre Rousseau 2fa42767c7 [IMP] web, point_of_sale: add reactive helpers
This commit adds a new module in web that contains a few helpers to
make it easier to use reactive in Odoo.

closes odoo/odoo#125136

Related: odoo/enterprise#42588
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-06-15 18:52:00 +02:00
vlst 504b969210 [FIX] pos_self_order: Fix small styling issues
This PR aims to fix some small styling issues from the pos_self_order app.

closes odoo/odoo#122502

Signed-off-by: Guilliams Adrien (adgu) <adgu@odoo.com>
2023-05-25 19:16:38 +02:00
vlst 13e37bda7c [IMP] pos_self_order: Allow ordering from web app
Currently from the pos_self_order app a customer can only view the menu.
This PR adds the option to order items.
A customer of the restaurant will now be able to scan a qr code on their table, and navigate to a website where they will be able to order items from the pos.
The customer can select product variants and add a specific notes for each of the ordered products.

This version does not support online payment. This means that the customer will still have to pay by the usual methods.

The pos can be configured such that a customer can add items to an existing order. For example, ordering a second coffee will result in an update of the existing pos order containing the first coffee. Alternatively, the pos can be configured such that each order made from the web app results in a new pos order. Orders made from the self order app will be placed in the same pos session as regular orders. Once a customer orders from the self order app, a new order will appear in the pos app. Thus, a waiter will be able to quickly see all the orders placed by customers from the self order app. He/She will then be able to send the order to the preparation display. This step has to be done manually.

In the interest of security, each table now has an associated access token. It is included in url that the customer gets from the qr code. When sending the order, the self order app also sends back to the server this access token. The server will only process the order if it receives a valid access token. When placing an order, the server will respond with the pos_reference and access_token of the created order. The web app will keep this data and will send it back to the
 server as a proof of ownership in the event that it intends to get the latest state of the order or to update it. The server will only reveal information about an existing order when the request contains a valid pair of pos_reference and access_token.

closes odoo/odoo#121029

Task: 3058586
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-19 13:33:08 +02:00
Brieuc-brd 418413e499 [IMP] web, *: directional icons
This commit adapts the directional icons to improve the usability and
maintain consistency with the ui icons library.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
vlst 05fd65e855 [ADD] pos_self_order: QR Code Menu for Restaurant
New module that would allow restaurant customers to see the menu on their own devices by scanning a qr code and navigating to the provided link.
Task id 3232765

closes odoo/odoo#114022

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-13 04:08:08 +02:00