Commit Graph
319 Commits
Author SHA1 Message Date
Theo VINCENT (thvi) ef05b6ef55 [FIX] pos_restaurant: fix tips after payment flow
- Fixes tips ticket printing when there are tips after payment.
 - Makes the ReceiptScreen opened after TipScreen, to show the receipt screen even when there is a tip added after payment.

closes odoo/odoo#127548

Task-id: 3394214
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-07-06 17:52:19 +02:00
Adrien Guilliams (adgu) ebbb81f2de [FIX] pos_restaurant: assertion of restaurant tour not ok
The pos_restaurant first test (test_01_pos_restaurant) has an assertion
that failed due to the fact that the deleteion of an order is
not awaited in the frontend. This led to the tour finishing very fast
after the orm call and the assertion done just after that. We add steps
in this test to see if the orm call has been done propely before ending
the tour.

Runbot Error: 22613, 22614

closes odoo/odoo#126779

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-07-03 11:02:49 +02:00
vlst deb015a069 [FIX] pos*: Fix order removal
pos*: point_of_sale, pos_restaurant

When deleting an order, the restaurant override of the deletion function
in `point_of_sale` interferes with the logic in such a way that we end up
writing the order that needs to be deleted 2 times.

This is obviously not the expected bahaviour. In this PR we remove
the `override` from `pos_restaurant`, as it is no longer needed and
we also add a mechanism that ensures that orders cannot be duplicated.

closes odoo/odoo#126442

Task: 3383043
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2023-06-27 16:26:56 +02:00
vlst bfca1f4e8a [IMP] point_of_sale, pos*: reference env in models
pos*: pos_loyalty, pos_restaurant, pos_sale,
pos_adyen, pos_six, pos_stripe

At the moment, the `pos` models don't have access to the `env` variable.
This makes using `env` inside a model rather awkward.

This PR makes it so all the pos models have access directly to `env`.

closes odoo/odoo#124320

Task: 3358456
Related: odoo/enterprise#42209
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-27 16:26:45 +02:00
Theo VINCENT (thvi) 3236c1cb50 [IMP] pos_restaurant, *: default settings and data
*: point_of_sale, pos_self_order

Changes:
 - Adds a default restaurant with some default usual settings (with tips after payment if the company is in the United States) but no floor in the Point of Sale app. Makes pos_restaurant module auto installed with point_of_sale.
 - Makes some restaurant settings enabled by default (only for restaurants).
 - Adds loadable default demonstration data for onboarding (only when no real product is available in POS), specific to a restaurant. The default demonstration data for onboarding of point_of_sale and pos_restaurant are loaded together (if pos_restaurant is installed) to make it so an user that clicks to add demo data will have demo data for the default point of sale and also for the default restaurant (and the current restaurant if it is different than the default one). Makes the load demonstration data button visible when there is no product with a positive price available, because without that condition the tips (in restaurant) and discount were preventing the display of the button.
 - Hides the Preparation Printers menu item if there is no POS config using the printers.
 - Renames some labels.

Fixes:
 - Adds checks to always set set_tip_after_payment to False if a point of sale is no longer a restaurant or if the tips are disabled. This is needed because the code of pos_restaurant seems to be written considering that set_tip_after_payment is True only when the point of sale is a restaurant with the tips enabled (which wasn't guaranteed). Without that checks, some tests like ReceiptScreenTour fail. Another solution to make the tests successful without that checks would be to add !this.env.pos.config.module_pos_restaurant in pos_restaurant/static/src/js/Screens/PaymentScreen.js:16. But because other parts of the code only check the value of set_tip_after_payment, I think it is better to opt for the additionnal checks.
 - Fixes duplication of displayed product categories when loading demonstration data.
 - Fixes products before loading demonstration data that were kept and displayed after (discount for example).
 - Fixes categories and therefore communication with the preparation display after loading demo data in a restaurant.
 - Adds a check on the server side to prevent demonstration data loading when there is at least one valid product for POS.
 - Fixes order count display when "NaN" (in floors and tables view).
 - Fixes arguments of orm call for set_not_tip (model and method names were not given in the right order).

closes odoo/odoo#117941

Task-id: 2484291
Related: odoo/enterprise#39450
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-26 20:00:35 +02:00
pedrambiria 1214542413 [FIX] pos_restaurant: stay on current table after refund
Previously, when conducting a refund on a table, the system would
switch the active table to the table associated with the refunded
order. This was not the desired behavior, as it resulted in the details
of the order disappearing, requiring the user to navigate back to
the refund process.

Steps to reproduce the issue:

 - install PoS restaurant
 - pick a table, do an order and pay it
 - pick another table, refund
 - choose the previous order and refund
-> the order details disappear directly. You have to go back to refund.

opw-3301603

closes odoo/odoo#125908

X-original-commit: 1f560c8954359a15ba84eb695c7eca380722f9fc
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-06-22 08:35:04 +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
vlst 1f655ffcc7 [REF] pos*: merge PosStore and PosGlobalState
*: l10n_ae_pos, l10n_co_pos, l10n_fr_pos_cert, l10n_gcc_pos, l10n_in_pos, point_of_sale,
pos_adyen, pos_discount, pos_epson_printer, pos_hr, pos_loyalty, pos_mercury,
pos_restaurant, pos_sale, pos_sale_product_configurator, pos_six, pos_stripe

After the architectural refactor of the PoS App, there are two classes that make sense to merge.
In this refactoring task, we're merging them.

closes odoo/odoo#124477

Task: 3358550
Related: odoo/enterprise#42257
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-19 10:40:43 +02:00
pedrambiria 88124fcf60 [FIX] point_of_sale: prevent removing order after bill screen timeout
steps to reproduce the issue:
-Navigate to POS, Open Bar (needs to be restaurant POS)
-Click on a table and add some items to the order.
-Click the Bill button under the order
-Wait about 90 seconds
-Bill page times out and goes back to the floor screen
-Click on Orders at the top and view Ongoing Orders. The one you just
made is not here (it should be)

The solution is to prevent removing the not finalized order when
coming back to the FloorScreen.

opw-3276345

closes odoo/odoo#124960

X-original-commit: be384e27ced7c256867938c53aa5d2a7d81c0ade
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-06-14 10:54:53 +02:00
Samuel Degueldre fcdd2acc5a [REF] pos*: namespace component templates, remove useless super calls
pos*: l10n_ae_pos, l10n_co_pos, l10n_fr_pos_cert, l10n_in_pos,
point_of_sale, pos_discount, pos_epson_printer, pos_hr, pos_loyalty,
pos_mercury, pos_restaurant, pos_sale, pos_sale_product_configurator,
pos_six

Previously, none of the templates of the pos were namespaced, this means
that depending on context, you have to access them differently: in xpath
the module prefix is necessary even if the template name itself isn't
namespace, but in owl components you cannot use the namespaced version
because owl doesn't have the notion of modules.

This commit namespaces the component templates of all the pos modules so
that it's consistent with the rest of the code base. It also removes
some extraneous calls to super.setup() that were leftover and are not
necessary for components extending directly owl's base Component.

closes odoo/odoo#124069

Related: odoo/enterprise#42094
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-06-08 14:32:34 +02:00
Samuel Degueldre cb2a53d573 [REF] point_of_sale, pos*: adapt import to moved files
pos*: l10n_co_pos, l10n_fr_pos_cert, l10n_gcc_pos, l10n_in_pos,
l10n_sa_pos, pos_adyen, pos_discount, pos_epson_printer, pos_hr,
pos_hr_restaurant, pos_loyalty, pos_mercury, pos_restaurant, pos_sale,
pos_sale_loyalty, pos_sale_product_configurator, pos_six, pos_stripe

The previous commit reorganizes the files in the pos, this commit
renames all of the imports of those files to match their new location.
This is done in a separate commit to allow git to better keep track of
the changes and apply forward-ports more seamlessly.

Part-of: odoo/odoo#123498
2023-06-05 17:51:06 +02:00
David Monnom (moda) 3db548c76f [IMP] point_of_sale,pos_restaurant: add bus_service
Before a longpolling every 5 seconds was set up to sync the number of
orders per table in the pos_restaurant, which was not very
userfriendly / efficient.

Now, the longpolling has been replaced by a bus (websocket). As soon as
an order is sent to the server by another PoS, the server dispatches the
information to all other PoS using the corresponding floor plan.

The bus_service was initialized in the pos_store of the point_of_sale,
but is now used only in the pos_restaurant via override.
This was done for obvious future use.

closes odoo/odoo#121875

Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-05-31 14:23:24 +02:00
David Monnom (moda) c997ac8e11 [IMP] pos_*: order btn is always primary
closes odoo/odoo#119032

Related: odoo/enterprise#39981
Signed-off-by: Guilliams Adrien (adgu) <adgu@odoo.com>
2023-05-26 11:40:33 +02:00
Adrien Guilliams (adgu) 60f41b1f83 [IMP] pos: Change waiter screen
The PoS needed improvments for the mobile use.
This commit is changing the display of some screen and popups
like the NumberPopup. It also changes the logic of the
order count badge on the table. It now displays the number
of orderline (and their quantity) to send to the printers
or preparation display if there is at least one.

closes odoo/odoo#121286

Related: odoo/enterprise#41013
Signed-off-by: Monnom David (moda) <moda@odoo.com>
2023-05-25 16:29:11 +02:00
Adrien Guilliams (adgu) a04adfac93 [FIX] pos: fix pos traceback when delete order
This commit resolves 2 bugs.
The first one is that, in a PoS without pos_restaurant installed,
if we delete the last order of the list, we get a traceback.
This is resolved by adding an empty order if there is no order left
in the order list.

task-id: task-id: 3291831

The second bug is that, with pos_restaurant installed,
when going to a retail PoS, if we createan order with some products,
then create a new order from the TicketScreen, add some products,
go the the TicketScreen and delete the current order
and then click back, we have in the ProductScreen the order
that is supposed to be deleted.
This order doesn't show up in the ticket screen anymore.
This comes from the fact that the _selectNextOrder function is
not correctly implemented, leading to the next order not being
chosen because we do not have a table (we are in classic PoS).
This fix resolves this problem by changing the _selectNextOrder
function and the newly added addOrderIfEmpty function in models.js.

closes odoo/odoo#122269

Task-id: 3291821
X-original-commit: cd956daf21695bef4753301fe29a6ece1e97d32a
Signed-off-by: Monnom David (moda) <moda@odoo.com>
Signed-off-by: Guilliams Adrien (adgu) <adgu@odoo.com>
2023-05-24 14:28:25 +02:00
Samuel Degueldre 6f18cffb60 [REF] point_of_sale, pos*: remove BackendButton component
pos*: point_of_sale, pos_hr, pos_restaurant, pos_sale

This component is purely presentational and contains no code, it's also
only used once (it was actually used a second time in pos_hr only
because the way the xpath was written would replace the existing
instance with a new one with an added t-if, we can just use an attribute
xpath instead).

Existing xpaths have been adapted such that the burger menu's dropdown
structure is better semantically (an unordered list containing list
items, instead of containing list elements inside of random divs)

Part-of: odoo/odoo#122035
2023-05-24 14:27:59 +02:00
Samuel Degueldre ebe526241f [REF] point_of_sale, pos_restaurant, pos_sale: remove useless base class
The IndependentToOrderScreen base class is used when a main screen
should not be stored on the order (so that it can be restored when the
order is selected again). Its implementation is simply a class with a
static flag, and a super simple close method which just calls the
equivalent method on the pos store. It has been removed and the classes
extending it have been adapted.

Part-of: odoo/odoo#122035
2023-05-24 14:27:59 +02:00
David Monnom (moda) e47bd1d71e [IMP] point_of_sale,pos_restaurant: cancelled order to preparation tools
Before when you deleted a order in PoS with the preparation tools
enabled. The order was not cancelled on them.

Now, when cancelling/deleting an order in PoS the information is sent
to the preparation tools.

closes odoo/odoo#120447

Taskid: 3278081
Related: odoo/enterprise#40673
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-23 18:01:35 +02:00
David Monnom (moda) d9f6a5d209 [IMP] point_of_sale,pos_restaurant: improve offline popup
Before when the point_of_sale was offline, popups were opened at each
RPC error. This was inconvenient for the user as the pos must be usable
offline.

Now, the error popup has been replaced by an alert popup explaining that
the point of sale works in limited version as long as it is offline.
The warning noise has also been removed.

closes odoo/odoo#120826

Related: odoo/enterprise#41323
Signed-off-by: Guilliams Adrien (adgu) <adgu@odoo.com>
2023-05-23 16:31:36 +02:00
David Monnom (moda) b22e770fd0 [IMP] point_of_sale, pos_*: misc ux improvement
- Modification of the search button on mobile to keep a fixed position.
- Modification of the splitbill system, after the validation of a part
ofthe order, a continue button is displayed in order to finish the
payment of the rest of it.
- The INPUT popup can now be validated by pressing the "enter" key.
- Debug widget is now hidden by default. And a button is added in the
burger menu to toggle its visibility.
- When adding a product with optional products the info popup is no
longer opened automatically but if the orderline is selected in the
order the info button will be highlighted.

closes odoo/odoo#119919

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-23 16:31:24 +02:00
David Monnom (moda) e3514aad08 [FIX] point_of_sale,pos_restaurant: wrong error handler
When an error of type "ConnectionLostError" arrives in the PoS, we catch
it in order to warn the user. In the catch, a bad detection of the
instance of this error was made which blocked the flow by throwing
an error.

We were checking whether the error message was an instance of a
ConnectionLostError in a way that assumes that the error was a legacy
error which is no longer the case since the POS no longer uses the
legacy rpc service. This commit adapts the instanceof check

The necessary changes have been made, it now works.

closes odoo/odoo#121536

X-original-commit: 963ea1c5779fbf7af7d5421a294ca2a24d7940af
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Monnom David (moda) <moda@odoo.com>
2023-05-16 15:55:44 +02:00
Samuel Degueldre ba29387924 [REF] pos*, web: use reactivity to react to changes in UI size
pos*: point_of_sale, pos_restaurant, pos_sale

Previously the pos would rerender the entire UI when the window was
resized. In practice, most components do not care about the size of the
UI for their rendering, and so we're doing a lot of needless work, and
also using an owl feature (deep renders) whose perennity is not certain
(we may want to remove the ability to do deep renders completely in the
future).

This commit changes the pos code to use the ui service `isSmall` field,
makes the ui service reactive so that components can subscribe to
changes inside of it with `useState`, and makes the ui service update
its internal state at most once per animation frame, instead of after
100ms without resizing, so that resizing the viewport results in a
smoother user experience.

closes odoo/odoo#121343

Signed-off-by: adgu-odoo <adgu@odoo.com>
2023-05-15 13:59:22 +02:00
Pulinckx Pierre (PIPU) f4f0f78318 [REF] *: Replace underscore.js function by native JS
Before this commit : The library underscore.js and
underscore.string.js were used in the ODOO solution.
After this commit : Every usages of a function from
underscore.js lib has been replaced with native javascript.
The goal is to remove all usages of underscore.js and to
not use anymore this library in ODOO.
---
TaskId : 3246238

closes odoo/odoo#120437

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-05-15 09:37:48 +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
Samuel Degueldre 3fb24aa05e [REF] pos*: use fine grained reactivity instead of deep renders
*: l10n_ae_pos, l10n_co_pos, l10n_fr_pos_cert, l10n_gcc_pos,
l10n_in_pos, point_of_sale, pos_discount, pos_hr, pos_loyalty,
pos_mercury, pos_restaurant, pos_sale, pos_six

The code of the pos was one of the first adopters of owl 1, as such, the
code was not initially written to take full advantage of the owl
reactivity system that would eventually make its way into owl 2. In
order to convert the code quickly when migrating to owl 2, a big
shortcut was taken: whenever something in the state of the pos changed,
the entire UI would be rerendered. While this works decently well in
practice, it can create confusing situations because the mental model
needed to understand how components work in the pos is different from
the rest of the code base.

This commit changes the existing code to use the typical fine-grained
reactivity model used everywhere else: components individually subscribe
to the pieces of state that they use and will rerender on their own when
this state changes. In order to achieve this, the pos global state has
been removed from the environment and should now be access through the
use of the custom hook `usePos` which will subscribe the component to
the state that it reads. This also has some minor performance benefits
as we only render the parts of the UI that actually need to update
whenever there is a state mutation, instead of the entire UI which can
be expensive in some cases (eg, the product screen will filter all
products during rendering to find only the products that match the
search, which is expensive when there are a lot of loaded products)

closes odoo/odoo#120992

Related: odoo/enterprise#40873
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-12 19:54:57 +02:00
Loukas Wets (lowe) e3ad1eb058 [IMP] pos_restaurant: always floor plan when restaurant
Enable floor plan for all PoS Restaurant config. To accomplish this, we are
removing the following fields:
- `pos.config.is_table_management`
- `res.config.settings.pos_is_table_management`.

All access to `is_table_management` can be replaced by `module_pos_restaurant`
because originally, `is_table_management` can only be true if
`module_pos_restaurant` is true.

To adapt the tests, we should manually set `module_pos_restaurant` to `False` for
the `pos.config` used in tests outside `pos_restaurant` addon. This is because
when pos_restaurant addon is installed, it sets every new `pos.config` record to
be restaurant by default.

Task-3282975

closes odoo/odoo#120117

Related: odoo/enterprise#40532
Related: odoo/upgrade#4622
Signed-off-by: Monnom David (moda) <moda@odoo.com>
2023-05-11 12:01:35 +02:00
David Monnom (moda) 55ec4f75bc [FIX] point_of_sale,pos_restaurant: fix order btn
Before this commit, the Order button wasn't displayed due to an
incorrect comparison with a `LazyTranslatedString` object
(`this.props.actionName`). This commit resolves the issue by ensuring
proper comparison of `this.props.actionType` with the string "payment".

Step to reproduce:
- create a pos_config (bar)
- active a printer on it
- open the PoS bar
- select a table and add some product
- The orderline are green but there's not order button.

opw-3300533

closes odoo/odoo#120846

X-original-commit: a04f8ebdfb724c74531f38927a655e6aae86bc26
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-05-10 20:15:26 +02:00
Samuel Degueldre af2b9eab4c [FIX] pos_restaurant: stop crashing in mobile
In odoo/odoo#120070 the pos assets bundle were refactored to stop
including the entirety of assets_backend. In doing so, jQuery.ui is no
longer present in the bundle. pos_restaurant adds an addon for jQuery.ui
to make its widgets work on mobile, but since the original library is
not present, this causes a crash when touch events are available (ie on
touch screens).

This commit fixes that by removing the addon entirely, since none of the
pos depends on jQuery.ui anymore.

Part-of: odoo/odoo#120791
2023-05-09 11:57:23 +02:00
Joseph Caburnay 5d951d91bb [REF] point_of_sale,*: redefine format_currency{_no_symbol} using web's formatMonetary
*: l10n_ae_pos,l10n_fr_pos_cert,l10n_gcc_pos,pos_loyalty,pos_restaurant,
   pos_sale,pos_sale_product_configurator

This commit is the start of a series of changes in the definitions of formatters
and rounders used in pos. We are introducing a new service called
`contextual_utils_service` that loads when the `pos` service is ready making
sure the currency is loaded. In this service, we define `formatCurrency`
(potentially others) which is the replacement to `format_currency{_no_symbol}`.
Also, instead of defining our own formatter, we are depending on web's
`formatMonetary`.

In this commit, we are replacing all uses of `format_currency{_no_symbol}` with
`formatCurrency` that's based on web's `formatMonetary`.

Part-of: odoo/odoo#120317
2023-05-08 15:18:30 +02:00
David Monnom (moda) f23edc1729 [FIX] pos_restaurant: wrong arguments for orm.call function
The first two arguments of the call() function of the orm service
have been inverted.

This is fixed.

closes odoo/odoo#120404

X-original-commit: 0a4e035083d6d3d62d0041fad62f71668dd77d7e
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Monnom David (moda) <moda@odoo.com>
2023-05-03 13:57:24 +02:00
David Monnom (moda) 73aae73f1b [IMP] point_of_sale,*: move kitchen printer logic to point_of_sale
*:pos_epson_printer,pos_epson_printer_restaurant,point_of_sale,
pos_restaurant,pos_hr_restaurant

Before the printers only worked in the pos_restaurant and not in the
point_of_sale. Indeed, the methods managing the printers were located
in the pos_restaurant.

Now all these methods have been moved.
For the community part here are the affected modules:
- The methods in pos_epson_printer_restaurant have been moved to
pos_epson_printer.
- The methods in pos_restaurant have been moved to point_of_sale.
- The module pos_epson_printer_restaurant has been removed as it only
handled printers.

Some of these methods have been adapted/renamed to better suit
the needs.

This branch the first part of the following task: 3224508

closes odoo/odoo#114655

Related: odoo/upgrade#4414
Related: odoo/enterprise#37901
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-03 12:39:17 +02:00
Samuel Degueldre d11bf24dea [REF] pos*, web: make pos service start asynchronously
*: point_of_sale, pos_hr, pos_restaurant

Previously, the pos service started synchronously, but doing anything
meaningful with it needed to be done after it was "ready", meaning it
had loaded and processed the data. The reason for this is that we need
to start the services before we mount the chrome, but in the pos we want
to show the loader immediately while the data is loading. This means
that any service that depends on the pos service in a meaningful manner
has to be written in a convoluted way, where it starts as a dummy
service and then overwrites itself in the env when it's actually ready.

This commit allows to write services that depend on the pos service more
naturally, by making the pos service properly asynchronous, meaning its
dependents will only be loaded once it's actually ready. To work around
the loader issue, the loader is mounted as a separate owl appplication
with not services, this application is shown over the chrome and when
the chrome mounts, it hides the loader and destroys the loader
application after the fade-out transition.

closes odoo/odoo#119908

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-28 13:33:15 +02:00
Joseph Caburnay 8d50daeefa [REF] point_of_sale,*: minimize the use of legacy web modules
*: l10n_fr_pos_cert,portal_rating,pos_adyen,pos_epson_printer,pos_loyalty,
   pos_mercury,pos_restaurant,pos_restaurant_adyen,pos_restaurant_stripe,
   pos_sale,pos_six,pos_stripe,web

This is part of the continuous effort of refactoring pos addons towards using
more modern modules and programming patterns (such as services). After this
commit, point_of_sale addons are now left with the use of the legacy
`web.concurrency` module because of the `MutexedDropPrevious`. It's okay to keep
it because it's relatively an independent module compared to other legacy web
module.

The following summarizes the changes in this commit.

- import `_t` from `@web/core/l10n/translation`.

- convert `PosDB` to js native class

- remove use of `format` in `TicketScreen`
  - To determine the cached orders are up-to-date, we now deserialize the dates
    coming from the server using web's `deserializeDateTime` function. Then,
    instead of initiating `cacheDate` as native js Date, we use the luxon's
    `DateTime` which is supported by the web date utility methods.
  - There is no need for the `format` function from `web.utils` legacy module.

- convert `PaymentInterface` to native class

- remove use of `web.config` module

- remove use of `web.time` module
  - use `serializeDateTime` from web.

- remove use of `web.rpc`

- remove use of `web.utils` module
  - introduce simple check for email address input
  - Replace use of `web.utils.Markup` with `@odoo/owl.markup`.
  - 'web.utils'.{round_decimals,round_precision,float_is_zero} copied to
    '@web/core/utils/numbers'.{roundDecimals,roundPrecision,floatIsZero}.
    - These helper functions are not removed from the web addon because they
      are also used from other addons that are not linked to pos.
    - `floatIsZero` is now computed by directly comparing the result of
      `roundDecimals` to zero. This works because rounding a decimal number
      which will result to zero will exactly give zero.

- remove use of `web.field_utils`
  - Replace `web.field_utils.parse.float` with
    `@web/views/fields/parsers.parseFloat`.
  - Replace `web.field_utils.format.float` with
    `@web/views/fields/formatters.formatFloat`.
  - Replace `web.field_utils.format.date` with
    `@web/core/l10n/dates.formatDate`.
  - Replace `web.field_utils.format.datetime` with
    `@web/core/l10n/dates.formatDateTime`.

- convert `PrinterMixin` and dependents to native class
  - `PrinterMixin` is converted to `BasePrinter`.
  - `Printer` is converted to `HWPrinter` (extending `BasePrinter`).
  - `EpsonPrinter` retained its name and is converted to extend `BasePrinter`.
  - Moreover, we also removed the convoluted `PrintResultGenerator`, replaced by
    simply creating object with the following signature:
    ```js
    { successful: boolean; message?: { title: string, body?: string } }
    ```

- remove use of `web.Session`

- replace use of `qweb.render`
  - We use `renderToElement` as replacement to templates that produces valid
    html.
  - Note that `renderToElement` is introduced in `@web/core/utils/render` module
    which is extracted from the original `renderToString` method.
  - For the epson printer template, we kept the xml layout and manually add
    required xml element to contruct the xml that will be sent to the epson in
    making print requests.

- use `Mutex` from `@web/core/utils/concurrency`

- remove use of `Markup` when rendering receipt info (`ticket`) in order to
  render new lines.

- Remove use of `jquery` in `htmlToImg`.

closes odoo/odoo#117231

Related: odoo/enterprise#39078
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-25 14:07:09 +02:00
Pulinckx Pierre (PIPU) 608e90e998 [REF] *: Replace underscore functions by native JS
Replace _.map(), _.flatten(), _.delay(), _.contains(), _.pluck(), _.isUndefined(), _.isEmpty(), _.isString(), _.isEqual(), _.isBoolean(), _.memoize(), _.invoke(), _.bind(), _.escape(), _.debounce(),
_.str.sprintf(), _.str.repeat(), _.str.startswith(), _.str.trim(),
_.str.escapeHTML(), _.str.escapeRegExp(), _.str.startsWith(), _.str.include()

closes odoo/odoo#118012

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-04-20 11:57:29 +02:00
roen-odoo 2eafad8bf1 [FIX] pos_restaurant : add missing t-ref
Current behavior:
When printing a bill in the restaurant you had an error poping.

Steps to reproduce:
- Open a restaurant session
- Go on a table and add some products
- Click on the bill button
- Click on the print button
- You get an error

opw-3259014

closes odoo/odoo#119041

X-original-commit: 1d1808e7136c6416fe88c28e7971e97707de2557
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-04-20 10:51:49 +02:00
Pulinckx Pierre (PIPU) 614de86989 [REF] *: Replace underscore function by native JS
Replace _.isNumber(), _.filter(), _.reject(), _.unique(), _.indexOf(), _.lastIndexOf(), _.findIndex(), _.range()
_.keys(), _.values(), _.str.sprintf() and some _.each()

closes odoo/odoo#118003

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-13 16:40:11 +02:00
Loukas Wets (lowe) dc4cb848de [IMP] pos_restaurant: Order button: Display product summary by category
We want the order button to display the product summary by category to give more feedback to the waiter while taking an order.

closes odoo/odoo#116846

Task-id: 3229596
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-13 15:26:01 +02:00
Adrien Guilliams (adgu) 6cabcd7f1c [IMP] pos: New FloorScreen kanban view and more
Currently, there is only 1 plan view that is unreadable on mobile
and sometimes also complicated in some cases.
This commit  adds a new "Kanban" view used by default on mobile
and available in desktop too. This commit also changes the edit bar
of the FloorScreen: the design is changed and some features are added
like the multiple selection of the tables or the adding and removing
of floors directly from the frontend. It also changes the navbar
of the PoS, moving the buttons in a navigation menu accessible
thanks to a button.

Task-id: 3212032
2023-04-12 15:42:27 +02:00
Joseph Caburnay 762aefc455 [REM] point_of_sale,pos_restaurant: remove marked up headers
Currently, the "receipt_header" and "receipt_footer" text fields of the
'pos.config' model can be used to render html in the receipt using qweb by
putting `<!DOCTYPE QWEB` as the first line of the text. In the previous
versions, it is converted to a markup so it is rendered as html in the
receipt. Rendering it as markup poses security issues therefore we are
removing this feature in this commit.

After this commit, we now only allow regular string to be added in the
receipt and footer headers.

If user wants to introduce custom markup in the headers, they can
properly do so by extending the `OrderReceipt` template from other addons.

closes odoo/odoo#117336

Task-id: 3256208
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-04-07 11:37:20 +02:00
Samuel Degueldre 8d35700aaf [REF] point_of_sale, pos_restaurant, *: stop using legacy environment
*: web

This commit removes the use of the legacy environment from the PoS, as
it is no longer needed. This will allow us to more easily use the new
unit testing infrastructure from web.

Part-of: odoo/odoo#117290
2023-04-06 16:12:02 +02:00
Adrien Guilliams (adgu) 168762c838 [IMP] pos, pos_restaurant: adaptation of change of quantity for orderlines
In the previous state of the point_of_sale module, when the l10n_fr_pos_cert
module was used, we were too restrictive leading to an unusable flow by some
clients. We adapt the modules here so that the FR module is more usable
by the clients while still respecting the law.

closes odoo/odoo#113754

Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-04-04 14:45:54 +02:00
Samuel Degueldre 25cbd9c4e7 [REF] point_of_sale, pos*: convert ProxyDevice to ES6 class and service
*: pos_epson_printer, pos_restaurant, pos_six

This commit continues the work of reducing the reliance of the pos
modules on legacy features from the JS framework, such as core.Class and
mixins, by converting the ProxyDevice class to ES6 (and renaming it
HardwareProxy, to avoid confusion with DeviceProxy from iot). It also
makes it available as a service in the new environment so that we can
hopefully get rid of the legacy environment in the near future.

closes odoo/odoo#114821

Related: odoo/enterprise#37991
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-03-30 15:09:14 +02:00
David Monnom (moda) 28bb9e496a [FIX] point_of_sale,pos_restaurant: customer button
closes odoo/odoo#116458

X-original-commit: 462cc13ad5c76ed06c848cfefef18a0512713e4e
Related: odoo/enterprise#38679
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-03-24 20:56:27 +01:00
David Monnom (moda) a9608cdf1e [IMP] pos_restaurant: swap payment and order button
Previously, the payment button was larger than the others and next to
the numpad. The other buttons were managed by a mixin and arranged
in a predefined order.

Now, the payment button only stays in place when the "order" button is
not present, currently it can only be present if the restaurant module
is installed and a printer configured.

When it is present, it takes the place of the payment button and the
latter is added to the mixins with the other buttons

closes odoo/odoo#115988

X-original-commit: f32c07f28e2fd2830f568757d4700fa77b83ced7
Related: odoo/enterprise#38476
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-03-21 18:56:15 +01:00
Joseph CaburnayandJulien Mougenot 3a798039d6 [REF] web_tour,*: convert web_tour to owl
* The tours are now run by the `MacroEngine` defined in `macro.js`.
  * This is accomplished by converting (at runtime) the user-defined tours to
    `Macro`s. See `tour_compilers.js` for the step (and tour-to-macro) compilation.
* API is kept the same as much as possible. Basically, declaring tours stayed
  the same with some exceptions:
  * `allowInvisible` can be provided in a step to allow consuming the trigger
    element even if it is invisible.
  * `isCheck` can now be used to replace the no operation `run` that is
    traditionally signals the runner to only perform a check.
  * Before, multiple `run`s can be called simultaneously. Now, each `run` method
    is awaited before proceeding to the next step.
* If the trigger element is `disabled`, the tour runner will *not* proceed on
  calling the `run` method and the runner will stay on current step until the
  trigger element becomes `enabled`.
  * However, the tour runner is okay with `disabled` trigger element if the step
    has `isCheck = true`. As long as the trigger element is found for `isCheck`
    step, the tour runner will happily move to the next step.
* Some tours are adjusted to properly run with this new tour runner.
* When the tour failed:
  * The dom string is not logged anymore.
  * However, a warning message containing the relative location of the step will
    be logged. This is better in helping the author in locating the failed step.

**Some guidelines learned during the development:**

* Each step may trigger a dom mutation. It's a good practice to insert an
  intermediate step that *checks* the existence of an element that result from
  the action of the previous step.
* Refrain from using the `run` method for assertions. `run`, in principle, is
  provided to perform actions that are not offered by the helper. Use the
  `trigger` for assertions.
* During dev, find `SHOW_POINTER_DURATION` and set it to `250`. This will show
  the pointer (pointing to the trigger element) for 250ms when watching the
  tour.

closes odoo/odoo#107618

Task-id: 3082036
Related: odoo/enterprise#37560
Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2023-03-15 13:19:45 +01:00
Louis Wicket (wil) 9afe7c74c9 [IMP] *: remove "French spacing" 👺
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#114533

Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-03-14 15:52:10 +01:00
Adrien Guilliams (adgu) 53f9e5845f [IMP] point_of_sale, pos_restaurant: Add cross-orders feature for point_of_sale and pos_restaurant
Currently the below use-cases are hardly supportable, though quite common:

Retail: Sell product in one shop and return it in another one
Restaurant: Managing payment when having multiple checkout desks,
 and multiple waiters (only taking orders)

This because currently:

PoS orders are only known by the cashier desk (pos.config) they were created from
One floor map can only be linked to one cashier desk at a time

More over, with the Self-Service coming along the way
(where kiosk orders must be accessible from a cashier desk),
this need must be supported.

For restaurant, floor plans can be linked to multiple cashier desks,
ongoing orders are shared between trusted PoS config
(through floor plans for restaurant and according to
the setting "Trusted PoS config" for the retails),
and past orders can be accessible from any desks within a same DB.

closes odoo/odoo#109216

Related: odoo/upgrade#4393
Related: odoo/enterprise#37955
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-03-10 18:54:52 +01:00
Samuel Degueldre 54058db0ab [REF] point_of_sale, pos*: replace use of legacy rpc with orm service
*: l10n_co_pos, l10n_fr_pos_cert, point_of_sale, pos_loyalty,
pos_mercury, pos_restaurant, pos_sale, pos_sale_product_configurator

This is a step in the direction of making the pos no longer depend on
the legacy environment.

closes odoo/odoo#114668

Related: odoo/enterprise#37906
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-03-10 11:23:51 +01:00
David Monnom (moda) 7b14d73a5a [REF] point_of_sale,pos_*: remove legacy posbus
closes odoo/odoo#113782

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-03-08 09:26:47 +01:00
David Monnom (moda) 777a8f2fed [IMP] pos_restaurant: add preparation display requirement
*:point_of_sale,pos_restaurant,web

A new module pos_preparation_display has been added to Odoo enterprise.

This PR is intended to add the requirements necessary for it to work
properly.

The changes are mainly related to the kitchen printer functions, as
the pos_preparation_display module reuses these flows in order to
receivethe orders to be prepared.

closes odoo/odoo#109024

Related: odoo/enterprise#35392
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-03-07 14:10:41 +01:00