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

Open
wants to merge 5,774 commits into
base: 11.0
from

Conversation

Projects
None yet
@efrenba
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) {
        event.preventDefault();

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

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

Desired behavior after PR is merged:

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

_onKanbanActionClicked: function (event) {
        event.preventDefault();

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

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

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

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) <lpe@odoo.com>
[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.

opw-1938570

closes #30987
[FIX] fields: read/write company-dependent fields without ir.property…
… 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 ir.property
couldn't write on property_account_receivable/payable just because he couldn't
write the corresponding ir.property.  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) <qdp@openerp.com>
[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) <tbe@odoo.com>
[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.

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

Task-1817988
[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, ...

Task-1817988
[IMP] guidelines: remove actually wanted PEP8 options
Task-1817988

closes #28714

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
[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) <jem@openerp.com>
[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) <odo@openerp.com>
[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).

opw-1951174
closes #31816

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
[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 res.country.state,
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
country.

opw 1943904

closes #31599

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
[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
   website
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
   `partner_pl`.
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) <jke@openerp.com>
[FIX] mail: activity document name=>updated name
The activities "Document Name" (res_name) are computed and stored by
getting them on original document, so if we change name of original
model => the activity names are not updated.

Thus the document name we see we showing the "Activity" view is the one
that was used when activities were created with an odd heuristic (by
inverse order of activity type and max alphabetical value) and not
translated.

With this changeset we ignore "Document Name" and directly get names of
records when display "Activity" view.

note: the changeset also filter out activities on document we can reads:
this was done when a domain was set but not otherwise so access error
could be easily gotten.

opw-1949437
closes #31850

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
[FIX]website: Themes should be installed from website_theme_install only
closes #31854

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
[FIX] purchase: canceled bill in suggestion
- Install `account_cancel`
- Create a vendor bill for Partner A, cancel it
- Create a new vendor bill for A

The 'Auto-Complete' suggest a bill with an empty name, and only an
amount. It corresponds to the canceled bill.

On a canceled bill, the `number` field is empty, and consequently the
`name` is empty as well.

Whatever is the state of the bill, displaying a bill is useless is only
the amount is shown. Therefore, we make sure to only display the bills
with a number set.

opw-1950846

closes #31863

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
[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).

opw-1958287

closes #32797

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>

@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) <rco@openerp.com>

@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
`group_mrp_routings`.

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.

opw-1970910

closes #32811

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
[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) <xmo@odoo.com>

@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) <yti@odoo.com>

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

@rajeeshknambiar

This comment has been minimized.

Copy link
Contributor

rajeeshknambiar commented on c8b91b0 Apr 19, 2019

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

This comment has been minimized.

Copy link
Contributor Author

sle-odoo replied Apr 23, 2019

@rajeeshknambiar aac14d2

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

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

eduardoflorendo referenced this pull request Apr 21, 2019

[REF] packaging: openerp has been renamed odoo
Fix the various place when the rename of the git root directory
broke the packaging script. Also, we can now name the library
"odoo".

aab-odoo and others added some commits Apr 11, 2019

[FIX] web: crash in editable lists with date field
Backport of 7bc53ac.

Assume an editable list view with a date(time) widget, click to
edit a line, focus the date field (the datepicker opens), press
ESC: there is a crash in the lib, and the datepicker remains open
forever.

This fix is twofold:
 - we added a check in the lib to prevent it from crashing (it is
 easily reproducible: it crashes when an opened datepicker is
 removed from the DOM).
 - we added an event handler of ESC keydown event to hide the
 datepicker before the field is removed from the DOM.

closes #32647

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
[FIX] base: set ARS currency symbol position
Should be before the amount

closes #32846

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Apr 23, 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.