pos icon indicating copy to clipboard operation
pos copied to clipboard

[18.0][MIG] pos_order_to_sale_order: Migration to 18.0

Open benwillig opened this issue 4 months ago • 27 comments

benwillig avatar Aug 22 '25 12:08 benwillig

Hi @legalsylvain ,

Could this module be merged?

lbarry-apsl avatar Sep 02 '25 11:09 lbarry-apsl

Hi @pedrobaeza ,

Sorry, can this be merged?

lbarry-apsl avatar Sep 05 '25 06:09 lbarry-apsl

/ocabot migration pos_order_to_sale_order /ocabot merge nobump

pedrobaeza avatar Sep 17 '25 20:09 pedrobaeza

What a great day to merge this nice PR. Let's do it! Prepared branch 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot avatar Sep 17 '25 20:09 OCA-git-bot

@pedrobaeza your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

OCA-git-bot avatar Sep 18 '25 02:09 OCA-git-bot

Hi @pedrobaeza , could you relaunch the merge?

lbarry-apsl avatar Sep 19 '25 08:09 lbarry-apsl

/ocabot merge nobump

pedrobaeza avatar Sep 19 '25 14:09 pedrobaeza

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot avatar Sep 19 '25 14:09 OCA-git-bot

@pedrobaeza , It didn't work, do you know why?

lbarry-apsl avatar Sep 22 '25 13:09 lbarry-apsl

/ocabot merge nobump

pedrobaeza avatar Sep 22 '25 14:09 pedrobaeza

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot avatar Sep 22 '25 14:09 OCA-git-bot

@pedrobaeza your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

OCA-git-bot avatar Sep 22 '25 20:09 OCA-git-bot

@benwillig , I think the JS tests aren't passing, could you check it?

lbarry-apsl avatar Sep 24 '25 06:09 lbarry-apsl

@benwillig , I think the JS tests aren't passing, could you check it?

@lbarry-apsl tests with OCB seems to failed because of other modules, and it's in the case in other PR in 18

benwillig avatar Sep 24 '25 08:09 benwillig

I updated the styles of the button to match the default one

image

Also added pos_session_id on sale.order

benwillig avatar Sep 26 '25 13:09 benwillig

Thanks @benwillig for the PR updates! The following OCB tests do fail, though:

  • test_frontend.TestDivideOrderSummary.test_divide_order_summary
  • test_frontend.TestLotScanning.test_scan_lot_number
  • test_frontend.TestLotScanning.test_scan_to_input_lot_number
  • test_frontend.TestDisplayOrderNumber.test_display_order_number
  • test_frontend.TestDisplayTotalQty.test_display_total_qty

However, all such errors are similar, for example under log line 145 for test_divide_order_summary:

2025-09-26 14:12:38,558 251 INFO odoo odoo.addons.base.models.ir_model: Access Denied by ACLs for operation: read, uid: 10, model: ir.module.module 
2025-09-26 14:12:38,562 251 ERROR odoo odoo.http: Exception during request handling. 
Traceback (most recent call last):
  File "/opt/odoo/addons/point_of_sale/models/pos_session.py", line 181, in load_data
    response[model] = self.env[model]._load_pos_data(response)
[…]
odoo.exceptions.AccessError: You are not allowed to access 'Module' (ir.module.module) records.

This operation is allowed for the following groups:
	- Administration/Settings

Contact your administrator to request access if necessary.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
[…]
  File "/opt/odoo/addons/point_of_sale/models/pos_session.py", line 185, in load_data
    'fields': self.env[model]._load_pos_data_fields(response['pos.config']['data'][0]['id']),
TypeError: IrModuleModule._load_pos_data_fields() takes 1 positional argument but 2 were given

Then the browser-side script gets stuck and eventually killed.

The code under PosSession.load_pos_data has changed a bit. Maybe rebasing/force-pushing can fix the issue? :shrug:

Update 2025-12-02: The PR is already on top of the latest commit, please disregard my suggestion to rebase/force-push.

ivilata avatar Nov 13 '25 14:11 ivilata

