Skip to content

Conversation

@DantePereyra
Copy link
Contributor

This module, makes client_order_ref field required and reposition it,for both form view and Sale reports.Also makes this field searchable and add an optional column on both quotation and sale orders lists.
SALE ORDER BEFORE
client_sale_order_ref_before_image
SALE ORDER AFTER
client_sale_order_ref_after_image
SALE REPORT TEMPLATE BEFORE
client_sale_order_ref_template_before_image
SALE REPORT TEMPLATE AFTER
client_sale_order_ref_template_after_image

@DantePereyra DantePereyra changed the title [ADD][18.0]sale_order_client_order_ref_mandatory [18.0][ADD]sale_order_client_order_ref_mandatory Jul 14, 2025
@DantePereyra DantePereyra force-pushed the 18.0-add-sale_order_client_order_ref_mandatory branch 4 times, most recently from 6f4161c to a9a66fc Compare July 15, 2025 08:06
@rousseldenis rousseldenis added this to the 18.0 milestone Jul 22, 2025
@rousseldenis
Copy link
Contributor

@DantePereyra Could you check tests ?

@DantePereyra
Copy link
Contributor Author

@DantePereyra Could you check tests ?

@rousseldenis, tests are failing because when the client_order_ref field was made mandatory in the view, it caused conflicts in addons whose tests called the sale.order form without that field being completed. That’s why I added the code snippet that detects if the environment is in test mode and auto-fills the field.

However, a new error has now appeared in the test:

2025-07-15 08:11:27,282 333 ERROR odoo odoo.addons.sale_require_po_doc.tests.test_sale_require_po_doc: FAIL: TestSaleRequirePODoc.test_require_customer_need_po
Traceback (most recent call last):
  File "/__w/sale-workflow/sale-workflow/sale_require_po_doc/tests/test_sale_require_po_doc.py", line 39, in test_require_customer_need_po
    with self.assertRaises(ValidationError, msg=messsage):
  File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/opt/odoo/odoo/tests/common.py", line 484, in _assertRaises
    with ExitStack() as inner:
  File "/usr/lib/python3.10/contextlib.py", line 576, in __exit__
    raise exc_details[1]
  File "/usr/lib/python3.10/contextlib.py", line 561, in __exit__
    if cb(*exc_details):
AssertionError: ValidationError not raised : You can not confirm sale order without Customer reference.

The validation is not triggered because the field is already filled in. I'm a bit stuck at this point—if you have any suggestions on how to move forward, it would be helpful. Thanks!

default=lambda self: self._default_test_dummy_name(),
)

def _default_test_dummy_name(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

@DantePereyra Making code depending on test behaviour is not recommended

@DantePereyra DantePereyra force-pushed the 18.0-add-sale_order_client_order_ref_mandatory branch 2 times, most recently from f5cd1cb to bc581e6 Compare July 22, 2025 12:13
For a Sale Order, makes required client_order_ref
field and reposition it,for both form view and Sale reports.
Also makes this field searchable and add an optional
column on both quotation and sale orders lists.
@DantePereyra DantePereyra force-pushed the 18.0-add-sale_order_client_order_ref_mandatory branch from bc581e6 to 903f7e0 Compare July 31, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants