Saas 19.3 channex new group model frva#17
Conversation
a0d35c2 to
bf31ae4
Compare
bf31ae4 to
b869752
Compare
|
hello @chga-odoo Could you do a review of this when you have the time ? Thank you very much 🙏 |
6eef6c4 to
2aacb8e
Compare
2aacb8e to
c441658
Compare
| 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() |
There was a problem hiding this comment.
why we need to pass active_id here? and if its needed then we should add check for not null before passing first element.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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]})) |
There was a problem hiding this comment.
what about child companies, is here need to set child companies as property or set manually?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
| if not (el.get("id") and channex_rates_mapping.get(el.get("id"))): |
There was a problem hiding this comment.
| 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")))): | |||
There was a problem hiding this comment.
| 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))): |
There was a problem hiding this comment.
| 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.
| <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> |
There was a problem hiding this comment.
why duplicate these all server actions?? 🤔
There was a problem hiding this comment.
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
c441658 to
8e9f277
Compare
|
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 🚀 |
c0ede2f
into
saas-19.3-booking-channex-main-branch-frva
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