Commit Graph
315 Commits
Author SHA1 Message Date
vlstandJoseph Caburnay 00dcc575b8 [IMP] point_of_sale,*: integrate combos in pos ui
*: 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=0

closes odoo/odoo#129483

Task: 3430636
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Co-authored-by: Joseph Caburnay <jcb@odoo.com>
2023-09-04 08:03:34 +00: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
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +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
Louis Wicket (wil) f1722c7334 [IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.

closes odoo/odoo#123932

Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-10 18:14:04 +02:00
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00
Xavier Luyckx (xlu)andvlst <vlst@odoo.com>, Pedram (pebr) c087603d0b [REF] pos*: introduce bootstrap
pos*: point_of_sale,pos_discount,pos_hr,pos_loyalty,
pos_restaurant,pos_sale,pos_sale_product_configurator,pos_six

Prior to this commit, the point_of_sale module relied on custom CSS.

To enhance user experience, increase flexibility, and simplify maintenance,
most of the custom css was replaced in this PR with Bootstrap utility classes.

Task: 3354582
Authored-by:  Xavier Luyckx (xlu) <xlu@odoo.com>
Part-of: odoo/odoo#129544
Co-authored-by:  vlst <vlst@odoo.com>,  Pedram (pebr)
2023-07-28 16:28:45 +02:00
vlst 83b45b3be9 [REF] pos*: adapt imports
pos*: l10n_ae_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_restaurant_adyen,pos_restaurant_stripe,
pos_sale,pos_sale_loyalty,pos_sale_product_configurator,pos_six,
pos_stripe

In the previous commit, we moved and renamed files such that they
better follow certain guidelines.

In this commit, we adapt imports accordingly.

In order to efficiently accomplish this task, i used the following [script](https://github.com/vlst-odoo/tools/blob/main/fixImports.py)

Task: 3394192
Part-of: odoo/odoo#127056
2023-07-25 08:18:58 +02:00
vlst bd1331f81e [REF] pos*: structure static files
pos*: l10n_ae_pos,l10n_co_pos,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_restaurant_adyen,pos_restaurant_stripe,pos_sale,
pos_sale_loyalty,pos_sale_product_configurator,pos_six,pos_stripe,

The POS has a large number of add-on modules. As such, it is
important that they all respect strict guidelines when it comes
to file structures.

Before, each module had more or less it's own rules when it came to
this, apart from the fact that code was mostly organised into
`js` and `xml` folders.

In this PR, we move to a much more structured approach,
in which each module follows the following pattern:

src/
|-- app/  <-- the module's own new logic
|-- overrides/
|   |-- components
|	|   |-- overridden_component_a
|	|	|   |-- overridden_component_a.js
|	|	|   |-- overridden_component_a.xml
|	|	|   |-- overridden_component_a.css
|   |-- models
|	|   |-- overridden_model.js

Apart from the structural changes, this PR introduces changes
to file names, such that they respect the default pattern of
snake_case naming.

In this commit, we move the files. In the following one we
make the needed changes in the code, such as adapting imports.

In order to efficiently accomplish this task, i used the following [script](https://github.com/vlst-odoo/tools/blob/main/rename.py)

Task: 3394192
Part-of: odoo/odoo#127056
2023-07-25 08:18:57 +02:00
momegahed c378868f16 [FIX] pos_discount: remove rounding from discount
Summary
-------
Currently, in POS, global discounts percentages are rounded to the
nearest *whole* number.

Steps to reproduce
------------------
- install the Point Of Sale
- activate Global Discounts on a POS
- start a session and add a product
- add a 5.5% global discount

Look at the added 'Discount' line, you should see that its amount
doesn't match the discount. (6% is applied instead of 5.5%)

opw-3347127

closes odoo/odoo#128111

X-original-commit: cbe314e35911f8c71987f2ae21a0fe446d97c360
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-07-12 07:40:24 +02:00
Javier Vega 6603b5ae49 [IMP] pos_discount: using helper method to retreive applicable lines global discount
We added a new method to identify if the current pos.order.line can be discounted
in a global discount, fromt he pos_discount, module.

This in order to be inherited from third ones.

closes odoo/odoo#127232

X-original-commit: 0c441737308bf7f47193c64d3e29c895154c3df8
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-07-07 15:28:01 +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
vlst e82f75d66f [IMP] point_of_sale, *: Unify price type field
*: 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.

closes odoo/odoo#124858

Task: 3358265
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-06-14 10:53:57 +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
Martin Trigaux 2afdda2576 [I18N] *: export saas-16.3 source terms
closes odoo/odoo#123046

X-original-commit: 137f5ca0cb703ee953cb01db525362f7a778e6bd
Related: odoo/enterprise#41703
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-01 11:43:51 +02:00
Louis Wicket (wil) 04189318cc [I18N] *: update master translations
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.

This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).

closes odoo/odoo#121629

Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-22 17:52:07 +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
roen-odoo b13e9f5fdd [FIX] pos_discount: stop applying discount to tips
Current behavior:
When adding a tips to an order, then applying a global discount. The
discount is applied to the tips when it should not.

Steps to reproduce:
- Open POS
- Add a product to the order
- Add a tips to the order
- Apply a global discount
- The discount is calculated on the tips and the products

opw-3271886

closes odoo/odoo#121071

X-original-commit: 97c7ebcd203de64da43a74e298d6bfab08694c5c
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2023-05-11 16:01:19 +02:00
Samuel Degueldre c313f5912f [REF] *: stop using assets_backend in the pos
*: l10n_ae_pos, l10n_co_pos, l10n_fr_pos_cert, l10n_gcc_pos,
l10n_in_pos, l10n_sa_pos, point_of_sale, pos_adyen, pos_discount,
pos_epson_printer, pos_epson_printer_restaurant, pos_hr,
pos_hr_restaurant, pos_loyalty, pos_mercury, pos_restaurant,
pos_restaurant_adyen, pos_restaurant_stripe, pos_sale, pos_sale_loyalty,
pos_sale_product_configurator, pos_six, pos_stripe, web

Previously, the pos assets included almost the entirety of the
assets_backend. Most of the contents of the assets_backend is completely
useless in the PoS, meaning that the PoS will load slower because it
loads much more JS than it needs. It also means that it gets all the
side effects of this bundle (global event listeners, among other things)
that we don't want.

This commit removes the dependency of the pos assets on the
assets_backend to solve these issues. The pos assets are now their own
bundle with only what is needed in the PoS.

As for the unit testing bundle, the same logic applies but
unfortunately, because the unit testing code from web that we want to
use (eg automatic cleanups, cleaning of registries, etc) depends on the
legacy code, we need to include a lot more files than would otherwise be
needed. This situation will probably be improved as legacy code is
removed from web, but in the mean time, it is not very important for
this bundle to be lean, as it's a test bundle and loading speed is less
important.

Linked to: odoo/enterprise#40502

closes odoo/odoo#120070

Related: odoo/upgrade#4626
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-05 17:06:38 +02:00
Adrien Guilliams (adgu) 72e9034f9f [IMP] pos, l10n_fr_pos_cert: change price_manually_set behaviour
The price_manually_set variable was used to largely, we fix it
by adding a price_automatically_set variable. The price_manually_set
is now used when changing the price through the numpad, whereas
price_manually_set is used to indicate that the price is not
the price set in the database.

closes odoo/odoo#119362

X-original-commit: aa4f346d27aa28c23f8ee02fe73b892a1f5ef2dc
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-04-27 02:44:40 +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
Martin Trigaux 1be5eae8ef [I18N] *: remove nl_BE files
They dates from < 2027 and are quite outdated. Favour the nl
translation instead.
n_BE is not on Transifex so it was not possible to correct bad
translations.

closes odoo/odoo#115845

X-original-commit: d04c8b7e484db8306d858c891a7a2b11885fdcd9
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-03-20 16:51:30 +01:00
David Monnom (moda) c7fbae7a34 [REF] point_of_sale, pos_*: remove usage of useListener
*:point_of_sale,pos_ayden,pos_discount,pos_hr,pos_loyalty,pos_mercury,
pos_restaurant,pos_sale,pos_six

Previously, the point of sale and related modules made heavy usage of
`useListener`. This is because the pos was converted early to owl, and
in owl 1, using events to communicate between components was encouraged.

In owl 2, the decision was made to stop encouraging this way of
communicating between components, because it encourages communication
accross many layers of components, and is also hard to debug. In
addition, in owl 2, because components can have 0 or more than node,
including non HTMLElement nodes like text or comment nodes, owl removed
the implementation of useListener, as useListener relies on the presence
and unicity of a root HTMLElement per component on which we can attach
event listeners.

Another problem is that events rely on the fact that the components are
in the DOM so that the event can propagate, which can lead to issues in
some cases and in particular, in the PoS, if you load the point of sale
and switch tabs, some things will be broken because we are triggering
events, but there have not been any animation frame fired in the tab
because it's not focussed, and so owl has not mounted the component yet.

When migrating odoo to owl 2, we introduced a shim for this.el and
useListener in LegacyComponent, with the hope to remove it as soon as
possible.

This commit removes all usage of useListener from the pos modules for
those reasons. In some cases, useListener was incorrectly used intstead
of t-on, and the event was triggered and handled by the same component,
in other cases, a simple callback could be passed to a child component.
In a few cases, a method had to be implemented on the store as we wanted
this method to be available everywhere.

closes odoo/odoo#112219

Related: odoo/enterprise#36888
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-02-27 09:37:12 +01:00
Samuel Degueldre 6d8ebdf829 [REF] point_of_sale, pos*: remove PosComponent
*: pos_discount, pos_hr, pos_loyalty, pos_restaurant, pos_sale, pos_six

Previously, all components in the pos and related apps would inherit
from the PosComponent base component, this component contained a bunch
of methods that were as such available on every component in the pos
passively. In previous commits, a bunch of these methods have been moved
either to the pos store or to their own services, so that component
dependencies are explicit instead of every component having a clobbered
namespace and having access to everything implictly.

This commit factors out the last method of the PosComponent,
`setSyncStatus` and as such the PosComponent is now empty and can be
removed completely, as can the Gui singleton utility which was used to
access these methods from outside of components.

Components in the pos modules now inherit from LegacyComponent which
PosComponent extended. The end goal is to remove the use of
LegacyComponent as well, but currently it is still needed as components
in the pos modules make extensive use of `useListener` which requires
the shim for `this.el` provided by LegacyComponent. This is nonetheless
a first step in that direction.

This commit also removes some components that were used in the navbar as
they were very small and it made more sense to just have the behaviour
they implement directly in the navbar component or elsewhere. Most of
the CashMoveButton was moved to the CashMovePopup, the TicketButton has
so little behaviour that moving that behaviour to the navbar itself
makes sense.

closes odoo/odoo#112295

Related: odoo/enterprise#36860
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
2023-02-09 18:07:23 +01:00
Samuel Degueldre 0d537e58a9 [REF] pos*: move show(Temp)Screen, make number_buffer and popup services
*: l10n_fr_pos_cert, point_of_sale, pos_discount, pos_hr,
pos_hr_restaurant, pos_loyalty, pos_mercury, pos_restaurant, pos_sale,
pos_sale_product_configurator, pos_six, pos_stripe

Continuing to move things out of the Chrome god component, this commit
does the following things:

 - moves the showScreen and showTempScreen methods and the corresponding
closing methods into the pos store so that components that need them can
access them through the pos service in a more explicit way. To that end,
these methods have been removed from PosComponent and Gui.

 - introduces a popup service instead of using a bus in the env, this is
mechanically very similar but closer to what's done in web and hopefully
a first step to using the dialog service instead. It also removes the
showPopup method from the PosComponent and Gui, to make components
depending on the popup service explicit.

 - makes the number buffer into a service instead of being a directly
imported singleton, which will enable it to be used with hooks instead
at a later point, and allows easier dependency injection in tests.

 - removes showNotification from the PosComponent and Gui, the
notification system was already converted to a service in a previous
commit for the same reasons as showPopup and the end goal is to use the
notification service from web to reduce duplication.

closes odoo/odoo#111844

Related: odoo/enterprise#36668
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-02-07 16:38:34 +01:00
Rahul PrajapatiandSamuel Degueldre b119cca37b [REF] point_of_sale, *: remove class and component registries
*: l10n_co_pos, l10n_fr_pos_cert, l10n_gcc_pos, l10n_in_pos,
l10n_sa_pos, pos_adyen, pos_discount, pos_epson_printer,
pos_epson_printer_restaurant, pos_hr, pos_hr_restaurant, pos_loyalty,
pos_mercury, pos_restaurant, pos_sale, pos_sale, pos_sale, pos_sale,
pos_sale, pos_sale, pos_sale_loyalty, pos_sale_product_configurator,
pos_six, pos_six, pos_six, pos_six, pos_stripe, pos_stripe

Previously, the point of sale module used a custom inheritance system
for models and components. This system being non-standard, it makes it
hard for newcomers to understand how to use it or for people with
experience in the pos code base to understand how things are done
elsewhere. This commit removes the "registries" system from the pos
modules and adapts existing code to use standard inheritance mechanisms,
ie extending classes directly, and using patch to modify behaviour in
place.

task-3119628

closes odoo/odoo#109928

Related: odoo/enterprise#35795
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2023-01-23 16:01:27 +01:00
Samuel Degueldre 990b10aece [REF] point_of_sale, *: convert legacy modules to ES odoo modules
*: l10n_co_pos, l10n_fr_pos_cert, l10n_gcc_pos, l10n_in_pos,
l10n_sa_pos, pos_adyen, pos_discount, pos_epson_printer,
pos_epson_printer_restaurant, pos_hr, pos_loyalty, pos_mercury,
pos_restaurant, pos_restaurant_adyen, pos_restaurant_stripe, pos_sale,
pos_sale_product_configurator, pos_six, pos_stripe

We are about to refactor most of the Javasript code base of the point of
sale and related modules. In doing so, we will move a lot of files and
modernize the entire code-base. In order to avoid diffcult rebases,
their conversion to odoo-modules is done as a first step to avoid
getting lots of conflicts on files that were unindented, which marks the
entire file as being in conflict. Conflicts will occur during forward
ports but they will be easier to manage as the changes will be much
smaller in scope, and the author will have the context of the change
that causes the conflict in mind when dealing with it.

closes odoo/odoo#107621

Related: odoo/enterprise#34910
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2022-12-14 11:41:52 +01:00
Martin Trigaux 1a8772769e [I18N] *: export 16.0 source terms
closes odoo/odoo#100573

Related: odoo/enterprise#31507
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-20 13:48:49 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Jacky (trj) a520745230 [IMP] point_of_sale: visual improvement
Small visual changes that should improve the user experience.
The loading demo data popup has been moved to the backend.
Created an Alert Popup that is less aggressive than an Error Popup

closes odoo/odoo#83780

Task-id: 2485062
Related: odoo/enterprise#26104
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-08-08 10:50:14 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Eleftherios Kritsotakis 0dd267a270 [FIX] point_of_sale: global discount taxes
In this commit we fix the tax calculation
when applying a global discount in PoS.

Before this commit, when applying a discount
tax was calculated properly only in the use
case where in one order we had:
- products with a single one tax

After this commit, the calculation of discount
and taxes is extendeted to include these additonal
use cases:
- products with more than one tax applied to them
ex. Product A -> 10% + 20%
- products with different taxes in the same order
ex. Product A -> 10%
      Product B -> 20%
- products with taxes that are included in prices
ex. Product A -> 10% (included in price) + 20%

Overall, we tried to follow a general approach
that will include as many use cases as possible
and every combination between them.

task-2421429

closes odoo/odoo#90505

Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-07-29 15:52:53 +02:00
Joseph Caburnay 48aff86c42 [FIX] point_of_sale,*pos*: remove 'pos' field attribute
With this change, we are now assuming each field that starts with
'pos_' to be a 'pos.config' field that has value that will be saved
to the 'pos_config_id' record. We made that modification because by keeping
some related fields not written at the same time can trigger contraints at the
wrong moments that would lead to validation errors when not supposed to be.

Part-of: odoo/odoo#97032
2022-07-29 01:51:13 +02:00
Martin Trigaux 5acb6db891 [I18N] *: export saas-15.4 source terms
closes odoo/odoo#93246

X-original-commit: 5ff6d185f70650c26c28a6aef7dd37c859ab58d2
Related: odoo/enterprise#28218
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-06-10 07:27:26 +02:00
Joseph Caburnay fa111d449d [IMP] point_of_sale,*pos*: configure pos from general settings
Purpose:

- Move PoS settings in general settings to be consistent with the rest
  of Odoo (PoS being the only app where settings are split in two locations)
- Clean settings by enabling obvious settings or dropping unnecessary ones.

closes odoo/odoo#84719

Task-id: 2753430
Related: odoo/upgrade#3260
Related: odoo/enterprise#24425
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-06-03 16:39:51 +02:00
Martin Trigaux 9fbf706ba8 [I18N] *: export saas-15.2 translations
closes odoo/odoo#84475

X-original-commit: 8ea2605fbfec6277d7a01b6e73548a9585866c61
Related: odoo/enterprise#24289
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-02-14 10:44:50 +00:00
+2 0c7910529d [REF] point_of_sale,pos*: adapt code to owl 2
Owl 2 changelog: https://github.com/odoo/owl/blob/a9f29c4caad4f32d06be1ec4780572825781cd9b/CHANGELOG.md

Part-of: odoo/odoo#80156
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2022-02-10 07:46:13 +00:00
Joseph CaburnayandJacky 8fb53c53c3 [REF] point_of_sale,*pos*: remove Backbone.js, single loading request
This commit accomplishes multiple objectives:

1. Loading of model data for the POS UI is now done in single
request (with some exemptions).
2. Backbone.js is removed and is replaced by reactivity.js
authored by the js framework team.
3. Better organization of assets in the `__manifest__.py`

Data Loading
------------

One request per model -- that's always been how the data is loaded
in POS UI. Now, we move the aggregation of data to the backend which
simplified the data loading. In the frontend, data loading is
initiated in `load_server_data` which makes the single rpc call
to the `load_pos_data` defined in `pos.session` model.

There remains some rpc calls during loading but the number is
greatly reduced.

This change result to faster loading of the POS UI. However,
there is no more progress bar during the loading.

Notable entry points:

- .js: `PosGlobalState.load_server_data`
- .py: `pos.session.load_pos_data`

It is possible to make customizations in the loading, but is done in
several steps:

1. Override `_pos_ui_models_to_load` to include the new model to load.
2. Define `_loader_params_<model_name>` to define the `search_params` and
optional `context`.
3. Define `_get_pos_ui_<model_name>` to return the data that will be
included in the full `loaded_data`. Perform the organization in this method
whenever necessary.
4. Override `_pos_data_process` for further post processing. The final
form of `loaded_data` in this method will be sent to the frontend.

Removal of Backbone.js
----------------------

POS is no longer dependent from `Backbone.js`, but it's replaced by a
new dependency -- `reactivity.js`. It's invented by the js framework
team which will be available in owl v2.

The consequences of this change are the following:

1. The old `PosModel` is renamed to `PosGlobalState`.
2. The name of the other models are kept (except Paymentline which
is renamed to Payment).
3. The name `PosModel` is now used as the base model of the data models.
This is symmetric to our use of `PosComponent`.
4. The instance of `PosGlobalState` is made reactive in `Chrome` (the
root component). As a result, whatever mutation made in that instance,
`Chrome` will rerender. But rendering is batched so multiple mutations
in a single sychronous function call will only result to a single
render call.
5. `PosModel`s can be extended in the `Registries` the same way as we
extend the `PosComponent`s.
```js
// E.g.
Registries.Component.extend(Chrome, PosResChrome);
Registries.Model.extend(Order, PosResOrder);
```

Reorganization of assets declaration
------------------------------------

This is a simple change that replaced the explicit enumeration
of loaded .js and .xml files. Also, we now have regions in the
manifest separating:

1. Augmentations of dependencies
2. Assets for `point_of_sale.index`
3. Assets for the qunit test (soon will be improved)

Other notable changes
---------------------

- Automatic call to `Order.save_to_db` is batched.
- Instances of `devices.DeviceProxy` (`proxy`), `devices.JobQueue`
(`proxy_queue`) and `BarcodeReader` (`barcode_reader`) are moved
to `point_of_sale.env`. Together with `posbus` and `posMutex`
(previously `flush_mutex`).
- `ActivePrograms` is now passed a props.
- `cashier` is no longer saved to `localStorage`.
- `pos_cache` is overhauled.
- `cache` is taken out from `PosDB` to prevent infinite rendering
loop whenever `cache` is mutated. It's now called `CACHE` in
the `db.js` file.
- reactive version of `posmodel` is exposed globally when in debug mode.
This means that calling when calling a mutator, the UI will react.
- Added control buttons in the `ProductScreen` is sorted during `Chrome`
setup. As a result, we don't need to worry on the loading order of the
control buttons components.
- Model can be simply instantiated using `BaseModel.create(obj)`. This
takes into account the extensions.
- `pos_coupon`: rewards are now updated whenever set_order is called.
- Component unit tests were removed. It wasn't useful and it just blocks
the development. We'll be introducing better unit testing later.

closes odoo/odoo#82461

Related: odoo/enterprise#23344
Signed-off-by: Masereel Pierre <pim@odoo.com>
Co-authored-by: Jacky (trj) <trj@odoo.com>
2022-01-27 21:50:25 +00:00
Joseph Caburnay 123b705677 [FIX] pos_discount: pos app is stuck when changing the discount
To reproduce:
1. Install pos_discount and pos_coupon.
2. Start a session and add item to the order.
3. Add global discount.
4. Change global discount. Stuck.

This is because in some modules, get_orderlines is overridden. Instead
of returning the original object containing the orderlines, it returns
a different array instance containing the lines. This is the reason the
while loop is stuck. With this change, whether get_orderlines return the
container or a copy, we are sure that it won't be stuck in the for loop.

closes odoo/odoo#81011

Task-id: 2697861
X-original-commit: 6d78748794a2db3f324312fc773f7a48fd0ffba4
Signed-off-by: Masereel Pierre <pim@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2021-12-07 19:27:40 +00:00
Xavier-Do 288595f558 [FIX] *: add explicit license to all manifest
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.

closes odoo/odoo#74245

Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-07-26 13:09:57 +00:00
Martin Trigaux 6758868731 [I18N] *: export saas-14.4 source terms
Without demo data

closes odoo/odoo#73560

X-original-commit: 802e46541117573e028b711ea33dad9df9075a39
Related: odoo/enterprise#19602
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-07-12 10:57:37 +00:00
Julien MougenotandSimon Genin 03641610c2 [REF] *: convert all modules to new asset system
Conversion of all modules to the new manifest assets declaration.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:18 +02:00
Jacky (trj) 13843f8545 [IMP]: point_of_sale UI: NumberPopup and NumberBuffer can pre-select input which will change the value upon triggering a key
The user doesn't need to delete the current input before changing it. He can now write
hiw new value which will erase the current one.
The guest popup from the `pos_restaurant` module and the global discount popup from the
`pos_discount` module benefit from this and have their input pre-selected.

Before: when opening the guest or discount popup, the user always has to delete the curent
value before changing it. Let's say that the current value was `5`, the user needs to either
press the `Delete` or `Backspace` button/key before entering his new value.

After: the user doesn't need to press the `Delete` or `Backspace` button/key and can now directly
enter his new value

Task ID: 2419637
2021-02-25 09:47:50 +00:00
Pierre Masereel cd61b662e7 [FIX] point_of_sale: discount product with tax
When you are using a discount product with a tax, you get a traceback
when trying to add the discount. It is caused by a typo and is fixed
here.

closes odoo/odoo#63550

X-original-commit: b389dcabf49fd05c5239d68fd26ef4239963a7e5
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-12-17 16:14:08 +00:00
Joseph Caburnay 18b5efb42d [IMP] point_of_sale,pos_*: replace 'save' buttons
Replace save buttons in each module field in pos.config with a message.
Saving the pos.config form when a module_ or group_ field is modified
will reload the page.

closes odoo/odoo#51535

Related: odoo/enterprise#10669
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-09-17 07:54:03 +00:00
Martin Trigaux 90d85eb9c5 [I18N] export saas-13.5 source terms
Without demo data

closes odoo/odoo#56869

X-original-commit: 33f251b6489455cd7221f2c62dee0400a69784b8
Related: odoo/enterprise#12836
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-01 11:18:00 +00:00
Nicolas Martinelli f3f07434f6 [FIX] point_of_sale, pos_discount: install discount when session open
Commit 4c4adf472453de65e45e fixed the `pos_discount` installation in
case of a session is already opened. However, this breaks the following
condition:

https://github.com/odoo/odoo/blob/8aa952d18acca5a0ac3b32579e812158e641c13c/addons/point_of_sale/views/point_of_sale_dashboard.xml#L67

The `current_session_id` is always filled in for any user, so the badge
is not shown anymore.

We can keep the same logic than the mentioned commit but without
impacting the computation of `current_session_id`.

closes odoo/odoo#53412

closes odoo/odoo#53858

X-original-commit: 7e0e89cbf5d09c106936a582e27af527535103f6
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-06-30 10:18:22 +00:00
Antoine Prieels 1759a17c0e [IMP] point_of_sale: Hide tips and discount products
Hide the tips and discount products from the ProductScreen.

TaskID: 2276054
2020-06-12 12:13:22 +00:00
Pierre Masereel eabbd3558f [REF] pos_discount: migration to OWL framework 2020-05-12 12:52:23 +00:00