Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a confirm dialog to a button in a kanban view #32531

wants to merge 5,770 commits into
base: 11.0


None yet
Copy link

efrenba commented Apr 9, 2019

Description of the issue/feature this PR addresses:
Buttons in kanban views does not handle confirm attribute, so they are not able to launch the confirmation dialog.

File: odoo/addons/web/static/src/js/views/kanban/kanban_record.js

Current behavior before PR:

_onKanbanActionClicked: function (event) {

        var $action = $(event.currentTarget);
        var type = $'type') || 'button';

        switch (type) {
            case 'edit':
                this.trigger_up('open_record', {id: this.db_id, mode: 'edit'});
            case 'open':
                this.trigger_up('open_record', {id: this.db_id});
            case 'delete':
                this.trigger_up('kanban_record_delete', {id: this.db_id, record: this});
            case 'action':
            case 'object':
                this.trigger_up('button_clicked', {
                    attrs: $,
                    record: this.state,
                this.do_warn("Kanban: no action for type : " + type);

Desired behavior after PR is merged:

var Dialog = require("web.Dialog");

_onKanbanActionClicked: function (event) {

        var _this = this;
        var $action = $(event.currentTarget);
        var type = $'type') || 'button';

        switch (type) {
            case 'edit':
                this.trigger_up('open_record', {id: this.db_id, mode: 'edit'});
            case 'open':
                this.trigger_up('open_record', {id: this.db_id});
            case 'delete':
                this.trigger_up('kanban_record_delete', {id: this.db_id, record: this});
            case 'action':
            case 'object':
                var confirm = $(event.currentTarget).attr("confirm");
                if (confirm) {
                    Dialog.confirm(this, confirm, {
                        confirm_callback: object_trigger_up
                else {
                this.do_warn("Kanban: no action for type : " + type);
        function object_trigger_up () {
            _this.trigger_up('button_clicked', {
                attrs: $,
                record: _this.state,

I confirm I have signed the CLA and read the PR guidelines at

kebeclibre and others added some commits Feb 1, 2019

[FIX] website_crm_partner_assign: portal url
With a portal user, receive an email that says "Go to lead/opportunity"
and click on the link

The link's url is /mail/view which is the generic access controller

Before this commit, the user is redirected to the backend,
with fireworks of access errors

After this commit, the portal url is opened

As a side note, in master crm.lead should implement portal.mixin

OPW 193509

closes #30762

Signed-off-by: Lucas Perais (lpe) <>
[FIX] hr_expense: multi-currency
- Set your company to USD
- Create an expense in EUR:
  Amount: 100
  Tax: 15% Excluded
- Validate, post the journal entries

It crashes because of a missing `.id`, but on top of that... not a
single AML is correct.


closes #30987
[FIX] fields: read/write company-dependent fields without…
… access

This is the first step to a more comprehensive handling of company-dependent
fields which are ir_properties.

With model-specific access rights, users should be able to read/update a
company-dependent field no matter their access rights on ir_property.

Before this commit, a user having access to res.partner, but not to
couldn't write on property_account_receivable/payable just because he couldn't
write the corresponding  After this commit, he can.

OPW 1923345
[FIX] models: check groups on inverse fields
Before this, groups on non-stored inverse fields were not checked upon write.
The impact on existing fields is pretty small, since the inverse methods of
those fields are subject to access rights on the records they use.

closes #30357
[FIX] hr_holidays: import used function
Oversight of previous forward-port
[FIX] base_iban: fix acc_number processing
closes #31293

Signed-off-by: Quentin De Paoli (qdp) <>
[FIX] bus: gc event at the end of a polling
When making a poll, an event is registered on each channel. Once
a notification is sent on a channel, only the events of the
notified channel are removed. A pointer to the event is kept
in all other channel the user subscribes to until those channel
are notified.

Since a user usually has many mail.channels but only a few active ones,
a new event and a bunch of pointers are created at each poll and
never removed.

This fix simply remove the pointers to the current event at the
end of a poll.

closes #31215

Signed-off-by: Toufik Benjaa (tbe) <>
[IMP] doc: rewrite part of module structure and js references guidelines
This commit
 * removes deprecated guidelines for static file and assets struture;
 * fixes some typo and mistakes;
 * correctly links JS guidelines section;
 * adds a running example to ease understanding;
 * adds missing section about security files;
 * adds text blocks for each directory to show directly the
   expected result of each section;
 * perform some rewording;

Thanks to @pedrobaeza for its review.

[IMP] doc: add guidelines for window actions naming
Rewording of "action" naming section.

[IMP] guidelines: improve xml ids naming section
* rewording of XML naming section
* remove the convention of suffixing inherited XML ids
  with `_inherit_my_module, as the information is in the
  complete XML id name (prefixed by module name). This will
  avoid too long XML ids.
* extend convention for the name of groups, views, ...

[IMP] guidelines: remove actually wanted PEP8 options

closes #28714

Signed-off-by: Thibault Delavallee (tde) <>
[FIX] hr_timesheet: don't use `dict.fromkeys()` with a mutable defaul…
…t value

When used with a mutable default value, `dict.fromkeys()` builds a dict
where each key references the same value:

    >>> r = {}.fromkeys(['foo', 'bar'], {})
    >>> r
    {'foo': {}, 'bar': {}}
    >>> r['foo']['val'] = 1
    >>> r
    {'foo': {'val': 1}, 'bar': {'val': 1}}

Updating one key's value will change the value for all keys.

closes #31659

Signed-off-by: Jérome Maes (jem) <>
[FIX] point_of_sale: use IoT Box instead of posbox in pos.config + ex…
…plain better

TaskId: #1893479

closes #31747

Signed-off-by: Olivier Dony (odo) <>
[FIX] mrp: start the next workorder in a function to allow for overrides
When a workorder is processed, it starts the next workorder.
We put that logic in a function to allow other modules to override it.

opw 1943674
[FIX] stock: lot action => str to prevent traceback
In a report a lot could be opened with an action that was a number
instead of expected string or falsy value.

In web and web_studio, we sometime expect the action name to be a string
or falsy (calls to `bc.title.trim()` in breadcrumbs code).

closes #31816

Signed-off-by: Nicolas Lempereur (nle) <>
[FIX] base: check that the state matches the country at partner create
Import a list of partners with their addresses.
The state_id field is usually filled with the state codes.
E.g. 'CA' is used for California, but also for Cádiz (Spain), etc.
The import function (db_id_for) uses a name_search on the,
and takes the first matching result.
It follows that the state does not necessarily match the country.

Therefore we add a _check_import_consistency in the create.
Here we check that the country matches the state's country,
try to find a correct match, and if we can't we put the state to False.
Note that if the country is not set both fields will end up set to False:
this is because only a state would mean using a code could give an abitrary

opw 1943904

closes #31599

Signed-off-by: Nans Lefebvre (len) <>
[FIX] product, website_sale: clean dead code
The `_get_pl()` method introduced with bcb3956 was replaced by
`_get_pl_partner_order()` in afe1d20.
After that, it looks like this method was never called again.

Plus, add a missing ensure_one() (not critical).
[FIX] website_sale: limit pricelist to it's website if set
Before this commit:
1. Non Public User would get the main company pricelist returned when calling
   `get_current_pricelist`. As this is saved in an ``
   (`property_product_pricelist`) that is not website dependant, that pricelist
   would always be returned on every website.
   This is a problem if that pricelist is website limited, you should not be
   able to use it on other websites.
2. Public User would not have a valid pricelist on other website than the
   default one. Indeed, every pricelists are restricted that default website.
   It would result in prices shown as "0" (without currency symbol) on the shop
3. Pricelists set as selectable without a website_id set would not be
4. Public User would not get a fallback pricelist when reading its
   `property_product_pricelist`. Indeed, the public user's partner is not
   active and since the refactoring of this field compute method to be a multi,
   it would end up doing a search() instead of a browse(). Thus, it would find
   a pricelist for the public user but it would not set it.

This commit:
1. We override and check that pricelists returnes by the `` are
   indeed available on the current website.
2. Remove the website restriction on `Public Pricelist` so other websites have
   at least one pricelist available.
3. `pricelist_ids` on `website` now return all available pricelists including
   the ones that are generic (no website set)
4. We search for inactive partners too.

Part of this commit fixes part of 27861
[FIX] website(_sale): allow to use and access website pricelist
Before this commit, if the website's company was different than the user
company, the ecommerce would use the user's company instead of its own

Step to reproduce:
  - Set company2 to website1
  - Create a pricelist1 for company1 and a pricelist2 for company2
  - With an user from company1, visit the website1.
  - The pricelist used will be the one from the user, pricelist1 and not the
    pricelist2 from company2 which is the website1 company.
[FIX] website_sale: prevent compute search to be run in sudo
Before this commit, when accessing an user's pricelist, it would raise a 500
error in multi-company environment.
Indeed, when doing `self.env.user.partner_id.property_product_pricelist`, even
if self.env is not un sudo mode, the compute from `property_product_pricelist`
is executed as sudo. Since this method is then doing a `search()`, it won't use
the multi-company pricelist ir.rule. It will return all the pricelist,
including the ones from other companies.
Then, when trying to read that pricelist, it will raise an access error.

Now, we correctly execute the compute (and so the search) in the user env, it
won't get pricelists from other companies.
[FIX] website_sale: fix _get_pl_partner_order
1. Encapsulate `show_visible` to avoid duplicate same code in filtered and to
   make it more easy to read.
2. When GEOIP is enabled, `_get_pl_partner_order` would retrive the available
   pricelists for that country group.
   We should also ensure the returned pricelists are also available on that
3. Rewrite the `country_code` condition in one line thanks to 1.
4. !! Do not use `property_product_pricelist` in the method as it is not cached
   and now it depends website. Anyway it was useless as it was a duplicate of
5. Add `is_public` to the if condition as it was actually implicit as if not
   public it and no pricelists it would go in previous condition and set the
   pricelist from `property_product_pricelist`.
6. The last if condition (`not country_code`) has always been subject to fixes
   and always broke a flow to fix another one (see 60300fc and e11908d, both
   were wrong).
   This condition refactoring should still preserves the beavior fixes
   mentionned in both commits and fix the flow where a logged in user would not
   get selectable pricelists if he has a partner_pl (property_product_pricelist)
   before entering the all_pl filtered.

closes #28301

Signed-off-by: Jérémy Kersten (jke) <>
[FIX] web_editor: insert br within a p
Have a fieldHTML as:
Some text
More text

In the Html field widget, place your cursor before the "M"
press Enter to insert a newline

Before this commit "Some text" and the subsequent `<br>` were deleted
This was because the code:
- split the original `<p>` into two
( i.e. it became
Some text
More text
- took the last child of the first p, which is a text then fell back to the first p
- replaced the whole p with <br>

After this commit, the original p is still split, but we append the br to it instead of replacing it

closes #32777

Signed-off-by: Lucas Perais (lpe) <>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 17, 2019

[IMP] mail: restore support for all report_types in mail attachments
Commit 4801841 introduced a new type: qweb-text.
Commit 3425752 introduced an explicit check on the type, for html or pdf.
This removed the ability to support arbitrary reports through the call to the
generic render method, which dispatches to the correct one for a report_type.
We add support for the text format following the same logic.

The explicit error will be raised if the rendering fails,
e.g. in the case where the render method is not defined.

Thanks to @gdgellatly for reporting.
opw 1966208
closes #28513
closes #30013
closes #32532

closes #32773

Signed-off-by: Nans Lefebvre (len) <>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 18, 2019

simongoffin and others added some commits Apr 17, 2019

[FIX] mrp: Duplicate finished_move_line_ids from by_product in a BOM
Steps to reproduce the bug:

- Create product A (type='product',tracking='lot')

- Create product B (type='product',tracking='lot')

- Create product Z(type='consu',tracking='none')

- Create BoM for product Z with product A as component and product B
as sub_product (i.e. By product) + create any routing (i.e. 1 operation).

- Create an MO for product z, plan it, process the given work order,
input the serial/lot for the components and byproducts...


Two lines for product B were displayed in the finished_move_line_ids of the MO

This bug occured in enterprise because the function _create_checks defined on model
'mrp.workorder' creates the quality checks that create the finished_move_line_ids
for the by_product tracked by lot or by serial number (in fuction _update_active_move_line
defined on model 'mrp.workorder').

So the finished_move_line_ids were created two times with the ones created in fuction record_production
defined on model 'mrp.workorder' in community.

Co-authored-by: amoyaux <>


closes #32779

Signed-off-by: Simon Goffin (sig) <>
[FIX] stock_dropshipping: fix test classes
Commit 52c89ad added a test in v11.
Commit 1e0a92c forward-ported that commit to v12, that already had a test.
As a result, the class TestDropship was defined twice.
It follows that the first test was not executed.

opw 1957701

closes #32792

Signed-off-by: Nans Lefebvre (len) <>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 18, 2019

[FIX] purchase_stock: tax included in multi-currency
- Set the company currency to USD, activate multi-currency
- Create a rate of 0.5 for EUR
- Create a purchase tax T:
  Percentage: 10 %
  Included in price
- Create a PO in EUR with the followind line
  Quantity: 10.0
  Price Unit: 1.0
  Tax: T
- Validate the PO, receive the product

The journal entry is composed of 2 lines:
- debit:  18.18; amount currency:  10.0
- credit: 18.18; amount currency: -10.0

This is not correct: the amount currency should not include the tax.

In order to prevent this, we use the subtotal, and divide by the
normalized quantity (yeah, because it was also failing in case of multi
UoM, as one could have expected).


closes #32797

Signed-off-by: Nicolas Martinelli (nim) <>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 18, 2019

[FIX] base_setup: do not create deleted parameter
The base_setup.show_effect parameter is created at module installation (with
an external id) and is removed (and its external id) when the option
"Show Effect" is unchecked from the general setting.

When this option is checked again, the ir.config.parameter entry is recreated
but without an external id (as it is user-provided data, not from a data file).

When the module base_setup is updated, the record base_setup.show_effect is
recreated and the unicity constraint on ir.config.parameter is raised.

Set the record as forcecreate="False" to avoid recreating it when the module
is updated.
Anyway, if somebody uncheck the option, it is not expected to get it back when
the module is upgraded.

Fixes #32806

closes #32808

Signed-off-by: Raphael Collet (rco) <>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 18, 2019

nim-odoo and others added some commits Apr 18, 2019

[FIX] mrp: mrp_workorder uninstall
- Install 'quality_mrp_workorder' without demo data
- Go to the General Settings

A warning is raised regarding the uninstallation of 'mrp_workorder'.

This is due to `_onchange_group_mrp_routings`, which assumes that the
installation of 'mrp_workorder' is only linked to the group

This is incorrect: `group_mrp_routings` might not be activated, but it
might be in the dependencies of another module. Therefore, we change the
logic: if we activate `group_mrp_routings`, we install 'mrp_workorder'.
If we deactivate `group_mrp_routings` we do not uninstall
'mrp_workorder' if it is already installed, since it might be required
by a dependancy.


closes #32811

Signed-off-by: Nicolas Martinelli (nim) <>
[IMP] mrp: batch-create moves during MO creation
OPW-1967543 on non-trivial multi-level test BOM, MO creation goes from
30s to 13 on my system.

closes #32819

Signed-off-by: Xavier Morel (xmo) <>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 19, 2019

[FIX] resource: give admin rights to edit global leaves
Commit 27d41cc introduced record rules on resource.calendar.leaves.
However it gave no way to create, edit or delete a global rule.
We grant this right to the group_erp_manager, so that an admin can do it.

opw 1968376

closes #32832

Signed-off-by: Yannick Tivisse (yti) <>

@robodoo robodoo removed the CI 🤖 label Apr 19, 2019


This comment has been minimized.

Copy link

rajeeshknambiar commented on c8b91b0 Apr 19, 2019

It would be great to have this fix in 11.0 also! Would you please?

@robodoo robodoo added the CI 🤖 label Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.