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

[18.0][MIG] server_action_mass_edit: Migration to 18.0 #951

Open
wants to merge 26 commits into
base: 18.0
Choose a base branch
from

Conversation

trisdoan
Copy link

@trisdoan trisdoan commented Oct 10, 2024

@trisdoan trisdoan force-pushed the 18.0-mig-server_action_mass_edit branch from 29381ab to 0f93b99 Compare October 10, 2024 02:43
@pedrobaeza
Copy link
Member

/ocabot migration server_action_mass_edit

@florenciafrigieri2
Copy link

@trisdoan Hi! I tested the module but it didn't worked.
I created a server action to change the salesperson in the SOs, but when selecting the action within sales an error came up (I was not able to even see the wizard).

This are the last lines of the error:
File "/mnt/data/odoo-addons-dir/server_action_mass_edit/wizard/mass_editing_wizard.py", line 93, in onchange
dynamic_fields["selection__" + line.field_id.name] = fields.Selection(
File "/opt/odoo/odoo/fields.py", line 2772, in init
self._selection = dict(selection) if isinstance(selection, list) else None
ValueError: dictionary update sequence element #0 has length 0; 2 is required

I leave here a print of the server action
testserveraction

@trisdoan trisdoan force-pushed the 18.0-mig-server_action_mass_edit branch from 0f93b99 to 7399b98 Compare October 18, 2024 08:45
@trisdoan
Copy link
Author

@trisdoan Hi! I tested the module but it didn't worked. I created a server action to change the salesperson in the SOs, but when selecting the action within sales an error came up (I was not able to even see the wizard).

This are the last lines of the error: File "/mnt/data/odoo-addons-dir/server_action_mass_edit/wizard/mass_editing_wizard.py", line 93, in onchange dynamic_fields["selection__" + line.field_id.name] = fields.Selection( File "/opt/odoo/odoo/fields.py", line 2772, in init self._selection = dict(selection) if isinstance(selection, list) else None ValueError: dictionary update sequence element #0 has length 0; 2 is required

I leave here a print of the server action testserveraction

Hi @florenciafrigieri2, thank you for the review

I just added a fix, could you please try again?

Copy link
Member

@TDu TDu left a comment

Choose a reason for hiding this comment

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

I don't see the error mentioned by @florenciafrigieri2 anymore, but I am not familiar with this module !
Code review looks good.

Copy link

@henrybackman henrybackman left a comment

Choose a reason for hiding this comment

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

Couple of minor comments


@common.tagged("-at_install", "post_install")
class TestMassEditing(common.TransactionCase):
def setUp(self):

Choose a reason for hiding this comment

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

Would setUpClass work for the common test setup to avoid running the setup separately for each test case?

Comment on lines +132 to +133
def test_wiz_fields_view_get(self):
"""Test whether fields_view_get method returns arch.

Choose a reason for hiding this comment

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

Suggested change
def test_wiz_fields_view_get(self):
"""Test whether fields_view_get method returns arch.
def test_wiz_get_view(self):
"""Test whether get_view method returns arch.

return vals_list

def read(self, fields=None, load="_classic_read"):
"""Without this call, dynamic fields build by fields_view_get()

Choose a reason for hiding this comment

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

Suggested change
"""Without this call, dynamic fields build by fields_view_get()
"""Without this call, dynamic fields build by get_view()

Copy link

@florenciafrigieri2 florenciafrigieri2 left a comment

Choose a reason for hiding this comment

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

Functional test! Now is working ok!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@stefsava
Copy link

It seems like there is a regression.
I can't bulk insert product attributes, while I could do it in 17.0.

Before it asked me to add a line,
now it doesn't ask and there are multiple columns.

With 17.0
image
image

With 18.0 and this PR
image
image

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

See @stefsava comment.

@trisdoan
Copy link
Author

trisdoan commented Nov 7, 2024

Hello @stefsava, I checked and it looks to me that the issue is not because of the module

  1. I tried with different o2m fields in another model
    server_mass_action_edit

  2. For product attribute, after https://github.com/odoo/odoo/pull/160270, there is a list view created and it has attribute create='false'. I changed to create='true' (for testing only), here's result:
    server_mass_action_edit_2

@stefsava
Copy link

stefsava commented Nov 7, 2024

Hello @trisdoan

your suggestion doesn't solve my use case.

If I change create='true' I can see "Add a row", but the choice doesn't lead to anything useful.

Instead I found a workaround that brings the behavior back to that of 17.0 that I think can help you understand the problem detected.

I discovered that 17.0 only has the view "product.template.attribute.line.form" while
18.0 has added "product.template.attribute.line.view.list", and for some reason that I don't understand the list view is chosen instead of the form view.

My workaround was simply to deactive the list view, although I fear it may introduce regressions elsewhere.

image

@trisdoan trisdoan force-pushed the 18.0-mig-server_action_mass_edit branch 3 times, most recently from 87e31a4 to 6b8dca7 Compare November 29, 2024 05:11
@trisdoan trisdoan marked this pull request as draft November 29, 2024 05:15
@trisdoan
Copy link
Author

trisdoan commented Nov 29, 2024

DRAFT: working on failed test

@trisdoan trisdoan force-pushed the 18.0-mig-server_action_mass_edit branch from 6b8dca7 to f88d10f Compare December 9, 2024 04:58
@trisdoan trisdoan marked this pull request as ready for review December 9, 2024 04:58
@trisdoan
Copy link
Author

trisdoan commented Dec 9, 2024

Hi, I updated the code to include a pre-hook which handles the renaming (benefit those who use the addon in 14.0 and now migrate to 18.0)

Copy link

@PaulGoubert PaulGoubert left a comment

Choose a reason for hiding this comment

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

Functionnal review OK

@grindtildeath
Copy link
Contributor

Thanks for the mig.
While we are at it, can we please bring #963 in the new version? 🙏

cc @etobella @pedrobaeza @legalsylvain

victoralmau and others added 24 commits December 24, 2024 10:30
…avoid incompatibilities with data from those users.
Currently translated at 100.0% (43 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/tr/
Currently translated at 18.6% (8 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/sl/
Currently translated at 100.0% (43 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/es/
Currently translated at 58.1% (25 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/it/
Currently translated at 95.3% (41 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/fr/
Currently translated at 100.0% (43 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/de/
Currently translated at 100.0% (43 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/it/
Currently translated at 100.0% (43 of 43 strings)

Translation: server-ux-16.0/server-ux-16.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-server_action_mass_edit/sv/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-17.0/server-ux-17.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-17-0/server-ux-17-0-server_action_mass_edit/
Currently translated at 100.0% (44 of 44 strings)

Translation: server-ux-17.0/server-ux-17.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-17-0/server-ux-17-0-server_action_mass_edit/es_MX/
Currently translated at 100.0% (44 of 44 strings)

Translation: server-ux-17.0/server-ux-17.0-server_action_mass_edit
Translate-URL: https://translation.odoo-community.org/projects/server-ux-17-0/server-ux-17-0-server_action_mass_edit/it/
@trisdoan trisdoan force-pushed the 18.0-mig-server_action_mass_edit branch 2 times, most recently from b9d666f to c22320c Compare December 24, 2024 05:47
@trisdoan
Copy link
Author

trisdoan commented Dec 25, 2024

Hello @pedrobaeza, @grindtildeath , @legalsylvain , @etobella , @rousseldenis , I extracted the proposal of Akim into a new module: #985

@tate11
Copy link
Contributor

tate11 commented Jan 13, 2025

Hello @pedrobaeza, @grindtildeath , @legalsylvain , @etobella , @rousseldenis , I extracted the proposal of Akim into a new module: #985

I tried it locally, it doesn't work.

2025-01-13 22:11:13,708 18900 ERROR odoo_v18 odoo.sql_db: bad query: b'INSERT INTO "product_supplierinfo" ("company_id", "create_date", "create_uid", "currency_id", "date_end", "date_start", "delay", "discount", "min_qty", "price", "product_code", "product_id", "product_name", "product_tmpl_id", "sequence", "write_date", "write_uid") VALUES (2, '2025-01-13 22:11:13.699676', 2, 31, NULL, NULL, 1, '0.00', '0.00', '0.00', NULL, NULL, NULL, 281, 1, '2025-01-13 22:11:13.699676', 2) RETURNING "id"'
ERROR: null value in column "partner_id" of relation "product_supplierinfo" violates not-null constraint
DETAIL: Failing row contains (26, null, 1, 2, 31, null, 281, 1, 2, 2, null, null, null, null, 0.00, 0.00, 0.00, 2025-01-13 22:11:13.699676, 2025-01-13 22:11:13.699676).

2025-01-13 22:11:13,712 18900 WARNING odoo_v18 odoo.http: The operation cannot be completed:

  • Create/update: a mandatory field is not set.
  • Delete: another model requires the record being deleted. If possible, archive it instead.

Model: Supplier Pricelist (product.supplierinfo)
Field: Vendor (partner_id)
Screenshot 2025-01-14 at 01-09-58 Vendors (Product)
Screenshot 2025-01-14 at 01-11-41 Products

@trisdoan
Copy link
Author

Hello @pedrobaeza, @grindtildeath , @legalsylvain , @etobella , @rousseldenis , I extracted the proposal of Akim into a new module: #985

I tried it locally, it doesn't work.

2025-01-13 22:11:13,708 18900 ERROR odoo_v18 odoo.sql_db: bad query: b'INSERT INTO "product_supplierinfo" ("company_id", "create_date", "create_uid", "currency_id", "date_end", "date_start", "delay", "discount", "min_qty", "price", "product_code", "product_id", "product_name", "product_tmpl_id", "sequence", "write_date", "write_uid") VALUES (2, '2025-01-13 22:11:13.699676', 2, 31, NULL, NULL, 1, '0.00', '0.00', '0.00', NULL, NULL, NULL, 281, 1, '2025-01-13 22:11:13.699676', 2) RETURNING "id"' ERROR: null value in column "partner_id" of relation "product_supplierinfo" violates not-null constraint DETAIL: Failing row contains (26, null, 1, 2, 31, null, 281, 1, 2, 2, null, null, null, null, 0.00, 0.00, 0.00, 2025-01-13 22:11:13.699676, 2025-01-13 22:11:13.699676).

2025-01-13 22:11:13,712 18900 WARNING odoo_v18 odoo.http: The operation cannot be completed:

* Create/update: a mandatory field is not set.

* Delete: another model requires the record being deleted. If possible, archive it instead.

Model: Supplier Pricelist (product.supplierinfo) Field: Vendor (partner_id) Screenshot 2025-01-14 at 01-09-58 Vendors (Product) Screenshot 2025-01-14 at 01-11-41 Products

Hello @tate11, it looks to me the issue is not due to the module

I got same error with version 17.0

Could you please provide steps to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.