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

[16.0][FIX] purchase_manual_delivery: manual delivery with double validation #2189

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

astirpe
Copy link
Member

@astirpe astirpe commented Feb 28, 2024

When "Purchase Order Approval" is enabled and the PO exceeds the Minimum Amount, the manual delivery is not applied at the moment that the PO is approved.
This PR fixes this case.

@astirpe astirpe force-pushed the 16_fix_purchase_manual_delivery branch 3 times, most recently from 5639dbe to 377b159 Compare February 28, 2024 12:57
@astirpe astirpe marked this pull request as ready for review February 28, 2024 13:01
Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

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

Thanks!

@StefanRijnhart
Copy link
Member

@astirpe Due to a conflict with a merge just now of another PR, your new test in this PR needs to be moved down a little bit.

@StefanRijnhart
Copy link
Member

Picked in my 17.0 migration #2417

@astirpe astirpe force-pushed the 16_fix_purchase_manual_delivery branch from 377b159 to 2e4da40 Compare September 26, 2024 15:33
@StefanRijnhart
Copy link
Member

Unfortunately an access error now appears in your test

2024-09-26T15:37:13.8391675Z 2024-09-26 15:37:13,838 484 �[1;32m�[1;49mINFO�[0m odoo odoo.addons.purchase_manual_delivery.tests.test_purchase_manual_delivery: Starting TestPurchaseManualDelivery.test_05_purchase_order_manual_delivery_double_validation ... 
2024-09-26T15:37:14.4727391Z 2024-09-26 15:37:14,472 484 �[1;32m�[1;49mINFO�[0m odoo odoo.addons.base.models.ir_rule: Access Denied by record rules for operation: read on record ids: [170], uid: 14, model: purchase.order.line 
2024-09-26T15:37:14.4751428Z 2024-09-26 15:37:14,474 484 �[1;32m�[1;49mINFO�[0m odoo odoo.addons.base.models.ir_rule: Access Denied by record rules for operation: read on record ids: [170], uid: 14, model: purchase.order.line 
2024-09-26T15:37:14.4775407Z 2024-09-26 15:37:14,477 484 �[1;32m�[1;49mINFO�[0m odoo odoo.addons.purchase_manual_delivery.tests.test_purchase_manual_delivery: ====================================================================== 
2024-09-26T15:37:14.4778708Z 2024-09-26 15:37:14,477 484 �[1;31m�[1;49mERROR�[0m odoo odoo.addons.purchase_manual_delivery.tests.test_purchase_manual_delivery: ERROR: TestPurchaseManualDelivery.test_05_purchase_order_manual_delivery_double_validation
2024-09-26T15:37:14.4780741Z Traceback (most recent call last):
2024-09-26T15:37:14.4781131Z   File "/opt/odoo/odoo/api.py", line 997, in get
2024-09-26T15:37:14.4781545Z     cache_value = field_cache[record._ids[0]]
2024-09-26T15:37:14.4781888Z KeyError: 170
2024-09-26T15:37:14.4782037Z 
2024-09-26T15:37:14.4782275Z During handling of the above exception, another exception occurred:
2024-09-26T15:37:14.4782651Z 
2024-09-26T15:37:14.4782777Z Traceback (most recent call last):
2024-09-26T15:37:14.4783169Z   File "/opt/odoo/odoo/fields.py", line 1161, in __get__
2024-09-26T15:37:14.4783586Z     value = env.cache.get(record, self)
2024-09-26T15:37:14.4784182Z   File "/opt/odoo/odoo/api.py", line 1004, in get
2024-09-26T15:37:14.4784542Z     raise CacheMiss(record, field)
2024-09-26T15:37:14.4785075Z odoo.exceptions.CacheMiss: 'purchase.order.line(170,).company_id'
2024-09-26T15:37:14.4785430Z 
2024-09-26T15:37:14.4785660Z During handling of the above exception, another exception occurred:
2024-09-26T15:37:14.4786012Z 
2024-09-26T15:37:14.4786125Z Traceback (most recent call last):
2024-09-26T15:37:14.4786494Z   File "/opt/odoo/odoo/fields.py", line 1187, in __get__
2024-09-26T15:37:14.4786881Z     recs._fetch_field(self)
2024-09-26T15:37:14.4787255Z   File "/opt/odoo/odoo/models.py", line 3209, in _fetch_field
2024-09-26T15:37:14.4787652Z     self._read(fnames)
2024-09-26T15:37:14.4788060Z   File "/opt/odoo/odoo/models.py", line 3335, in _read
2024-09-26T15:37:14.4788629Z     raise self.env['ir.rule']._make_access_error('read', forbidden)
2024-09-26T15:37:14.4789625Z odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Purchase Order Line' (purchase.order.line) records.
2024-09-26T15:37:14.4790316Z 
2024-09-26T15:37:14.4790506Z Contact your administrator to request access if necessary.
2024-09-26T15:37:14.4790826Z 
2024-09-26T15:37:14.4791056Z During handling of the above exception, another exception occurred:
2024-09-26T15:37:14.4791413Z 
2024-09-26T15:37:14.4791527Z Traceback (most recent call last):
2024-09-26T15:37:14.4792553Z   File "/__w/purchase-workflow/purchase-workflow/purchase_manual_delivery/tests/test_purchase_manual_delivery.py", line 347, in test_05_purchase_order_manual_delivery_double_validation
2024-09-26T15:37:14.4793460Z     .create(po_vals)

@astirpe
Copy link
Member Author

astirpe commented Sep 26, 2024

@StefanRijnhart Yes, I noticed. I will fix it as soon as I have some time. Thank you!

@astirpe
Copy link
Member Author

astirpe commented Oct 1, 2024

@StefanRijnhart It seems to me that the access error of the test is caused by the definition of last_purchase_line_ids field in module purchase_last_price_info, in particular is caused by this domain:
https://github.com/OCA/purchase-workflow/blob/16.0/purchase_last_price_info/models/product_product.py#L16-L17

Not sure how to fix it.

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.

3 participants