Commit Graph
23 Commits
Author SHA1 Message Date
Géry Debongnie 4a5dc95fb3 [FIX] sale: sol_product_many2one should not crash
The `sol_product_many2one` field is a sub many2one field that should
open the proper configuration system, such as the product configurator.

Before this commit, when inputting some data, then clicking on another
notebook tab, we would often see a crash, because the field has been
destroyed (since it is no longer in the current tab) and it tries to
open the configurator, which requires rpcs.

It is usually a problem when a destroyed component tries to perform some
work. Note that it happens at creation and update. Also, the field
overrides some many2one methods that display confirmation dialog. To fix
this, this commit simplifies the field by only calling the configuration
methods when its value has changed. This is a different strategy that
does not interfere with the many2one basic features. Also, it does not
crash since it will only call the configuration methods on patched, so
it is guaranteed to be alive.

It is certainly not a complete solution, since we should probably move the
code somewhere else not in a field widget, but this would require a
redesign of the code, so it is not appropriate in a bug fix anyway.

Note that the tour had to be adapted, since now the methods
_onProductUpdate/_onProductTemplateUpdate are now called in an effect
(so after a render), which is slightly later than before. But the tour
would click on confirm even before the product update code was executed,
which means that the product was not properly configurated.

This is clearly a concurrency problem: the product configuration code
should be properly coordinated with the basic model, but doing so is a
significative change. Also, in practice, it is not worse than before
this commit.

opw 3178297

closes odoo/odoo#127048

X-original-commit: de7a6f5f3d83356eb02f8fc25b4a0b8aabb946b3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-07-03 15:37:32 +02:00
Michael (mcm) ff0d6dd580 [REF] *: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117305

Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:24 +02:00
Géry Debongnie b53f78e224 [REF] web_tour,*: use the registry in collecting the tours
This is a step closer to a goal of avoiding dependence on asynchronous
modules. Starting from this commit, new tour definition should be
registered to `registry.category("web_tour.tours")` registry.

So, instead of the following:

```js
import tour from "web_tour.tour";
tour.register(name, options, steps);
```

We now do:

```js
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add(name, optionsWithSteps);
```

Notice the `options` and `steps` params are merged when registering
the tour definition. It should look something like so:

```js
registry.category("web_tour.tours").add("account_tour", {
  test: true,
  steps: [ ... ],
});
```

And if the `TourManager` instance is needed, one can get it from the
registry like so `registry.get("tourManager")`. Note however that
this instance is only available when the `TourManager` has been
instantiated -- so it's not available at top level of the module.

closes odoo/odoo#111103

Related: odoo/enterprise#36335
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-01-27 23:17:35 +01:00
Victor FeyensandHoracio Tellez Perez ab7846be8e [REF] sale: convert sale order view to OWL
* Configurators (sol_product_field)
* Discount (sol_discount)

Task-2918791

X-original-commit: 27ee2899cbec65b05135d3f12bcf8f6fc8adc241
Part-of: odoo/odoo#101352
Co-authored-by: Horacio Tellez Perez <hote@odoo.com>
2022-09-28 11:14:35 +02:00
Horacio Tellez bf3942b553 [IMP] sale: progressbar js logic migration to owl framework
This PR is part of the whole migration of the sale javascript
code and related code to the owl framework.
Why: better developmet framework for javascript code in odoo.

This PR in particular targets the progressbar of sales team
appearing on the CRM app.

Task - 2918635

closes odoo/odoo#95565

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-08-08 10:50:54 +02:00
Demesmaeker 08aff3b686 [FIX] (test_)sale(_product_configurators): fix nightly race condition
Fix some uncommon nightly error on the runbot where a race condition
happened when the tour finished too soon. The test is successful but
during the browser cleanup, things are still happening.

task-2832564

closes odoo/odoo#91920

Related: odoo/enterprise#27600
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-06-30 18:51:54 +02:00
Aaron Bohy 4f984568e1 [REF] *: adapt code to new kanban view
This commit makes various adapations in addons with respect to
the introduction of the owl kanban view. Mainly, some selectors
in scss and in tests needed to be adapted. Moreover, in some tests
that we haven't adapted yet, we must ensure that legacy form and
list views are still used (useLegacyViews).

It also contains some adaptations in kanban templates, e.g. the
replacement of moment by luxon, the removal of underscore...

Part-of: odoo/odoo#92475
2022-06-30 09:29:45 +02:00
Leonardo Pavan Rocha 4e62c2847f [FIX] sale: remove click auto tour step
In the sale_signature tour, there was a step for entering auto mode when
signing for a payment. Since now the auto mode is selected by default,
it's not necessary to set it anymore.

task-2862209

closes odoo/odoo#92340

Related: odoo/enterprise#27793
Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-06-03 12:02:17 +02:00
Géry Debongnie 95880ab7b4 [REF] sale: simplify code for sales team progressbar
The kanban view for sales team is defined with a progressbar widget to
indicate sales target. There was a .include of KanbanRecord to customize
the behavior of that widget whenever the target value was not set.  This
was problematic for the following reasons:

1. it is a .include, so it is applied to all kanban records in odoo
2. it is a lot of code,
3. and it mostly duplicate the editing logic in the progressbar widget

With this commit, the .include is removed, and a new
'sales_team_progressbar' widget is introduced to mimic the previous
customization. This should be safer and easier to maintain.

closes odoo/odoo#92071

Related: odoo/enterprise#27747
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-05-25 20:31:42 +02:00
Pierre Paridans 333a4e8733 [FIX] purchase_product_matrix: test breaking in newer Chrome (rounding)
Since (at least) Chrome 94+, some element's sizing computation returns a
slightly different value (in the order of a fraction of a pixel). Sadly,
due to rounding, this difference has an impact on exact sizing
assertion.

Specifically in these drag-and-drop tests, it prevents the sorting from
being triggered as the "mouse" doesn't pass beyond the center of the
destination element (aka. next row).

By setting the position to `bottom`, this commit mitigates this issue by
making sure to pass that boundary, just like a real-user would do.

closes odoo/odoo#92292

X-original-commit: ed798b216063caa299800a56c617277aabdfb8fd
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-05-25 18:01:03 +02:00
Aaron Bohy 25aaf7afcf [FIX] sale,*: product_configurator: can drag&drop row
*sale_product_configurator

Since commit 50bf830, a crash occurred when a row containing a
many2one displayed with widget 'product_configurator' was dragged
and dropped.

For instance, open a quotation with at least two rows, and drag and
drop one of them.

Issue reported on task 2206228

closes odoo/odoo#48128

X-original-commit: d9c35b40b7df588f9e81142a2b272d9c7da06e04
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-20 15:44:47 +00:00
Romain Derie fdbf11643f [IMP] *: move test and tour files to new folder hierarchy and asset
As we now have a new debug mode 'tests' which load a new asset bundle
containing tour-test files, we moved those files to a new folder hierarchy.
That will clean the .js files trees.
Also, those files should be included in the new asset.

Basically, the .js tour files (not test) should be inside /static/src/js/tours
while .js tour test files (test=true) should be inside /static/tests/tours next
to QUnit tests, inside a tours folder.

+ test_new_api: don't run the test in debug assets

task-1934445
Comes with https://github.com/odoo/enterprise/pull/4281
Closes #33213
2019-06-05 05:56:33 +00:00
Aurélien Warnon 3cb46ec74c [ADD/MOV] sale_product_configurator: new module and files move
Purpose
=======
- Moved the product_configurator into its own module now that we have a specific option for it.
  The option only enables the p. configurator in the SO form.
  The e-commerce should always allow customer to configure their products, even if the option is not checked.

  This allows moving some of the code specific to the p. configurator into its own module.
  However, a lot of the code has to remain in "sale" module since the e-commerce does not require the option
  checked and needs the "configure product" feature in the shop by default.
  (This is why the fields "product_custom_attribute_value_ids" and "product_no_variant_attribute_value_ids"
  are still in the "sale" module)
2019-03-27 15:12:50 +00:00
bc76549a7d [REF] sale: adapt code after jQuery update
Part of task 1896658

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-03-06 20:07:17 +01:00
Christophe Simonis ce4cc24621 [MERGE] forward port branch 12.0 up to 82a1e1dcc3 2018-11-29 20:06:16 +01:00
Christophe Simonis f5c3dafb04 [MERGE] forward port branch saas-11.3 up to c0eef42711 2018-11-29 18:38:55 +01:00
Géry Debongnie abf32b8b21 [REF] *: update js test suite to use helpers
This rev. introduces robust helpers to use in the JS tests suite to
interact with DOM and components, and starts using them (almost)
everywhere.

All the helpers are exposed though testUtils.js.

There are 2 kinds of helpers:

