Skip to Content
Menu
This question has been flagged
1 Reply
1515 Views

class ProjectProject(models.Model): _inherit = 'project.project'

 product_manager = fields.Many2one( 'hr.employee', string="Manager", help="Employee who manages the process for this project." )


but build fails with error 

FAILED: [4/7] Tour project_task_activities_split → Step Task "New Sub-Task!" is listed in the activity view (trigger: .o_activity_record .d-block:contains("New Sub-Task!")). Element (.o_activity_record .d-block:contains("New Sub-Task!")) has not been found. TIMEOUT: The step failed to complete within 10000 ms.

FAIL: Subtest TestTodoUi.test_tour_project_task_activities_split (login='admin') Traceback (most recent call last): File "<decorator-gen-265>", line 2, in test_tour_project_task_activities_split File "/home/odoo/src/odoo/odoo/tests/common.py", line 2138, in _users func(*args, **kwargs) File "/home/odoo/src/odoo/addons/project_todo/tests/test_todo_ui.py", line 51, in test_tour_project_task_activities_split self.start_tour("/odoo", 'project_task_activities_split', login="admin") File "/home/odoo/src/odoo/odoo/tests/common.py", line 2072, in start_tour return self.browser_js(url_path=url_path, code=code, ready=ready, timeout=timeout, success_signal="tour succeeded", **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/odoo/tests/common.py", line 2048, in browser_js self.fail('%s\n\n%s' % (message, error)) AssertionError: The test code "odoo.startTour('project_task_activities_split', {"stepDelay": 0, "keepWatchBrowser": false, "debug": false, "startUrl": "/odoo", "delayToCheckUndeterminisms": 0})" failed FAILED: [4/7] Tour project_task_activities_split → Step Task "New Sub-Task!" is listed in the activity view (trigger: .o_activity_record .d-block:contains("New Sub-Task!")). Element (.o_activity_record .d-block:contains("New Sub-Task!")) has not been found. TIMEOUT: The step failed to complete within 10000 ms.

Avatar
Discard
Best Answer

The error indicates a failed frontend tour test related to the project_task_activities_split feature in Odoo 18. This failure might be due to changes or misalignments introduced while inheriting the project.project model and adding the product_manager field. Here’s how you can address and resolve the issue:

Step-by-Step Troubleshooting and Fixes

  1. Check Field Addition:
    • Verify that your field addition doesn’t inadvertently affect existing views or logic.
    • Specifically, ensure no existing views or JS interactions depend on the exact structure of the project.project model, as adding fields can sometimes disrupt rendering or testing.
    Example of a properly structured inheritance:
    pythonCopy codefrom odoo import models, fields
    
    class ProjectProject(models.Model):
        _inherit = 'project.project'
    
        product_manager = fields.Many2one(
            'hr.employee',
            string="Manager",
            help="Employee who manages the process for this project."
        )
    
    This code alone should not directly cause the test to fail unless it affects dependent code or views.
  2. Update Related Views:
    • Ensure all views that render project.project are updated to accommodate the new field if necessary.
    • Check for the activity view referenced in the test:
      • Look for any <xpath> or updates related to project.project views.
      • Validate the o_activity_record class and .d-block behavior to ensure the field addition doesn’t interfere.
  3. Analyze Test Dependencies:
    • Review the test_todo_ui.py test, especially the test_tour_project_task_activities_split method. This test is failing because the frontend element .o_activity_record .d-block:contains("New Sub-Task!") could not be located.
    • Check if:
      • The inheritance inadvertently removed or altered the o_activity_record view structure.
      • A JavaScript or QWeb template update is required to reintroduce the missing element.
  4. Verify QWeb Templates:
    • Review QWeb templates used by project.project or related features.
    • Look for the element with o_activity_record and ensure it renders correctly after your changes.
  5. Fix JS or Tour Test Logic:
    • If the test depends on JavaScript interactions, verify the tour code:
      • Locate the trigger for the .o_activity_record .d-block:contains("New Sub-Task!") element.
      • Ensure the element is rendered and accessible during the test.
    Example of updating or debugging the test:
    pythonCopy code# Check if the element exists at the expected stage of the test
    self.assertTrue(self.env['project.task'].search([('name', '=', 'New Sub-Task!')]), "Task 'New Sub-Task!' not found")
    
  6. Debugging Strategy:
    • Enable developer mode and open the affected page in the browser.
    • Inspect the DOM for .o_activity_record and .d-block.
    • Confirm the presence of "New Sub-Task!" text during test execution.
  7. Rebuild and Retest:
    • Restart your Odoo server and ensure your module is updated:
      bashCopy code./odoo-bin -d your_database_name -u your_module_name --stop-after-init
      
    • Re-run the tests:
      bashCopy code./odoo-bin --test-enable -d your_database_name --stop-after-init
      
  8. If Problem Persists:
    • Check for dependencies on project_todo or similar modules.
    • Investigate other overridden models or fields that may be interacting with project.project.

Example Fix for the Test

If you modified templates, ensure all necessary elements (like o_activity_record) are included:

xmlCopy code<t t-extend="project.activity_view">
    <xpath expr="//div[@class='o_activity_record']" position="inside">
        <!-- Ensure New Sub-Task element exists for the test -->
        <div class="d-block">New Sub-Task!</div>
    </xpath>
</t>

Final Notes

  • Always verify the product_manager field addition does not conflict with core logic or modules.
  • Review any JS or Python logic dependent on the project.project model.
  • If the issue is unresolved, share logs, and we can further assist!

Avatar
Discard
Author

I will review this, but when I add the project module as a dependency (without inheriting it), the build fails. Initially, I thought the issue was caused by updating the view, so I tried adding the attribute to the model without modifying the view, but the build still failed. My next attempt was to inherit the module without making any changes, and the build failed again. This leads me to believe that something else might be going wrong.

Related Posts Replies Views Activity
0
Mar 25
1029
2
Jun 25
1906
1
Jun 25
926
1
Jun 25
492
3
May 25
2080