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

[FIX][web] Stop recursively adding contexts. #13635

Closed
wants to merge 1 commit into from

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Sep 29, 2016

Current behavior before PR:

Some lines below this patch, there is this:

if (action.context) {
    c.add(action.context);
}
action.context = c;

Since the action variable was coming by reference, this means that each time you press a button, it added its context to itself, making that after pressing too many times the same button, recursiveness turned the system slow.

Also, a bigger side effect of this is that if you had a one2many tree view with a button on it that had a context like {'default_other': some_field}, the context was not being updated when you clicked on a different row.

Desired behavior after PR is merged:

With this patch, further modifications on the action are made on a copy, so no recursion happens and the original action is kept intact.

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

Some lines below this patch, there is this:

    if (action.context) {
        c.add(action.context);
    }
    action.context = c;

Since the `action` variable was coming by reference, this means that each time you press a button, it added its context to itself, making that after pressing too many times the same button, recursiveness turned the system slow.

Also, a bigger side effect of this is that if you had a one2many tree view with a button on it that had a context like `{'default_other': some_field}`, the context was not being updated when you clicked on a different row.

With this patch, further modifications on the action are made on a copy, so no recursion happens and the original action is kept intact.
@pedrobaeza
Copy link
Collaborator

You can exercise the problem in this PR: OCA/sale-workflow#343

Copy link
Collaborator

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working now with the patch

pedrobaeza added a commit to Tecnativa/purchase-workflow that referenced this pull request Oct 15, 2016
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
pedrobaeza added a commit to Tecnativa/purchase-workflow that referenced this pull request Oct 15, 2016
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
pedrobaeza added a commit to OCA/purchase-workflow that referenced this pull request Nov 24, 2016
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
@pedrobaeza
Copy link
Collaborator

Any maybe check this one also, @ged-odoo?

pedrobaeza added a commit to Tecnativa/product-variant that referenced this pull request Jan 7, 2017
=================================================
Handle easily multiple variants on Stock Pickings
=================================================

This module allows to add/modify of all the variants of a product in a direct
screen without the need of handling them one by one.

It also adds a convenient way of handling the transfer of the products in a
2D matrix with all the values of the first attribute in columns, and the
rest of the combinations in rows.

Configuration
=============

* Configure your user to have any permission from "Inventory" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Inventory > Dashboard.
* Create a new picking from one of the existing picking types.
* Press "Add variants" button located in the upper right corner of the
  "Initial Demand" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one (if any) as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  picking"
* Move lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

You are also able to manage variants on 1 dimension in the transfer:

* Go to the "Operations" page.
* Press on "Manage Variants Transfer" button in the upper right corner of the
  tab.
* Change the quantities to transfer.
* Click on "Transfer to picking" button.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13557
  * odoo/odoo#13635

  The patches are already integrated on OCB.

* Make this work with product with more than 1 attribute.
pedrobaeza added a commit to Tecnativa/product-variant that referenced this pull request Jan 8, 2017
=================================================
Handle easily multiple variants on Stock Pickings
=================================================

This module allows to add/modify of all the variants of a product in a direct
screen without the need of handling them one by one.

It also adds a convenient way of handling the transfer of the products in a
2D matrix with all the values of the first attribute in columns, and the
rest of the combinations in rows.

Configuration
=============

* Configure your user to have any permission from "Inventory" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Inventory > Dashboard.
* Create a new picking from one of the existing picking types.
* Press "Add variants" button located in the upper right corner of the
  "Initial Demand" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one (if any) as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  picking"
* Move lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

You are also able to manage variants on 1 dimension in the transfer:

* Go to the "Operations" page.
* Press on "Manage Variants Transfer" button in the upper right corner of the
  tab.
* Change the quantities to transfer.
* Click on "Transfer to picking" button.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13557
  * odoo/odoo#13635

  The patches are already integrated on OCB.

* Make this work with product with more than 1 attribute.
pedrobaeza added a commit to Tecnativa/product-variant that referenced this pull request Jan 8, 2017
=================================================
Handle easily multiple variants on Stock Pickings
=================================================

This module allows to add/modify of all the variants of a product in a direct
screen without the need of handling them one by one.

It also adds a convenient way of handling the transfer of the products in a
2D matrix with all the values of the first attribute in columns, and the
rest of the combinations in rows.

Configuration
=============

* Configure your user to have any permission from "Inventory" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Inventory > Dashboard.
* Create a new picking from one of the existing picking types.
* Press "Add variants" button located in the upper right corner of the
  "Initial Demand" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one (if any) as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  picking"
* Move lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

You are also able to manage variants on 1 dimension in the transfer:

* Go to the "Operations" page.
* Press on "Manage Variants Transfer" button in the upper right corner of the
  tab.
* Change the quantities to transfer.
* Click on "Transfer to picking" button.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13557
  * odoo/odoo#13635

  The patches are already integrated on OCB.

* Make this work with product with more than 1 attribute.
pedrobaeza added a commit to Tecnativa/product-variant that referenced this pull request Jan 8, 2017
=================================================
Handle easily multiple variants on Stock Pickings
=================================================