1. Assertions
-------------
 * assert.containsNone, containsN, containsOnce check that the DOM
   (or a specific part of the DOM) contains a `selector`. It
   generates a correct error message automatically.
    ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg");
        -> assert.containsOnce(form, '.o_form_editable');
 * assert.isVisible, isNotVisible check that the DOM has an element
   visible or not. They also check that the element is actually in
   the DOM (before most tests didn't verify this).
 * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific
   properties of a DOM element, and also validate that it is
   applied on a single existing DOM element (before most tests
   didn't verify this).
    ex: assert.notOk(form.$('button').hasClass('btn-primary'));
       -> assert.doesNotHaveClass(form.$('button'), 'btn-primary');

2. Utilities
------------
The goal of the utilities is to centralize the definition of many
standard components and interactions, ensuring that when we
refactor the JS framework, we do not need to change all the tests.

Existing mock utilities (addMockEnvironment, intercept, path,
patchDate, unpatch and fieldsViewGet) are moved to
'testUtils.mock.*'.
Existing DOM utilities are moved to 'testUtils.dom.*'.
New dom utilities are created for opendDatePicker, click,
clickFirst and clickLast. Helper `click` verifies that there is
exactly 1 element visible in the DOM you click on, `clickFirst`
and `clickLast` verify that there are more than one element on the
DOM.
 ex: form.$('button').click();
     -> testUtils.dom.click(form.$('button'));

New Form utilities: (testUtils.form.*)
 clickEdit, clickSave, clickCreate, clickDiscard, all clicks on
 the control panel buttons of the form.
 `reload` reloads the form data.

New modal, graph, kanban and pivot utils (testUtils.pivot.*,
testUtils.kanban.*, etc.).

New fields utils: (testUtils.fields.*)
 * editInput, editSelect: allow to change the value of a field,
   using a selector to identify it. They validate that the input
   exists and trigger the change event automatically.
 * editAndTrigger: allow to modify a field and trigger specific
   events after the value change
 * many2one (testUtils.fields.many2one.*)
   clickOpenDropdown, clickHighlightedItem, clickItem,
   searchAndClickItem: use a field name instead of a selector and
   do all the complex mechanism to open, filter and highlight
   many2one fields.

Joint work with aab, dam, ged, mge, svs and vsc.
2018-11-19 11:24:28 +00:00
Lucas Perais (lpe) 4be90e98d7 [FIX] sale: sales team target set on kanban
Have a sales team without a target in the kanban view
click on define a target

Before this commit, the veiw wasn't rerendered, so the change apparently did not happen
(while the write was triggered)
Also, the Enter key did not work to validate the input

After this commit, the view is refreshed and the enter key works

OPW 1906938

closes odoo/odoo#29055
2018-11-27 08:49:48 +00:00
Christophe Simonis 5e055a2afd [MERGE] forward port branch saas-11.4 up to f6ca72b3ce 2018-11-02 10:52:55 +01:00
Kinjal Mehta 3aa6c94f5b [IMP] sale: add testcase for fix 7bee068a0
The bug has been fixed meanwhile, but this one adds a testcase, so
it's worth merging it.

Task #1871444
2018-10-29 09:36:30 +01:00
Aurélien Warnon 154fc7d9dd [IMP] product,(website_)sale: Product configurator bug fix
Targets commit d3530eb07e

Purpose
=======

[Follow up JCR testing]

Various bug fixes including:

- optional products dont show when they have variants configured on them
- when no variant is created, you cant choose the product one first time in the ecommerce
- when in debug, attribute and attribute value menu is double
- fix design of default picture in cart summary / product comparison
- fix missing href tag on product comparison "add to cart" buttons
- products with the "Can be sold" box unchecked should not appear in the product configurator
2018-10-01 13:29:09 +02:00
Aurélien Warnon df2ea31ff6 [IMP] (website_)sale: Add custom values for product attributes
Purpose
=======

Product attrivutes can now have custom values.
These values are specified by the user during the SO creation.
They are also available on the webshop frontend.

Specification
=============

add a new mode to generate variants as they are added to the order/cart
- ability to define attribute extra prices & exclude combinations
2018-09-25 18:39:32 +02:00
Aurélien Warnon 856c2e9008 [IMP] product,(website_)sale: Move product options configurator into sale module
Task #1871557

Purpose
=======

- Configure a product from a sales order as easily as in the ecommerce
  The backend uses the same template as the frontend to configure a products and its options

- Display optionnal products of optionnal products in the "sale options" section

- Allow adding exlusions to some combinations of the product and/or
  to some combinations of the optionnal and accessory products

Specification
=============

PHASE I

1. Improve the "Add to cart" with optional products

- When you add an option to cart, move the product to the cart & show the options of this option
- Don't open the option wizard if no option available (in case this module becomes generic,
  it's better to skip this step when it's not needed)
- Display the options right under their related product in the cart

2. Do not allow to add the product as an optional product for itself
Why ?
- No functional sense
- Creates issues in the add to cart wizard

3. Exclude some attribute combinations within the product or with related options and accessory products

- Rename VARIANT PRICES button -> CONFIGURE VARIANTS
- When you click this button and select a value, open form view rather than inline edition
- Form view of variant values:
	- Attribute
	- Value
	- HTML Color Index
	- Attribute Price Extra
	- Not Compatible with: o2m tab with 2 fields: Product AND Attribute Value (of this product)
	  [m2m tag selection]
	- in any new line, autocomplete the current product by default
	- Tooltip: A list of product and attribute values that you want to exclude for
          this product's attribue value. Also applies on optionnal and accessory products.

4. New option to configure a product in a sales order line

- This option is only visible if the corresponding option is activated in the sales settings
- It opens a wizard to select a product template, configure related attribute values
  and select optional products (based on frontend view)
- Attributes not compatible with other selected attributes should not be selectable
- Must work like in the frontend
2018-09-25 18:39:32 +02:00