diff --git a/booking_channex/data/ir_actions_act_window.xml b/booking_channex/data/ir_actions_act_window.xml
index e8541b924e..edb487e102 100644
--- a/booking_channex/data/ir_actions_act_window.xml
+++ b/booking_channex/data/ir_actions_act_window.xml
@@ -26,4 +26,10 @@
form
new
+
+ Channex Logs
+ ir.logging
+ list,form
+ [('name', '=', 'Channex Log')]
+
diff --git a/booking_channex/data/ir_actions_server.xml b/booking_channex/data/ir_actions_server.xml
index c6cfb52ae9..7f40cb832f 100644
--- a/booking_channex/data/ir_actions_server.xml
+++ b/booking_channex/data/ir_actions_server.xml
@@ -6,10 +6,10 @@
+
+ code
+
+
+ Channex: Util, GET request for all records in channex
+
code
@@ -46,6 +62,19 @@ if not mapping:
"x_local_id": local_id,
})
action = mapping
+]]>
+
+ code
+
+
+ Channex: Util, Log Channex State Message
+
code
@@ -529,7 +558,7 @@ if env['ir.config_parameter'].get_bool('booking_channex.synced_with_channex'):
"room_type_id": room_remote_id,
"currency": rp.x_pricelist_id.currency_id.name,
"options": [{
- "occupancy": rp.x_total_inventory or 1,
+ "occupancy": rp.x_total_occupancy or 1,
"is_primary": True,
"rate": int(rp.x_variant_id.lst_price*100),
}]
@@ -559,7 +588,7 @@ mappings.unlink()
Channex: Sync, Update Rate Plan On Channex
-
+
- Channex: Sync Data
+ Channex: Daily Synchronization Check
code
1 else rooms
+ if property_rooms:
+ availabilty_payload.extend(env.ref('booking_channex.prepare_availability_payload').with_context(active_ids=property_rooms.ids, active_id=property_rooms.ids[0], active_model="product.product", property_remote_id=property_remote_id).run())
+ rate_plans = env['x_rate_plan'].search([('x_variant_id', 'in', property_rooms.ids)])
+ if rate_plans:
+ restriction_payload.extend(env.ref('booking_channex.prepare_rate_payload').with_context(active_ids=rate_plans.ids, active_id=rate_plans.ids[0], active_model="x_rate_plan", property_remote_id=property_remote_id, date_list=date_list).run())
+try: env.ref('booking_channex.requests_to_channex').with_context(method="POST", endpoint="availability", payload={'values': availabilty_payload}).run()
+except Exception as e: log_sync_message('POST', 'availability', f"Daily sync: Failed to send availabilities ; error is :\n{str(e)}")
+try: env.ref('booking_channex.requests_to_channex').with_context(method="POST", endpoint="restrictions", payload={'values': restriction_payload}).run()
+except Exception as e: log_sync_message('POST', 'restrictions', f"Daily sync: Failed to send rates to rate plans; error is :\n{str(e)}")
-self.env['ir.cron']._commit_progress(remaining=2)
+log_sync_message('/', '/', "Daily sync: The daily synchronization finished running")
-#GROUPS
-all_channex_groups = env.ref('booking_channex.requests_to_channex').with_context(
- method="GET", endpoint="groups"
-).run().json.get('data', {})
-
-channex_groups_by_id = {group.get("id"): group for group in all_channex_groups}
-channex_groups_mapping = {}
-odoo_groups_mapping = {}
-for group_map in env['x_channex_mapping'].search([('x_model_type', '=', 'group')]):
- group_record = env.browse(group_map.x_local_id)
- channex_groups_mapping[group_map.x_remote_id] = group_record
- odoo_groups_mapping[group_record] = group_map.x_remote_id
-
-for el in channex_groups_by_id.values():
- if not (el.get("id") and (channex_groups_mapping.get(el.get("id")))):
- to_remove_groups.append(el.get("id"))
-
-for group in env['x_channex_group'].search([]):
- if group_remote_id := odoo_groups_mapping.get(group):
- if not (group_remote_id and channex_groups_by_id.get(group_remote_id)):
- to_add_groups.append(group.id)
-
-for group_channex_id in to_remove_groups:
- env.ref('booking_channex.requests_to_channex').with_context(method="DELETE", endpoint="groups/%s" % group_channex_id).run()
-
-self.env['ir.cron']._commit_progress(remaining=1)
-
-#At the end so the order of creation is respected
-env.ref('booking_channex.create_groups_on_channex').with_context(active_ids=to_add_groups, active_model="x_channex_group").run()
-env.ref('booking_channex.create_property_on_channex').with_context(active_ids=to_add_properties, active_model="res.company").run()
-env.ref('booking_channex.actualize_room_on_channex').with_context(active_ids=to_add_rooms, active_model="product.product").run()
-env.ref('booking_channex.create_rate_plan_on_channex').with_context(active_ids=to_add_rate_plans, active_model="x_rate_plan").run()
-
-self.env['ir.cron']._commit_progress(remaining=0)
+env['ir.cron']._commit_progress(remaining=0)
]]>
diff --git a/booking_channex/data/ir_model_fields.xml b/booking_channex/data/ir_model_fields.xml
index 18641c4653..44993c30f3 100644
--- a/booking_channex/data/ir_model_fields.xml
+++ b/booking_channex/data/ir_model_fields.xml
@@ -91,18 +91,19 @@ for record in self:
x_name
-
+
integer
- x_variant_id.x_resource_ids
+ x_variant_id
- Total Inventory
+ Total Occupancy
- x_total_inventory
+ x_total_occupancy
diff --git a/booking_channex/data/ir_ui_menu.xml b/booking_channex/data/ir_ui_menu.xml
index 0278ee4a5e..b5921e8df0 100644
--- a/booking_channex/data/ir_ui_menu.xml
+++ b/booking_channex/data/ir_ui_menu.xml
@@ -24,4 +24,10 @@
action="action_window_show_channex_groups"
groups="base.group_system"
/>
+
diff --git a/booking_channex/data/ir_ui_view.xml b/booking_channex/data/ir_ui_view.xml
index 27fe577099..525361508a 100644
--- a/booking_channex/data/ir_ui_view.xml
+++ b/booking_channex/data/ir_ui_view.xml
@@ -61,7 +61,7 @@
-
+
@@ -78,7 +78,7 @@
-
+
@@ -212,6 +212,40 @@
form
+
+
+
+
+ hide
+
+
+ hide
+
+
+ hide
+
+
+ hide
+
+
+ hide
+
+
+ hide
+
+
+
+
+
+
+ primary ir.logging
+ ir.logging.tree.view.extension
+
+ list
+
+
+
+