This module allows to add/modify of all the variants of a product in a direct
screen without the need of handling them one by one.

It also adds a convenient way of handling the transfer of the products in a
2D matrix with all the values of the first attribute in columns, and the
rest of the combinations in rows.

Configuration
=============

* Configure your user to have any permission from "Inventory" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Inventory > Dashboard.
* Create a new picking from one of the existing picking types.
* Press "Add variants" button located in the upper right corner of the
  "Initial Demand" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one (if any) as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  picking"
* Move lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

You are also able to manage variants on 1 dimension in the transfer:

* Go to the "Operations" page.
* Press on "Manage Variants Transfer" button in the upper right corner of the
  tab.
* Change the quantities to transfer.
* Click on "Transfer to picking" button.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13557
  * odoo/odoo#13635

  The patches are already integrated on OCB.

* Make this work with product with more than 1 attribute.
pedrobaeza added a commit to OCA/product-variant that referenced this pull request Mar 23, 2017
=================================================
Handle easily multiple variants on Stock Pickings
=================================================

This module allows to add/modify of all the variants of a product in a direct
screen without the need of handling them one by one.

It also adds a convenient way of handling the transfer of the products in a
2D matrix with all the values of the first attribute in columns, and the
rest of the combinations in rows.

Configuration
=============

* Configure your user to have any permission from "Inventory" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Inventory > Dashboard.
* Create a new picking from one of the existing picking types.
* Press "Add variants" button located in the upper right corner of the
  "Initial Demand" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one (if any) as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  picking"
* Move lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

You are also able to manage variants on 1 dimension in the transfer:

* Go to the "Operations" page.
* Press on "Manage Variants Transfer" button in the upper right corner of the
  tab.
* Change the quantities to transfer.
* Click on "Transfer to picking" button.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13557
  * odoo/odoo#13635

  The patches are already integrated on OCB.

* Make this work with product with more than 1 attribute.
@pedrobaeza
Copy link
Collaborator

@ged-odoo and this one too 👼

@ged-odoo ged-odoo added the Framework General frontend/backend framework issues label May 31, 2017
pedrobaeza added a commit to Tecnativa/product-variant that referenced this pull request Oct 27, 2017
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
pedrobaeza added a commit to Tecnativa/product-variant that referenced this pull request Oct 27, 2017
=================================================
Handle easily multiple variants on Stock Pickings
=================================================

This module allows to add/modify of all the variants of a product in a direct
screen without the need of handling them one by one.

It also adds a convenient way of handling the transfer of the products in a
2D matrix with all the values of the first attribute in columns, and the
rest of the combinations in rows.

Configuration
=============

* Configure your user to have any permission from "Inventory" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Inventory > Dashboard.
* Create a new picking from one of the existing picking types.
* Press "Add variants" button located in the upper right corner of the
  "Initial Demand" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one (if any) as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  picking"
* Move lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

You are also able to manage variants on 1 dimension in the transfer:

* Go to the "Operations" page.
* Press on "Manage Variants Transfer" button in the upper right corner of the
  tab.
* Change the quantities to transfer.
* Click on "Transfer to picking" button.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13557
  * odoo/odoo#13635

  The patches are already integrated on OCB.

* Make this work with product with more than 1 attribute.
@pedrobaeza
Copy link
Collaborator

Closing as this won't be merged on this version as it's EOL.

@pedrobaeza pedrobaeza closed this Apr 12, 2018
@pedrobaeza pedrobaeza deleted the 9.0-web-fix_recursive_contexts branch April 12, 2018 16:27
javierjcf pushed a commit to Comunitea/product-variant that referenced this pull request Oct 11, 2018
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
grindtildeath pushed a commit to grindtildeath/product-variant that referenced this pull request Jul 29, 2019
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
sonhd91 pushed a commit to sonhd91/product-variant that referenced this pull request Dec 28, 2021
==================================================
Handle easily multiple variants on Purchase Orders
==================================================

This module allows to add/modify all the variants of a product in a direct
screen without the need of handling them one by one.

Configuration
=============

* Configure your user to have any permission from "Purchases" group.
* Create a product with 2 attributes and several values.

Usage
=====

* Go to Purchases > Purchase > Requests for Quotation
* Create a new quotation or edit an existing one.
* Press "Add variants" button located in the upper right corner of the
  "Order Lines" tab.
* A new screen will appear allowing you to select the products that have
  variants.
* Once you select the product, a 2D matrix will appear with the first
  attribute values as columns and the second one as rows.
* If there are already order lines for the product variants, the current
  quantity will be pre-filled in the matrix.
* Change the quantities for the variant you want and click on "Transfer to
  order"
* Order lines for the variants will be created/removed to comply with the
  input you have done.

As extra feature for saving steps, there's also a button on each existing line
that corresponds to a variant that opens the dialog directly with the product
selected.

Known issues / Roadmap
======================

* The inline button for modifying quantities for an existing line won't
  work correctly until these 2 PRs are merged in Odoo:

  * odoo/odoo#13558
  * odoo/odoo#13635

  The problems are already fixed in OCB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework General frontend/backend framework issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants