project icon indicating copy to clipboard operation
project copied to clipboard

Project_timeline - DuplicateColumn planned_date_end

Open HugoCLU opened this issue 1 year ago • 1 comments

On 16.0, I have this issue when I make a build (below) each time I tried to update my branch.

Module

project_timeline

Describe the bug

bad query: CREATE view report_project_task_user as SELECT (select 1) AS nbr, t.id as id, t.id as task_id, t.active, t.create_date as create_date, t.date_assign as date_assign, t.date_end as date_end, t.date_last_stage_update as date_last_stage_update, t.date_deadline as date_deadline, t.project_id, t.priority, t.name as name, t.company_id, t.partner_id, t.parent_id as parent_id, t.ancestor_id as ancestor_id, t.stage_id as stage_id, t.is_closed as is_closed, t.kanban_state as state, t.milestone_id, pm.is_reached as milestone_reached, pm.deadline as milestone_deadline, NULLIF(t.rating_last_value, 0) as rating_last_value, AVG(rt.rating) as rating_avg, t.working_days_close as working_days_close, t.working_days_open as working_days_open, t.working_hours_open as working_hours_open, t.working_hours_close as working_hours_close, (extract('epoch' from (t.date_deadline-(now() at time zone 'UTC'))))/(3600*24) as delay_endings_days , (t.effective_hours * 100) / NULLIF(t.planned_hours, 0) as progress, t.effective_hours as hours_effective, t.planned_hours - t.effective_hours - t.subtask_effective_hours as remaining_hours, NULLIF(t.planned_hours, 0) as hours_planned, t.overtime as overtime , t.planned_date_begin as planned_date_begin, t.planned_date_end as planned_date_end , t.planned_date_start, t.planned_date_end FROM project_task t LEFT JOIN rating_rating rt ON rt.res_id = t.id AND rt.res_model = 'project.task' AND rt.consumed = True AND rt.rating >= 1 LEFT JOIN project_milestone pm ON pm.id = t.milestone_id

      WHERE 
            t.project_id IS NOT NULL
    
   GROUP BY 
            t.id,
            t.active,
            t.create_date,
            t.date_assign,
            t.date_end,
            t.date_last_stage_update,
            t.date_deadline,
            t.project_id,
            t.ancestor_id,
            t.priority,
            t.name,
            t.company_id,
            t.partner_id,
            t.parent_id,
            t.stage_id,
            t.is_closed,
            t.kanban_state,
            t.rating_last_value,
            t.working_days_close,
            t.working_days_open,
            t.working_hours_open,
            t.working_hours_close,
            t.milestone_id,
            pm.is_reached,
            pm.deadline
    ,
            t.effective_hours,
            t.subtask_effective_hours,
            t.planned_hours,
            t.overtime
    ,
        t.planned_date_begin,
        t.planned_date_end
    ,
        t.planned_date_start,
        t.planned_date_end
        
    

ERROR: column "planned_date_end" specified more than once

Failed to load registry Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/modules/registry.py", line 87, in new odoo.modules.load_modules(registry, force_demo, status, update_module) File "/home/odoo/src/odoo/odoo/modules/loading.py", line 485, in load_modules processed_modules += load_marked_modules(cr, graph, File "/home/odoo/src/odoo/odoo/modules/loading.py", line 373, in load_marked_modules loaded, processed = load_module_graph( File "/home/odoo/src/odoo/odoo/modules/loading.py", line 209, in load_module_graph registry.init_models(cr, model_names, {'module': package.name}, new_install) File "/home/odoo/src/odoo/odoo/modules/registry.py", line 527, in init_models model.init() File "/home/odoo/src/odoo/addons/project/report/project_report.py", line 148, in init self._cr.execute(""" File "/home/odoo/src/odoo/odoo/sql_db.py", line 321, in execute res = self._obj.execute(query, params) psycopg2.errors.DuplicateColumn: column "planned_date_end" specified more than once

To Reproduce

Steps to reproduce the behavior: I think it's specific to my DB but I'm not sure. I updated all my submodules and this happened.

Expected behavior It's suppose to update the module whithout any issue and build my branch.

HugoCLU avatar Feb 10 '25 13:02 HugoCLU

I also have the same issue, the problem is raised when you use Odoo Enterprise with the module project_enterprise installed on the same database.

This issue was generated in commit https://github.com/oca/project/commit/3689f1dfccf755c5d862c0e779ab0364215dea3a

I think the solution will be to check if the field planned_date_end is defined before trying to add it

alan196 avatar Mar 13 '25 19:03 alan196

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Sep 14 '25 12:09 github-actions[bot]