Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,15 @@ resource_name = toy_store
replace_edited_strings = false
keep_translations = false

[o:odoo:p:odoo-s18-1:r:veterinary_clinic]
file_filter = veterinary_clinic/i18n/<lang>.po
source_file = veterinary_clinic/i18n/veterinary_clinic.pot
type = PO
minimum_perc = 0
resource_name = veterinary_clinic
replace_edited_strings = false
keep_translations = false

[o:odoo:p:odoo-s18-1:r:wedding_planner]
file_filter = wedding_planner/i18n/<lang>.po
source_file = wedding_planner/i18n/wedding_planner.pot
Expand Down
93 changes: 93 additions & 0 deletions veterinary_clinic/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
'name': 'Veterinary Clinic',
'version': '1.0',
'category': 'Health and Fitness',
'author': 'Odoo S.A.',
'depends': [
'crm_enterprise',
'documents_sign',
'industry_fsm_sale_report',
'knowledge',
'pos_online_payment',
'sale_crm',
'sale_planning',
'web_studio',
'website_appointment_crm',
],
'data': [
'data/res_config_settings.xml',
'data/ir_model.xml',
'data/ir_model_fields.xml',
'data/ir_actions_act_window.xml',
'data/base_automation.xml',
'data/ir_actions_server.xml',
'data/ir_ui_view.xml',
'data/ir_ui_menu.xml',
'data/ir_model_access.xml',
'data/ir_default.xml',
'data/ir_sequence.xml',
'data/crm_stage.xml',
'data/documents_document.xml',
'data/knowledge_article.xml',
'data/ir_attachment_post.xml',
'data/project_task_type.xml',
'data/project_project.xml',
'data/product_category.xml',
'data/product_template.xml',
'data/product_attribute.xml',
'data/product_attribute_value.xml',
'data/product_template_attribute_line.xml',
'data/product_template_attribute_value.xml',
'data/product_product.xml',
'data/sale_order_template.xml',
'data/sale_order_template_line.xml',
'data/sign_template.xml',
'data/sign_item.xml',
'data/x_species.xml',
'data/x_illnesses.xml',
'data/x_species_line.xml',
'data/x_pets.xml',
'data/x_vaccines.xml',
'data/mail_message.xml',
'data/knowledge_article_favorite.xml',
'data/knowledge_tour.xml',
'data/pos_payment_method.xml',
'data/pos_config.xml',
'data/appointment_type.xml',
'data/appointment_question.xml',
'data/appointment_answer.xml',
'data/crm_tag.xml',
'data/website_view.xml',
'data/website_theme_apply.xml',
],
'demo': [
'demo/appointment_type.xml',
'demo/appointment_question.xml',
'demo/crm_team.xml',
'demo/website.xml',
'demo/website_view.xml',
'demo/pos_session.xml',
'demo/res_partner.xml',
'demo/calendar_event.xml',
'demo/crm_lead.xml',
'demo/ir_attachment_post.xml',
'demo/sale_order.xml',
'demo/sale_order_line.xml',
'demo/x_pets.xml',
'demo/website_theme_apply.xml',
'demo/stock_warehouse_orderpoint.xml',
],
'license': 'OPL-1',
'assets': {
'web.assets_backend': [
'veterinary_clinic/static/src/js/my_tour.js',
]
},
'cloc_exclude': [
'data/knowledge_article.xml',
'data/website_view.xml',
'static/src/js/my_tour.js',
'demo/website_view.xml',
],
'images': ['images/main.png'],
}
35 changes: 35 additions & 0 deletions veterinary_clinic/data/appointment_answer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="appointment_answer_1" model="appointment.answer">
<field name="name">Annual Checkup / General Consultation</field>
<field name="question_id" ref="appointment_question_1"/>
</record>
<record id="appointment_answer_6" model="appointment.answer">
<field name="name">Cat</field>
<field name="question_id" ref="appointment_question_2"/>
</record>
<record id="appointment_answer_2" model="appointment.answer">
<field name="name">Pet is sick</field>
<field name="question_id" ref="appointment_question_1"/>
</record>
<record id="appointment_answer_7" model="appointment.answer">
<field name="name">Dog</field>
<field name="question_id" ref="appointment_question_2"/>
</record>
<record id="appointment_answer_3" model="appointment.answer">
<field name="question_id" ref="appointment_question_1"/>
<field name="name">Dental checkup</field>
</record>
<record id="appointment_answer_8" model="appointment.answer">
<field name="name">Other</field>
<field name="question_id" ref="appointment_question_2"/>
</record>
<record id="appointment_answer_4" model="appointment.answer">
<field name="name">First visit</field>
<field name="question_id" ref="appointment_question_1"/>
</record>
<record id="appointment_answer_5" model="appointment.answer">
<field name="name">Vaccination</field>
<field name="question_id" ref="appointment_question_1"/>
</record>
</odoo>
15 changes: 15 additions & 0 deletions veterinary_clinic/data/appointment_question.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="appointment_question_1" model="appointment.question">
<field name="name">Purpose of the visit</field>
<field name="appointment_type_id" ref="appointment_type_1"/>
</record>
<record id="appointment_question_2" model="appointment.question">
<field name="name">Animal species</field>
<field name="appointment_type_id" ref="appointment_type_1"/>
</record>
<record id="appointment_question_5" model="appointment.question">
<field name="name">Questions or remarks</field>
<field name="appointment_type_id" ref="appointment_type_1"/>
</record>
</odoo>
36 changes: 36 additions & 0 deletions veterinary_clinic/data/appointment_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="appointment_type_1" model="appointment.type">
<field name="name">Consultation - Checkup</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="image_1920" type="base64" file="veterinary_clinic/static/src/binary/appointment_type/1-image_1920"/>
<field name="appointment_duration">0.5</field>
<field name="location_id" ref="base.main_partner"/>
<field name="assign_method">time_resource</field>
<field name="category">recurring</field>
<field name="avatars_display">hide</field>
<field name="message_intro"><![CDATA[<p>Easily schedule an appointment with our experienced veterinary team to keep your pet happy and healthy. Whether it’s a routine check-up, vaccinations, or specialized care, we’re here to provide expert, compassionate service.</p>
<p>✔ Convenient online booking</p>
<p>✔ Flexible appointment times</p>
<p>✔ Experienced &amp; caring veterinarians</p>
<p>Secure your spot today and give your pet the care they deserve!</p>
<p><span class="overflow-hidden text-clip whitespace-nowrap text-sm"></span></p>]]></field>
<field name="min_cancellation_hours">4.0</field>
<field name="min_schedule_hours">24.0</field>
<field name="max_schedule_days">30</field>
<field name="slot_creation_interval">0.75</field>
<field name="staff_user_ids" eval="[(6, 0, [ref('base.user_admin')])]"/>
<field name="slot_ids" eval="[
(0, 0, {'weekday': '1', 'start_hour': 9.0, 'end_hour': 12.0}),
(0, 0, {'weekday': '1', 'start_hour': 14.0, 'end_hour': 17.0}),
(0, 0, {'weekday': '2', 'start_hour': 9.0, 'end_hour': 12.0}),
(0, 0, {'weekday': '2', 'start_hour': 14.0, 'end_hour': 17.0}),
(0, 0, {'weekday': '3', 'start_hour': 9.0, 'end_hour': 12.0}),
(0, 0, {'weekday': '3', 'start_hour': 14.0, 'end_hour': 17.0}),
(0, 0, {'weekday': '4', 'start_hour': 9.0, 'end_hour': 12.0}),
(0, 0, {'weekday': '4', 'start_hour': 14.0, 'end_hour': 17.0}),
(0, 0, {'weekday': '5', 'start_hour': 9.0, 'end_hour': 12.0}),
(0, 0, {'weekday': '5', 'start_hour': 14.0, 'end_hour': 17.0}),
]"/>
</record>
</odoo>
15 changes: 15 additions & 0 deletions veterinary_clinic/data/base_automation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="appointment_sequence_automation_rule" model="base.automation">
<field name="name">Appointment Sequence</field>
<field name="model_id" ref="x_pets_line_model_record"/>
<field name="trigger">on_create_or_write</field>
<field name="trigger_field_ids" eval="[(6, 0, [ref('created_by_field')])]"/>
</record>
<record id="base_automation_3" model="base.automation">
<field name="name">Pet Owner Automation</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="trigger">on_change</field>
<field name="on_change_field_ids" eval="[(6, 0, [ref('calendar.field_calendar_event__create_uid')])]"/>
</record>
</odoo>
13 changes: 13 additions & 0 deletions veterinary_clinic/data/crm_stage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="crm.stage_lead1" model="crm.stage" forcecreate="1">
<field name="name">New request</field>
</record>
<record id="crm.stage_lead2" model="crm.stage" forcecreate="1">
<field name="name">Validated</field>
</record>
<record id="crm.stage_lead4" model="crm.stage" forcecreate="1">
<field name="name">Booked</field>
<field name="is_won" eval="True"/>
</record>
</odoo>
15 changes: 15 additions & 0 deletions veterinary_clinic/data/crm_tag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="crm_tag_1" model="crm.tag">
<field name="name">Surgery</field>
</record>
<record id="crm_tag_2" model="crm.tag">
<field name="name">First Visit</field>
</record>
<record id="crm_tag_3" model="crm.tag">
<field name="name">Dental checkup</field>
</record>
<record id="crm_tag_4" model="crm.tag">
<field name="name">Active treatment</field>
</record>
</odoo>
9 changes: 9 additions & 0 deletions veterinary_clinic/data/documents_document.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="documents_document_12" model="documents.document">
<field name="name">Surgeries</field>
<field name="type">folder</field>
<field name="owner_id" ref="base.user_admin"/>
<field name="folder_id" ref="documents_project.document_project_folder"/>
</record>
</odoo>
57 changes: 57 additions & 0 deletions veterinary_clinic/data/ir_actions_act_window.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="pets_window_action" model="ir.actions.act_window">
<field name="name">Pets</field>
<field name="res_model">x_pets</field>
<field name="view_mode">list,form,kanban</field>
</record>
<record id="species_window_action" model="ir.actions.act_window">
<field name="name">Species</field>
<field name="res_model">x_species</field>
</record>
<record id="vaccines_window_action" model="ir.actions.act_window">
<field name="name">Vaccines</field>
<field name="res_model">x_vaccines</field>
</record>
<record id="vaccines_tags_window_action" model="ir.actions.act_window">
<field name="name">Vaccines Tags</field>
<field name="res_model">x_vaccines_tag</field>
</record>
<record id="illness_window_action" model="ir.actions.act_window">
<field name="name">Illnesses</field>
<field name="res_model">x_illnesses</field>
</record>
<record id="veterinary_visits_window_action" model="ir.actions.act_window">
<field name="name">Veterinary Visits</field>
<field name="res_model">calendar.event</field>
<field name="context">{'search_default_x_many2many_field_6r2_1ijqjdqkq': active_id,'default_x_many2many_field_6r2_1ijqjdqkq': [active_id]}</field>
<field name="domain">[('x_new_pet_field', '=', active_id)]</field>
</record>
<record id="action_window_pets" model="ir.actions.act_window">
<field name="name">Pets</field>
<field name="res_model">x_pets</field>
<field name="view_mode">kanban,list,form</field>
</record>
<record id="sale_order_x_pet_id_window_action" model="ir.actions.act_window">
<field name="name">Sale Order</field>
<field name="res_model">sale.order</field>
<field name="context">{'search_default_x_pet_id': active_id,'default_x_pet_id': active_id}</field>
<field name="domain">[('x_pet_id', '=', active_id)]</field>
</record>
<record id="sale_order_x_pet_window_action" model="ir.actions.act_window">
<field name="name">Sale Order</field>
<field name="res_model">sale.order</field>
<field name="context">{'search_default_x_pet': active_id,'default_x_pet': active_id}</field>
<field name="domain">[('x_pet', '=', active_id)]</field>
</record>
<record id="consultations_pet_line_action_window" model="ir.actions.act_window">
<field name="name">Consultations</field>
<field name="res_model">x_pets_line_model</field>
</record>
<record id="pets_default_owner_window_action" model="ir.actions.act_window">
<field name="name">Pets </field>
<field name="res_model">x_pets</field>
<field name="context">{'search_default_x_owner': active_id,'default_x_owner': active_id}</field>
<field name="domain">[('x_owner', '=', active_id)]</field>
</record>
</odoo>
55 changes: 55 additions & 0 deletions veterinary_clinic/data/ir_actions_server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="ir_actions_server_795" model="ir.actions.server">
<field name="binding_model_id" ref="x_pets_line_model_record"/>
<field name="code"><![CDATA[
sale_order = env['sale.order'].search([('x_pet', '=', record.id)], limit=1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if there are 2 SO ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There won’t be any scenario with multiple sale orders due to the defined flow, and I’ve already ensured this by adding limit=1

Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if there is a second consultation for the same pet. Looks weird.
Also, I stumbled on this while trying to click on "return to the quotation"
https://83211568-saas-18-1-imported_with_demo.runbot212.odoo.com/odoo/documents/HzouzBQLSl6iUiuLFYZenwof
And I can't open the consultation again afterwards

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have resolved the issue and it will work fine as expected


if not sale_order:
# Create a demo sale order if none exists
sale_order = env['sale.order'].create({
'partner_id': record.x_pets_id.x_owner.id,
'x_pet': record.id,
})

ctx = dict(env.context, order_id=sale_order.id)
action = record.env['sale.order.line'].with_context(ctx).action_add_from_catalog()
]]></field>
<field name="model_id" ref="x_pets_line_model_record"/>
<field name="state">code</field>
<field name="name">catalog</field>
</record>
<record id="ir_actions_server_790" model="ir.actions.server">
<field name="binding_model_id" ref="x_pets_model"/>
<field name="code"><![CDATA[
action = {
'view_mode': 'form',
'res_model': 'x_pets',
'res_id': record.id,
'type': 'ir.actions.act_window',
}
]]></field>
<field name="model_id" ref="x_pets_model"/>
<field name="state">code</field>
<field name="name">View Action</field>
</record>
<record id="action_server_appointment_sequence" model="ir.actions.server" >
<field name="name">Appointment Sequence server action</field>
<field name="model_id" ref="x_pets_line_model_record"/>
<field name="state">code</field>
<field name="base_automation_id" ref="appointment_sequence_automation_rule"/>
<field name="code"><![CDATA[
for rec in records:
rec['x_name'] = "APP/" + rec.env['ir.sequence'].next_by_code('appointment.sequence')
]]></field>
</record>
<record id="action_server_pet_owner_automation" model="ir.actions.server" >
<field name="name">Pet Owner Automation</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="state">code</field>
<field name="base_automation_id" ref="base_automation_3"/>
<field name="code"><![CDATA[
record.write({'appointment_booker_id': env.user.partner_id.id})
]]></field>
</record>
</odoo>
Loading