Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] Hairdresser: Improved the module #238

Closed
Closed
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
85 changes: 85 additions & 0 deletions hair_dresser/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
'name': 'Hair Salon',
'version': '1.0',
'category': 'Services',
'description': """
This module is for hair salons providing hair-related services such as hair cutting, brushing, coloring, hair and
scalp treatments, beard and mustache shaping.
""",
'depends': [
'account',
'analytic',
'appointment',
'base',
"base_automation",
'base_geolocalize',
'base_vat',
'contacts',
'calendar',
'hair_dresser',
'hr',
'knowledge',
'loyalty',
'point_of_sale',
'product',
'product_barcodelookup',
'purchase',
'purchase_stock',
'stock',
'stock_account',
'website',
'web_studio',
'website_appointment',
],
'data': [
'data/res_config_settings.xml',
'data/ir_attachment_pre.xml',
'data/ir_model_fields.xml',
'data/ir_ui_view.xml',
'data/ir_actions_server.xml',
'data/base_automation.xml',
'data/product_category.xml',
'data/pos_config.xml',
'data/pos_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/knowledge_cover.xml',
'data/knowledge_article.xml',
'data/knowledge_article_favorite.xml',
'data/mail_message.xml',
'data/appointment_type.xml',
'data/ir_actions_actions.xml',
],
'demo': [
'demo/res_partner.xml',
'demo/hr_employee.xml',
'demo/res_users.xml',
'demo/product_supplierinfo.xml',
'demo/appointment_type.xml',
'demo/calendar_event.xml',
'demo/purchase_order.xml',
'demo/website.xml',
'demo/website_ir_attachment.xml',
'demo/website_view.xml',
'demo/theme_apply.xml',
'demo/purchase_order_line.xml',
'demo/purchase_order_confirm.xml',
'demo/delivery_confirm.xml',
],
'license': 'OPL-1',
'assets': {
'web.assets_backend': [
'automobile/static/src/js/my_tour.js',
]
},
'author': 'Odoo S.A.',
"cloc_exclude": [
"data/knowledge_article.xml",
"static/src/js/my_tour.js",
],
'images': ['images/main.png'],
}
88 changes: 88 additions & 0 deletions hair_dresser/data/appointment_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="appointment_type_4" model="appointment.type">
<field name="category">recurring</field>
<field name="appointment_duration">0.5</field>
<field name="name">Men's Haircut</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="location_id" ref="base.main_partner"/>
</record>
<record id="appointment_type_5" model="appointment.type">
<field name="category">recurring</field>
<field name="image_1920" type="base64" file="hair_dresser/static/src/binary/appointment_type/5-image_1920"/>
<field name="name">Men's Haircut + Beard Shaping</field>
<field name="location_id" ref="base.main_partner"/>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
</record>
<record id="appointment_type_6" model="appointment.type">
<field name="category">recurring</field>
<field name="appointment_duration">0.5</field>
<field name="image_1920" type="base64" file="hair_dresser/static/src/binary/appointment_type/6-image_1920"/>
<field name="min_schedule_hours">0.5</field>
<field name="name">Beard Shaping</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="location_id" ref="base.main_partner"/>
</record>
<record id="appointment_type_7" model="appointment.type">
<field name="category">recurring</field>
<field name="has_payment_step" eval="True"/>
<field name="appointment_duration">0.5</field>
<field name="work_hours_activated" eval="True"/>
<field name="image_1920" type="base64" file="hair_dresser/static/src/binary/appointment_type/7-image_1920"/>
<field name="name">Brushing JP</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="location_id" ref="base.main_partner"/>
<field name="product_id" ref="product_product_27"/>
</record>
<record id="appointment_type_8" model="appointment.type">
<field name="category">recurring</field>
<field name="has_payment_step" eval="True"/>
<field name="appointment_duration">0.5</field>
<field name="image_1920" type="base64" file="hair_dresser/static/src/binary/appointment_type/8-image_1920"/>
<field name="min_schedule_hours">0.5</field>
<field name="name">Beard Shaping JP</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="location_id" ref="base.main_partner"/>
<field name="product_id" ref="product_product_7"/>
</record>
<record id="appointment_type_9" model="appointment.type">
<field name="category">recurring</field>
<field name="has_payment_step" eval="True"/>
<field name="appointment_duration">0.5</field>
<field name="image_1920" type="base64" file="hair_dresser/static/src/binary/appointment_type/9-image_1920"/>
<field name="name">Men's Haircut JP</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="location_id" ref="base.main_partner"/>
<field name="product_id" ref="product_product_26"/>
</record>
<record id="appointment_type_1" model="appointment.type">
<field name="category">recurring</field>
<field name="avatars_display">show</field>
<field name="sequence">11</field>
<field name="work_hours_activated" eval="True"/>
<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="hair_dresser/static/src/binary/appointment_type/1-image_1920"/>
<field name="name">Haircut &amp; Brushing</field>
<field name="location_id" ref="base.main_partner"/>
</record>
<record id="appointment_type_2" model="appointment.type">
<field name="category">recurring</field>
<field name="avatars_display">show</field>
<field name="appointment_duration">3.0</field>
<field name="work_hours_activated" eval="True"/>
<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="hair_dresser/static/src/binary/appointment_type/2-image_1920"/>
<field name="name">Haircut &amp; Color &amp; Brushing</field>
<field name="location_id" ref="base.main_partner"/>
</record>
<record id="appointment_type_3" model="appointment.type">
<field name="category">recurring</field>
<field name="avatars_display">show</field>
<field name="appointment_duration">0.5</field>
<field name="work_hours_activated" eval="True"/>
<field name="image_1920" type="base64" file="hair_dresser/static/src/binary/appointment_type/3-image_1920"/>
<field name="name">Brushing</field>
<field name="appointment_tz" model="res.users" eval="obj().env.ref('base.user_admin').tz or 'Europe/Brussels'"/>
<field name="location_id" ref="base.main_partner"/>
</record>
</odoo>
10 changes: 10 additions & 0 deletions hair_dresser/data/base_automation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="delete_subpart_calendar_event" model="base.automation">
<field name="name">Break Appointment</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="action_server_ids" eval="[(6, 0, [ref('break_subpart_calendar_event_server_action')])]"/>
<field name="trigger">on_create_or_write</field>
<field name="filter_domain">[("x_break_start", "!=", False), ("x_break_end", "!=", False), ("user_id", "!=", False),("display_name", "not ilike", "PART 1"), ("display_name", "not ilike", "PART 2")]</field>
</record>
</odoo>
9 changes: 9 additions & 0 deletions hair_dresser/data/ir_actions_actions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="appointment.calendar_event_action_view_bookings_users" model="ir.actions.act_window">
<field name="name">Staff Bookings</field>
<field name="type">ir.actions.act_window</field>
<field name="domain">[("x_visibility", "=", False)]</field>
<field name="res_model">calendar.event</field>
</record>
</odoo>
42 changes: 42 additions & 0 deletions hair_dresser/data/ir_actions_server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="break_subpart_calendar_event_server_action" model="ir.actions.server">
<field name="code"><![CDATA[x_break_start = record.x_break_start
x_break_end = record.x_break_end
appointment_duration = record.duration

start_time = record.start
end_time = record.stop
if record.create_date >= datetime.datetime.now() - datetime.timedelta(minutes=5) and not record.x_appointment_part_1 and not record.x_appointment_part_2:
event2_vals = {
'name': "[PART 1]" + record.name ,
'start': start_time,
'stop': start_time + datetime.timedelta(hours=x_break_start),
'user_id': record.user_id.id,
'x_parent_id': record.id,
'alarm_ids' : [],
'partner_ids': [record.partner_ids[0].id],
'appointment_type_id':record.appointment_type_id.id,
}
part_1 = env['calendar.event'].create(event2_vals)

# Third event - From Break End to Original End
event3_vals = {
'name': "[PART 2]" + record.name,
'start': start_time + datetime.timedelta(hours=x_break_end),
'stop': end_time,
'user_id': record.user_id.id,
'partner_ids': [record.partner_ids[0].id],
'x_parent_id': record.id,
'alarm_ids' : [],
'appointment_type_id':record.appointment_type_id.id,
}
part_2 = env['calendar.event'].create(event3_vals)

record.write({'x_visibility':True,'show_as': "free",'x_appointment_part_1': part_1.id, 'x_appointment_part_2': part_2.id})
]]></field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="state">code</field>
<field name="name">Execute Code</field>
</record>
</odoo>
7 changes: 7 additions & 0 deletions hair_dresser/data/ir_attachment_pre.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="ir_attachment_926" model="ir.attachment">
<field name="name">unsplash_iZgQKxuMRHc_.jpg</field>
<field name="datas" type="base64" file="hair_dresser/static/src/binary/ir_attachment/knowledge_cover.jpg"/>
</record>
</odoo>
66 changes: 66 additions & 0 deletions hair_dresser/data/ir_model_fields.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="x_break_end_appointment_model" model="ir.model.fields">
<field name="ttype">float</field>
<field name="field_description">Break End</field>
<field name="model_id" ref="appointment.model_appointment_type"/>
<field name="name">x_break_end_appointment</field>
</record>
<record id="x_break" model="ir.model.fields">
<field name="ttype">boolean</field>
<field name="field_description">Break</field>
<field name="model_id" ref="appointment.model_appointment_type"/>
<field name="help">Insert a free time in your booking.</field>
<field name="name">x_break</field>
</record>
<record id="x_break_start_appointment_model" model="ir.model.fields">
<field name="ttype">float</field>
<field name="field_description">Break Start</field>
<field name="model_id" ref="appointment.model_appointment_type"/>
<field name="name">x_break_start_appointment</field>
</record>
<record id="x_parent_id" model="ir.model.fields">
<field name="ttype">many2one</field>
<field name="field_description">Linked to</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="name">x_parent_id</field>
<field name="on_delete">cascade</field>
<field name="relation">calendar.event</field>
</record>
<record id="x_appointment_part_2" model="ir.model.fields">
<field name="ttype">many2one</field>
<field name="field_description">Part 2</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="name">x_appointment_part_2</field>
<field name="on_delete">cascade</field>
<field name="relation">calendar.event</field>
</record>
<record id="x_appointment_part_1" model="ir.model.fields">
<field name="ttype">many2one</field>
<field name="field_description">Part 1</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="name">x_appointment_part_1</field>
<field name="on_delete">cascade</field>
<field name="relation">calendar.event</field>
</record>
<record id="calendar_x_break_end" model="ir.model.fields">
<field name="ttype">float</field>
<field name="field_description">Break End</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="name">x_break_end</field>
<field name="related">appointment_type_id.x_break_end_appointment</field>
</record>
<record id="calendar_x_break_start" model="ir.model.fields">
<field name="ttype">float</field>
<field name="field_description">Break Start</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="name">x_break_start</field>
<field name="related">appointment_type_id.x_break_start_appointment</field>
</record>
<record id="x_visibility" model="ir.model.fields">
<field name="ttype">boolean</field>
<field name="field_description">invisibility in gantt</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="name">x_visibility</field>
</record>
</odoo>
58 changes: 58 additions & 0 deletions hair_dresser/data/ir_ui_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="appointment_type_customization" model="ir.ui.view">
<field name="arch" type="xml">
<xpath expr="//form[1]/sheet[1]/group[1]/group[@name='left_details']/div[1]" position="after">
<field name="x_break" widget="boolean"/>
<field name="x_break_start_appointment" widget="float_time" invisible="not x_break"/>
<field name="x_break_end_appointment" widget="float_time" invisible="not x_break"/>
</xpath>
</field>
<field name="active" eval="True"/>
<field name="inherit_id" ref="appointment.appointment_type_view_form"/>
<field name="mode">extension</field>
<field name="model">appointment.type</field>
<field name="name">appointment.type.form customization</field>
<field name="priority">200</field>
<field name="type">form</field>
</record>
<record id="calendar_event_view_form_gantt_booking_inherit" model="ir.ui.view">
<field name="name">calendar.event.view.form.gantt.booking.inherit</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="appointment.calendar_event_view_form_gantt_booking"/>
<field name="active" eval="True"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet/group/group" position="after">
<div class="o_form_group o_inline" invisible="not x_parent_id">
<label for="x_parent_id" string="Linked to:" class="oe_inline me-2"/>
<field name="x_parent_id" options="{'no_create': True}" class="oe_inline"/>
</div>
</xpath>
</field>
</record>
<record id="calendar_event_parent_customization" model="ir.ui.view">
<field name="arch" type="xml">
<xpath expr="//form[1]/sheet[1]/group[1]/group[1]/div[1]" position="after">
<field name="x_break_start" invisible="x_parent_id" widget="float_time"/>
<field name="x_break_end" invisible="x_parent_id" widget="float_time"/>
</xpath>
<xpath expr="//field[@name='location']" position="before">
<field name="x_appointment_part_2" invisible="not x_appointment_part_2"/>
<field name="x_appointment_part_1" invisible="not x_appointment_part_1"/>
<field name="x_parent_id" invisible="not x_parent_id"/>
<field name="x_visibility" invisible="True"/>
</xpath>
<xpath expr="//field[@name='partner_ids']" position="attributes">
<attribute name="force_save">0</attribute>
<attribute name="readonly">False</attribute>
</xpath>
</field>
<field name="active" eval="True"/>
<field name="inherit_id" ref="calendar.view_calendar_event_form"/>
<field name="mode">extension</field>
<field name="model">calendar.event</field>
<field name="name">calendar.event.form customization</field>
<field name="priority">160</field>
<field name="type">form</field>
</record>
</odoo>
Loading