The errors that I listed above can be pinpointed respectively to these modules: pos_divide_order_summary, pos_lot_barcode, pos_display_order_number, pos_display_total_quantity. They do also trigger when run with a brand new DB and no trace of this PR's code. The tests of the pos_order_to_sale_order module added by this PR do succeed when run in isolation on a new DB, however.

@pedrobaeza, should the other modules be fixed first, before this one can be merged? I understand that merging this one is kind of ugly as the "default" ensemble of tests run by oca_run_tests does not pass. Thanks!

ivilata avatar Dec 01 '25 15:12 ivilata

Which tests are failing here in GitHub?

pedrobaeza avatar Dec 01 '25 16:12 pedrobaeza

/ocabot merge nobump

pedrobaeza avatar Dec 01 '25 17:12 pedrobaeza

On my way to merge this fine PR! Prepared branch 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot avatar Dec 01 '25 17:12 OCA-git-bot

@pedrobaeza your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-1429-by-pedrobaeza-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

OCA-git-bot avatar Dec 01 '25 17:12 OCA-git-bot

@pedrobaeza: The tests that fail are the ones that I listed in https://github.com/OCA/pos/pull/1429#issuecomment-3528186982. They fail both in GitHub's CI and when run locally.

ivilata avatar Dec 02 '25 09:12 ivilata

But it's due to this module or they are failing in general?

pedrobaeza avatar Dec 02 '25 09:12 pedrobaeza

The tests that I mentioned from modules pos_divide_order_summary, pos_lot_barcode, pos_display_order_number, pos_display_total_quantity are failing when I run them in a local Odoo 18 installation, even if I do not enable the pos_order_to_sale_order module from this PR, so I guess that the former ones do have issues of their own. When I run the tests only for pos_order_to_sale_order locally, they pass just right.

Sorry if I didn't explain myself more clearly. :slightly_smiling_face:

ivilata avatar Dec 02 '25 09:12 ivilata

Then they should be fixed before merging this.

pedrobaeza avatar Dec 02 '25 14:12 pedrobaeza

@pedrobaeza @benwillig: I traced back the errors in the other modules to a bug introduced in upstream Odoo 18 in commit https://github.com/odoo/odoo/commit/282a667bae54: a new IrModuleModule._load_pos_data_fields(self) method was introduced (then called) in module point_of_sale having only the self parameter, while code elsewhere in Odoo defines and uses _load_pos_data_fields(self, config_id) instead. Then PosSession.load_data() ended up calling it with the extra argument, which causes the errors.

The following changes fix the issue:

diff --git a/addons/point_of_sale/models/ir_module_module.py b/addons/point_of_sale/models/ir_module_module.py
index fcae0cad27a1..32c81bd36724 100644
--- a/addons/point_of_sale/models/ir_module_module.py
+++ b/addons/point_of_sale/models/ir_module_module.py
@@ -5,7 +5,7 @@ class IrModuleModule(models.Model):
     _inherit = 'ir.module.module'
 
     @api.model
-    def _load_pos_data_fields(self):
+    def _load_pos_data_fields(self, config_id):
         return ['id', 'name', 'state']
 
     @api.model
@@ -14,8 +14,8 @@ class IrModuleModule(models.Model):
 
     def _load_pos_data(self, data):
         domain = self._load_pos_data_domain()
-        fields = self._load_pos_data_fields()
+        fields = self._load_pos_data_fields(data['pos.config']['data'][0]['id'])
         return {
             'data': self.search_read(domain, fields, load=False),
-            'fields': self._load_pos_data_fields(),
+            'fields': fields,
         }

I don't have time right now to work on a new PR for that, if anyone wants to use the patch to create the PR, be my guest. Thanks! :slightly_smiling_face:

(I may be wrong, but I the existing bug may be blocking all future PRs to this repo as well since it will make their tests fail.)

ivilata avatar Dec 03 '25 10:12 ivilata

Hello,

On my local I have a warning : Component 'CreateOrderButton' does not have a static props description

niboo-ave avatar Dec 10 '25 11:12 niboo-ave