Skip to content

Saas 19.3 channex new group model frva#17

Merged
frva-odoo merged 1 commit into
saas-19.3-booking-channex-main-branch-frvafrom
saas-19.3-channex-new-group-model-frva
Jul 9, 2026
Merged

Saas 19.3 channex new group model frva#17
frva-odoo merged 1 commit into
saas-19.3-booking-channex-main-branch-frvafrom
saas-19.3-channex-new-group-model-frva

Conversation

@frva-odoo

@frva-odoo frva-odoo commented Jun 19, 2026

Copy link
Copy Markdown

This PR adds the new x_channex_group model to match the
group model of channex, and also fixes a lot of small issues
through the whole booking channex module after the first testings
on runbot and some other testing on saas.

Task-6314730

@frva-odoo frva-odoo force-pushed the saas-19.3-channex-new-group-model-frva branch 4 times, most recently from a0d35c2 to bf31ae4 Compare June 29, 2026 07:24
@frva-odoo frva-odoo force-pushed the saas-19.3-channex-new-group-model-frva branch from bf31ae4 to b869752 Compare June 30, 2026 10:18
@frva-odoo

Copy link
Copy Markdown
Author

hello @chga-odoo Could you do a review of this when you have the time ? Thank you very much 🙏

@frva-odoo frva-odoo requested a review from chga-odoo June 30, 2026 11:08
@frva-odoo frva-odoo force-pushed the saas-19.3-channex-new-group-model-frva branch 2 times, most recently from 6eef6c4 to 2aacb8e Compare July 3, 2026 11:49
@frva-odoo frva-odoo force-pushed the saas-19.3-channex-new-group-model-frva branch from 2aacb8e to c441658 Compare July 8, 2026 13:21
for i in range(501)
]
payload_values = env.ref('booking_channex.prepare_rate_payload').with_context(active_ids=rate_plans, property_remote_id=property_mapping.x_remote_id, date_list=date_list).run()
payload_values = env.ref('booking_channex.prepare_rate_payload').with_context(active_ids=rate_plans, active_id=rate_plans[0], property_remote_id=property_mapping.x_remote_id, date_list=date_list).run()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why we need to pass active_id here? and if its needed then we should add check for not null before passing first element.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

So this is weird even to me... This is coming from a bug found by SAVP testing on a saas where using the server action with active_model but without active_id (even if we assign active_ids) was making it fail, as it was trying to fill and use a newID in active_id (one that wasn't created yet and so it failed). This is a weird bug, apparently I'm not the only one encountering it, but I found that setting a fixed active_id was solving the issue so I put that for now until we fix it.
I'm still looking for what could have caused this, but for now I thought it was better to put this small fix. However you're right, I was too quick and didn't look enough about the cases where it could be false, I'll correct this now

@chga-odoo chga-odoo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @frva-odoo
nicely handle flow, just few suggestions and doubts .

is_db_multi_company = (env['res.company'].search_count([]) > 1)
groups = env['x_channex_group'].search([])
if not groups or not any(groups.mapped('x_company_ids')):
groups += (env['x_channex_group'].create({'x_name': env.company.name, 'x_company_ids': [env.company.id]}))

@chga-odoo chga-odoo Jul 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what about child companies, is here need to set child companies as property or set manually?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Adding this "group" model removed the old logic of "child companies are the properties on channex". Now if we want to include these child companies, we have to put them in the group in odoo too so they are pushed to channex next to their parents.
This line specifically however is mostly a fallback, so that we always have a group and a company to push to channex (and we want to put as few as possible as it was not intentionally put in a group, so only the one from the current user by default)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if not (el.get("id") and channex_rates_mapping.get(el.get("id"))):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if not channex_rate_plans_by_id.get(rate_remote_id):

@@ -845,17 +898,18 @@ for el in channex_rooms_by_id.values():
if not (el.get("id") and (room_record := channex_rooms_mapping.get(el.get("id")))):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if not (el.get("id") and (room_record := channex_rooms_mapping.get(el.get("id")))):
if not (el.get("id") and channex_rooms_mapping.get(el.get("id"))):

for room in env['product.product'].search([('x_is_a_room_offer', '=', True), ('x_resource_ids', '!=', False)]):
for room in env['product.product'].search([('x_is_a_room_offer', '=', True)]):
if room_remote_id := odoo_rooms_mapping.get(room):
if not (room_remote_id and (el := channex_rooms_by_id.get(room_remote_id))):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if not (room_remote_id and (el := channex_rooms_by_id.get(room_remote_id))):
if not channex_rooms_by_id.get(room_remote_id):

In this server action so many unnecessary walrus operator you can remove that.

Comment on lines +1050 to 1056
<record id="server_action_create_rate_plans_from_pricelist_2" model="ir.actions.server">
<field name="name">Rate Plan: Create Rate Plan on pricelist created</field>
<field name="code"><![CDATA[
records.env.ref('booking_channex.server_action_create_remove_rate_plans').with_context(pricelists=records).run()
]]></field>
<field name="model_id" ref="product.model_product_pricelist"/>
<field name="state">code</field>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why duplicate these all server actions?? 🤔

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I only learnt recently but a server action cannot be used for multiple automations at the same time. (Because they are assigned with base_auomation_id, which is a many2one)
So if I don't do that the automation where they are assigned first gets empty when I assign them to others afterwards.

This commit adds the new x_channex_group model to match the
group model of channex, and also fixes a lot of small issues
through the whole booking channex module after the first testings
on runbot and some other testing on saas.

Task-6314730
@frva-odoo frva-odoo force-pushed the saas-19.3-channex-new-group-model-frva branch from c441658 to 8e9f277 Compare July 9, 2026 13:43
@frva-odoo

Copy link
Copy Markdown
Author

Thanks for the review @chga-odoo , reworked the commit. Tell me if I can merge or if you still have some doubts about something 😄

@chga-odoo

Copy link
Copy Markdown

Thanks for the review @chga-odoo , reworked the commit. Tell me if I can merge or if you still have some doubts about something 😄

Thanks @frva-odoo, ready to go 🚀

@frva-odoo frva-odoo merged commit c0ede2f into saas-19.3-booking-channex-main-branch-frva Jul 9, 2026
1 of 2 checks passed
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.

2 participants