*: pos_online_payment_self_order,pos_restaurant,pos_self_order
Previously, when self order was set to "pay after each" and a user
ordered an order with a total of $0.00, the order was not automatically
set to paid status, as is the case with point_of_sale.
Now, when the self order is set to "pay after each" and an order with a
total of $0.00 is placed, it will be automatically paid.
Minor fixes:
- A props has been removed from `ReceiptHeader` because it was causing
an error in debug mode.
- In point_of_sale, when an order was placed with a total of $0.00, an
error was raised during validation because no payment method was
selected. Now, before checking this payment method, we first check
whether it exists.
closesodoo/odoo#139555
Related: odoo/enterprise#49442
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
When implementing the Stripe terminal in a device that will be used by
end-users, we need to ensure that it is the server that will validate
the data and not Javascript as is the case in Point of Sale.
Nevertheless, we're using the Javascript SDK for the connection to the
terminal, as we don't want to add a Python dependency to the Odoo server
How the SDK works:
During initialization, we create a terminal via the `create` function.
This function will receive as argument a function that generates a
unique token with a precise lifetime managed by the SDK. These tokens
must be supplied only to trusted devices, such as the kiosk, accessible
only if we have `access_token` from the `pos_config`.
Then, when making a payment, we make a request to the Odoo server to
create a Stripe payment request from the backend, connect the terminal
to the frontend via the `connectReader` function and send it the payment
request via the `collectPaymentMethod` function, passing it the
`client_secret` sent by the Odoo server.
We then use the `processPayment` function once the customer has
presented his payment card to finalize the payment on the terminal.
Finally, we call the `capturePayment` function, which contacts the Odoo
server to validate the amount and payment. If this is the case, it will
mark the order as paid and send a message via websocket to the kiosk to
display the confirmation page.
During these various stages, trust is placed in the server and not in
the frontend.
Stripe Javascript SDK documentation:
https://stripe.com/docs/terminal/references/api/js-sdkclosesodoo/odoo#138646
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
*point_of_sale, pos_self_order, pos_self_order_epson_printer
In this commit we introduce the functionality that allows
the pos_self_order module to generate receipts.
At the moment, this is possible by using Epson Printers via HTTP.
This is done through the use of the newly added bridge module
`pos_self_order_epson_printer`.
In order to generate the data required for the receipt we add more data
on the first load of the kiosk ( such as company information ) and
also in the `_export_for_self_order` method.
Printing is done through the `printer` service from POS.
closesodoo/odoo#137397
Task: 3487638
Related: odoo/enterprise#48304
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit consist of adaptation of the pos_self_order module to send
orders to preparation display. The main changes consist of sending the
table stand number that the client put in to the backend to be shown
in the preparation display. It also consist of moving the tracking
number from the pos_self_order module to the point_of_sale module so
that every number has a tracking number.
closesodoo/odoo#134980
Task-id: 3495477
Related: odoo/enterprise#47203
Signed-off-by: David Monnom (moda) <moda@odoo.com>
**Steps to reproduce:**
- Create a fiscal position that maps to a different tax.
- Use that fiscal position as alternative fiscal position for the "Eat in / Take
away" setting.
- Create a "Take Away" order from the self-ordering app (kiosk or mobile).
- ISSUE: Send the order to the database (by "Pay at Cashier" or "Pay").
- Check the order and it doesn't have correct fiscal position resulting to
wrong amounts in the lines.
**FIX:** When creating the order, we make sure the correct fiscal position is
set. Also, we precompute `is_take_away` variable which is used in many places of
processing the order.
closesodoo/odoo#137669
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
Previously, the custom value of an attribute was not saved in the
database when selected via the point of sale or Self Order. The only way
to see this value was via the product name.
Now, this custom value is saved via the `product.attribute.custom.value`
template, in order to follow the behavior of the Sale module.
Others fix in this PR:
- Prevent to pass to payment page when we are in mobile mode. Only kiosk
mode is allowed to do so.
- Hide "Modify" button in the cart page when the line is already sent to
the server.
- Make the language popup behaviour available in mobile mode too.
closesodoo/odoo#136612
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Previously, the self-order code and parameters were split into two parts
mobile and kiosk.
Now kiosk and mobile have been merged with each other to simplify
maintainability.
closesodoo/odoo#136051
Related: odoo/upgrade#5174
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Following the Odo comment https://github.com/odoo/odoo/pull/129562#discussion_r1306030434
We need to ensure that we have a default user for the mobile SelfOrder
when no session is open.
If we don't have a user, the system will be in sudo mode and the price
calculation will be erroneous because the system has chosen the wrong
taxes: it doesn't know which company to use to calculate the taxes.
We now force the setting of a default user for pos_config with mobile
selfOrder enabled, so that when no session is open, the default user
will be used.
closesodoo/odoo#134273
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Following this PR https://github.com/odoo/odoo/pull/131140 when the self
order is accessed without access token the access restrictions are not
applied anymore. This commit aims to restore the previous behaviour
implemented in the following PR https://github.com/odoo/odoo/pull/122901/.
This commit also add a test to verify the flow of accessing the self order
without an access token. While doing so a the tour util cannotAddProduct
was fixed since it did not behave as inteded.
closesodoo/odoo#133595
X-original-commit: ae1dbc1d34fd622959540ec84bcefe795e15552b
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Loukas Wets (lowe) <lowe@odoo.com>
When changing the quantity of a combo, the price was not correctly
updated due to a miscomputation in the backend.
closesodoo/odoo#134622
Signed-off-by: David Monnom (moda) <moda@odoo.com>
When selecting an attribute value in POS, what we store is the `description`,
which is a string that represents the selected attribute values.
Ex: selecting `Size: M` and `Material: Leather` will result in the description:
`(L, Leather)`.
This choice does not lead to a logical API for dealing with product attibutes.
In this pr, we add a new field that stores the selected `ids` of
`"product.template.attribute.value"` and remove the
`selected_attributes` `Json` field from the `pos_self_order`
override of the `pos.order.line` model.
The `attributeHelper` function from the `tour_utils.js` file
from `pos_self_order` is improved such that it can now handle
both checking if a certain attribute is selected and actually
selecting an attribute.
closesodoo/odoo#126398
Task: 3378533
Related: odoo/upgrade#4992
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
List of improvements:
- Add `Is a Kiosk` field when creating a new POS config
- Add category and change the image of the combo demo product
- Hide useless settings when kiosk mode is enabled
List of fixes:
- Fix bootstrap carousel traceback when no image is set
- Changed the warning sentence concerning adyen payments
- Fix start category in kiosk
- Fix sync between Self Order mobile and PoS restaurant, now new Lines
from restaurant are added to the mobile order
- Fix product reminder when adding something in PoS mobile
closesodoo/odoo#134508
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
Before this commit:
===================
In the back-end, there is only one field "date_order" is used, while on the
frontend side, there are two separate fields: "creation_date" and
"validation_date," which causes confusion in the code flow and leads to
redundancies.
After this commit:
==================
Revised the order date flow by eliminating the confusion stemming from the
separate "creation_date" and "validation_date" fields. Both have been
consolidated into the "date_order" field, offering clarity to the order date
process.
task - 3482072
closesodoo/odoo#133293
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Using the POS app, one can buy a combo consisting of multiple products.
In this PR we implement this functionality in the `pos_self_order`.
A user can now navigate to a combo product, select each combo choice
and order the desired combo directly from the `pos_self_order` app.
In this commit we also change the values displayed in the orderlines
of the `pos_self_order`, such that they better reflect the values
that would be shown by the POS for the same respective orderlines.
Ex: when buying 5 units of an item that has unit price 138.58, the
POS ( and also the invoicing app, etc ) would display a total price
of 692.88. The self order now does the same, but before it was showing
692.90 for the same situation.
closesodoo/odoo#134169
Task: 3437447
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
*: pos_discount,pos_loyalty,pos_restaurant,pos_self_order
In a previous commit (669b9fcc2f) we added the
backend logic needed for creating combos in `pos`.
In this PR we add the combo functionality to the classic pos ui.
This means that products can now be grouped together and sold as a combo.
ex: Create a product called `Burger Menu` with type='combo'.This product will
have multiple combos associated with it, for ex:
- Drinks - will contain the list of drinks from which the customer can choose
- Main Course - will contain the list of main courses from which the customer
can choose
- Dessert - will contain the list of desserts from which the customer can choose
In the event that one of the products inside one of the combos is to be more
expensive, this product will have a specific `combo_price` which will be added
to the main combo product's price.
We add the relational fields `combo_parent_id` and `combo_line_ids` in the
`pos.order.line` model. In the previous example, `combo_parent_id` will contain
the `id` of the `orderline` of the `Burger Menu` product.
In many cases `combo lines` have to be handled together. For example, deletion
of an orderline containing a product from a combo implies the deletion of all
other orderlines containing products from that combo. This means that multiple
methods from the codebase had to be changed for this reason. Places that needed
changes for this reason:
- `split_bill_screen.js`
- `addProductToCurrentOrder()`
- `remove_orderline()` and `add_orderline()` from the `Order` js model
In this PR we also:
- improve the demo data such that it contains a `pos combo`;
- refactor the `ProductItem` component such that it relies on a stateless
component. This stateless component can now be used anywhere; ( it is now used
in the popup which allows selecting the desired combo products )
- add a new method called `is_pos_groupable` on the `Orderline` js model. Before
we relied on the product unit to see whether or not a product is groupable. We
now needed a new mechanism, which could account for different reasons for
which products are not groupable, such as belonging in a combo;
Note on price calculation:
- The idea is simple, imagine a rectangle divided into two parts. The whole
rectangle is the total order, whereas the two partitions are the orderlines.
- Now, imagine shrinking the rectangle by a certain factor. This shrinked
rectangle represents an order containing a combo -- because normally, a
combo results to smaller price. The two partitions are also shrinked by the
same factor.
- So the calculation will be:
- Nominal total price is calculated. This is the sum of the orderlines'
prices when they are added individually. This represents the whole
rectangle.
- Target price is derived from the combo product's price and selected
components' combo prices. This represents the shrinked rectangle.
- Reduction factor is computed as the ratio between the target price and the
nominal price.
- Each component's unit price is adjusted by multiplying the reduction
factor.
- When the unit prices of the components are computed, we now let the normal
price computation take place.
- A spreadsheet is prepared to show a sample calculation:
https://docs.google.com/spreadsheets/d/1iOdnaILnvKiaf2_z7jTijYiVfB_3mjKWjq6nOB70Un0/edit#gid=0closesodoo/odoo#129483
Task: 3430636
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Co-authored-by: Joseph Caburnay <jcb@odoo.com>
To begin with, there are two different fields.
- tracking_number: used with the kiosk or self so that the customer can
track his order.
- name (order_reference): classic order number, used to find them in the
odoo backend.
Example of tracking number:
- A1
- B1
Example of order_reference:
- Classic PoS: Order 00001-001-0001
- SelfOrder Mobile: Self-Order 00001-001-0001
- Kiosk: Kiosk 00001-001-0001
Two ir.sequences are used to generate these numbers. The first to
generate order_reference numbers per session, and the second to generate
tracking_numbers, which are common to all pos_configs and reset once
a day.
closesodoo/odoo#133902
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
*:point_of_sale,pos_adyen,pos_online_payment_self_order,pos_restaurant,
pos_sale,pos_self_order,pos_self_order_adyen,pos_self_order_restaurant,
pos_self_order_sale
This PR adds the kiosk to the existing `pos_self_order` module, which
until now has enabled end-users to order their restaurant meals directly
from their smartphones.
We've added the possibility of creating kiosks / totems (devices with
large touch screens) that allow users to order their menu directly
without having to go through a waiter.
Once the order has been placed, the user will be invited to pay either
by adyen, already integrated into this PR, or at the counter.
At the end of the order, the user will receive an order number and his
table number if `service at table` is activated.
Main differences with the Self-order mobile:
- Kiosk shouldn't be accessible publicly
- Kiosk should support payments via card readers
closesodoo/odoo#129562
Design: XLU
Dev: ADGU & MODA
Taskid: 3323163
Related: odoo/upgrade#5024
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
**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.
closesodoo/odoo#131140
X-original-commit: 7ce7f3e21ad8f457742e27f88b7146c7d8fff5f3
Signed-off-by: David Monnom (moda) <moda@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
*: 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.
closesodoo/odoo#127869
Task-id: 3171698
Related: odoo/enterprise#44055
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
- Corrected incorrect use of access_token in an order.
- Correction of order change calculation in self_order.
closesodoo/odoo#125941
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
- 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
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.
closesodoo/odoo#126186
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
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.
closesodoo/odoo#125921
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
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.
closesodoo/odoo#122901
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
*: l10n_fr_pos_cert, pos_discount, pos_loyalty, pos_sale, pos_self_order
The `Orderline` model contains the fields: `price_manually_set` and `price_automatically_set`.
They are meant to signify what type of price the orderline has: `automatic`, `manual` or `original`.
It's very confusing to manage the two fields when in fact they only describe three types of setting the orderline price.
This PR replaces the 2 fields with a single one: `price_type`, which will take one of the 3 possible values.
closesodoo/odoo#124858
Task: 3358265
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
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.
closesodoo/odoo#121029
Task: 3058586
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
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
closesodoo/odoo#114022
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>