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

[14.0][MIG] sale_timesheet #2993

Merged
merged 3 commits into from
Jan 4, 2022
Merged

Conversation

MiquelRForgeFlow
Copy link
Contributor

Supersedes #2878.

@JulianaPoudou
Copy link

JulianaPoudou commented Dec 20, 2021

Hello @MiquelRForgeFlow ,
I launched the migration with the last commit of your script, the error below occurred:

2021-12-20 14:36:35,814 83074 ERROR fil14 OpenUpgrade: Error after 0:00:00.000710 running
UPDATE project_project
SET allow_billable = TRUE
WHERE pricing_type IS NOT NULL
2021-12-20 14:36:35,814 83074 ERROR fil14 OpenUpgrade: sale_timesheet: error in migration script /OpenUpgrade/openupgrade_scripts/scripts/sale_timesheet/14.0.1.0/post-migration.py: new row for relation "project_project" violates check constraint "project_project_timesheet_product_required_if_billable_and_time"

Going back to the previous version of this script in the function fill_allow_billable, the script is passed now (update timesheet_product_id)

def fill_allow_billable(env):
timesheet_product_id = env.ref("sale_timesheet.time_product", False)
openupgrade.logged_query(
env.cr,
"""
UPDATE project_project
SET allow_billable = TRUE,
timesheet_product_id = %s
WHERE pricing_type IS NOT NULL""",
(timesheet_product_id.id,),
)

So, my question is why did you delete this part in this function?
Thanks and regards,
Juliana

@pedrobaeza pedrobaeza force-pushed the 14.0-MIG-sale_timesheet branch from f029acf to 4f96b11 Compare January 4, 2022 08:15
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Added an improvement for preserving old billable_type values for any other module requiring it, and populate properly the timesheet product in projects.

@pedrobaeza pedrobaeza force-pushed the 14.0-MIG-sale_timesheet branch 2 times, most recently from 3589371 to 20bb937 Compare January 4, 2022 08:31
- FIX: Fill properly project timesheet product.
- IMP: Preserve old billable_type values: Any other module may need it.
@pedrobaeza pedrobaeza force-pushed the 14.0-MIG-sale_timesheet branch from 20bb937 to 07a3e4b Compare January 4, 2022 10:01
@pedrobaeza pedrobaeza merged commit 01be5b1 into OCA:14.0 Jan 4, 2022
@pedrobaeza pedrobaeza deleted the 14.0-MIG-sale_timesheet branch January 4, 2022 10:10
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.

4 participants