Skip to content

Conversation

@daiduongnguyen-odoo
Copy link
Contributor

No description provided.

@pedrobaeza
Copy link
Member

/ocabot migration analytic

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jun 13, 2024
@acpMicrocom
Copy link

acpMicrocom commented Sep 25, 2024

Hi @duong77476-viindoo ,

First of all, thank you for the work you've done on this pull request. While testing in my environment, I encountered a small issue related to property creation in the post-migration file, specifically on line 66.

The problem seemed to be that some properties already existed, causing an error when trying to recreate them. I suggest a solution to check if the property exists before creating it. The fix I applied is as follows:

  if vals_list:
      for vals in vals_list:
          property = env['ir.property'].search([('fields_id', '=', vals['fields_id']),
                                                ('company_id', '=', vals['company_id']),
                                                ('res_id', '=', vals['res_id'])])
          if property:
              property.write(vals)
          else:
              env["ir.property"].create(vals) 

This prevents recreating existing properties and only applies changes when necessary.

I'm not sure of the best way to submit this modification, so I wanted to ask if I should create another pull request with these changes or if you'd prefer to integrate them directly into this one.

Thanks again for your work and help!

@daiduongnguyen-odoo
Copy link
Contributor Author

@acpMicrocom Thanks, i will apply your fix soon, i don't have time to test though because we stop migration campaign for now

}
)
if vals_list:
env["ir.property"].create(vals_list)
Copy link
Member

Choose a reason for hiding this comment

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

I suggest to use ir.property#_set_multi here, this also takes care of @acpMicrocom's problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah indeed hehe

@hbrunn
Copy link
Member

hbrunn commented Oct 21, 2024

@duong77476-viindoo I don't manage to push commits onto your branch, so I'll start superseding your PRs with new ones

@hbrunn hbrunn closed this Oct 21, 2024
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.

5 participants