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
3 changes: 3 additions & 0 deletions property_listing/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
'data/website_theme_apply.xml',
'data/website.xml',
],
'demo': [
'demo/website/website.xml',
],
'license': 'OEEL-1',
'cloc_exclude': [
'data/website_view.xml',
Expand Down
12 changes: 12 additions & 0 deletions property_listing/data/website.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,16 @@
<field name="prevent_sale_for">specific_categories</field>
<field name="prevent_sale_for_categories" eval="[(4, ref('product_public_category_1')), (4, ref('product_public_category_2'))]"/>
</record>
<!-- Stable handle on this specific website record: our own demo (like
real_estate's) later repoints base.default_website onto a second,
demo-only website, so anything that needs to keep targeting THIS
one afterwards can no longer rely on that xmlid. -->
<function model="ir.model.data" name="create">
<value eval="{
'name': 'default_website',
'module': 'property_listing',
'model': 'website',
'res_id': ref('base.default_website'),
}"/>
</function>
</odoo>
20 changes: 20 additions & 0 deletions property_listing/demo/website/website.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<!-- Create the demo website with a lower sequence than the one created by Odoo -->
<record id="website_industry" model="website">
<field name="name">Property Listing Demo Website</field>
<field name="prevent_sale">True</field>
<field name="prevent_sale_for">specific_categories</field>
<field name="prevent_sale_for_categories" eval="[(4, ref('product_public_category_1')), (4, ref('product_public_category_2'))]"/>
<field name="sequence">1</field>
<field name="configurator_done" eval="True"/>
</record>
<function name="write" model="ir.model.data">
<value model="ir.model.data" search="[
('name', '=', 'default_website'),
('module', '=', 'base'),
('model', '=', 'website'),
]"/>
<value eval="{'res_id': ref('website_industry')}"/>
</function>
</odoo>
32 changes: 25 additions & 7 deletions real_estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
'name': 'Real Estate Agency',
'version': '2.0',
'version': '2.1',
'category': 'Services',
'author': 'Odoo S.A.',
'depends': [
Expand Down Expand Up @@ -49,17 +49,34 @@
'data/website_view.xml',
'data/website_page.xml',
'data/website_menu.xml',
'data/website_theme_apply.xml',
'data/uninstall_hook.xml',
'data/website.xml',
],
'demo': [
# The website record comes first: property_listing (a dependency) already
# created it and repointed `base.default_website` onto it; this file
# only adds real_estate's own customizations to that same record.
'demo/website/website.xml',
'demo/website/views/website_templates.xml',
'demo/website/views/website_sale_templates.xml',
# Before any page: deactivates the generic website.homepage /
# website.contactus views by copy-on-write.
'demo/website/server_actions.xml',
'demo/website/assets.xml',
'demo/website/images.xml',
'demo/website/pages/contactus.xml',
'demo/website/pages/matchmaking.xml',
'demo/res_company.xml',
'demo/res_users.xml',
'demo/product_attribute_value.xml',
'demo/res_partner.xml',
'demo/hr_department.xml',
'demo/hr_employee.xml',
'demo/product_template.xml',
# After product_template.xml: the page's own <function> substitutes the raw
# /shop/<slug>-<id> links the export snapshotted, so the property templates
# it points at have to exist already.
'demo/website/pages/home.xml',
'demo/product_document.xml',
'demo/product_image.xml',
'demo/product_template_attribute_line.xml',
Expand All @@ -75,16 +92,17 @@
'demo/project_task.xml',
'demo/sale_commission_plan_user.xml',
'demo/ir_attachment_post.xml',
'demo/website_view.xml',
'demo/website_page.xml',
'demo/website_theme_apply.xml',
'demo/website.xml',
],
"cloc_exclude": [
"data/knowledge_article.xml",
"data/uninstall_hook.xml",
"data/website_view.xml",
"demo/website_view.xml",
"demo/website/pages/home.xml",
"demo/website/pages/contactus.xml",
"demo/website/pages/matchmaking.xml",
"demo/website/views/website_templates.xml",
"demo/website/views/website_sale_templates.xml",
"static/src/scss/primary_variables.scss",
],
'application': True,
'images': ['images/main.png'],
Expand Down
3 changes: 1 addition & 2 deletions real_estate/data/ir_actions_server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,11 @@ action.update({'view_mode': 'form', 'res_id': appointments.id}) if len(appointme
<field name="binding_model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="code"><![CDATA[
appointment_tz = env.ref('base.user_admin').tz or 'Europe/Brussels'
for record in records:
if record.x_booking_link: continue
if not record.x_agent_id: raise UserError(f"Please assign an agent first.")
link = env['appointment.invite'].create({'short_code': datetime.datetime.now().strftime("%M%m%S%d%Y%H") + str(record.id), 'display_name': record.name})
appointment = env['appointment.type'].create({'name': record.name, 'display_name': record.name, 'x_property_id': record.id, 'appointment_invite_ids': [Command.link(link.id)], 'location_id': record.x_technical_partner_id.id, 'image_1920': record.image_1920, 'appointment_tz': appointment_tz, 'staff_user_ids': [Command.link(record.x_agent_id.id)], 'category': 'custom', 'event_videocall_source': False})
appointment = env['appointment.type'].create({'name': record.name, 'display_name': record.name, 'x_property_id': record.id, 'appointment_invite_ids': [Command.link(link.id)], 'location_id': record.x_technical_partner_id.id, 'image_1920': record.image_1920, 'staff_user_ids': [Command.link(record.x_agent_id.id)], 'category': 'custom', 'event_videocall_source': False})

if env.context.get('from_form_view') and len(records) == 1:
action = {'type': 'ir.actions.act_window', 'res_model': 'appointment.type', 'view_mode': 'form', 'res_id': appointment.id}
Expand Down
10 changes: 5 additions & 5 deletions real_estate/data/product_attribute.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1" auto_sequence="1">
<record id="product_attribute_10" model="product.attribute">
<field name="name">Region</field>
<field name="name">State</field>
<field name="x_is_matchmaking" eval="True"/>
</record>
<record id="product_attribute_17" model="product.attribute">
<field name="name">Bathrooms</field>
<field name="x_is_matchmaking" eval="True"/>
</record>
<record id="product_attribute_11" model="product.attribute">
<field name="name">Type</field>
<field name="x_is_matchmaking" eval="True"/>
</record>
<record id="product_attribute_16" model="product.attribute">
<field name="name">Rooms</field>
<field name="display_type">pills</field>
<field name="x_is_matchmaking" eval="True"/>
</record>
<record id="product_attribute_11" model="product.attribute">
<field name="name">Type</field>
<field name="x_is_matchmaking" eval="True"/>
</record>
<record id="product_attribute_12" model="product.attribute">
<field name="name">Condition</field>
<field name="x_is_matchmaking" eval="True"/>
Expand Down
2 changes: 1 addition & 1 deletion real_estate/data/website.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="base.default_website" model="website" forcecreate="1">
<record id="property_listing.default_website" model="website" forcecreate="1">
<field name="name">Real Estate Agency</field>
</record>
</odoo>
4 changes: 2 additions & 2 deletions real_estate/data/website_base_unit.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="base_unit_1" model="product.base.unit">
<field name="name"></field>
<field name="name">sq ft</field>
</record>
<record id="base_unit_2" model="product.base.unit">
<field name="name">sqft</field>
</record>
<record id="base_unit_3" model="product.base.unit">
<field name="name">sqm</field>
<field name="name">acre</field>
</record>
</odoo>
12 changes: 10 additions & 2 deletions real_estate/data/website_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
<field name="page_id" ref="website_page_7"/>
<field name="url">/matchmaking</field>
<field name="sequence">20</field>
<field name="website_id" ref="base.default_website"/>
<field name="website_id" ref="property_listing.default_website"/>
<field name="parent_id" model="website.menu" eval="obj().search([
('website_id', '=', ref('base.default_website')),
('website_id', '=', ref('property_listing.default_website')),
('url', '=', '#'),
], limit=1).id"/>
</record>

<function model="website.menu" name="write">
<value model="website.menu" eval="obj().search([
('website_id', '=', ref('property_listing.default_website')),
('url', '=', '/contactus'),
], limit=1).id"/>
<value eval="{'name': 'Free estimate'}"/>
</function>
</odoo>
4 changes: 2 additions & 2 deletions real_estate/data/website_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<odoo noupdate="1">
<record id="website_page_7" model="website.page">
<field name="view_id" ref="matchmaking"/>
<field name="website_id" ref="base.default_website"/>
<field name="website_id" ref="property_listing.default_website"/>
<field name="is_published" eval="True"/>
<field name="url">/matchmaking</field>
</record>
<record id="website_page_6" model="website.page">
<field name="view_id" ref="contactus"/>
<field name="website_id" ref="base.default_website"/>
<field name="website_id" ref="property_listing.default_website"/>
<field name="is_published" eval="True"/>
<field name="url">/contactus</field>
</record>
Expand Down
17 changes: 0 additions & 17 deletions real_estate/data/website_theme_apply.xml

This file was deleted.

25 changes: 18 additions & 7 deletions real_estate/data/website_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="key">real_estate.contactus</field>
<field name="active" eval="True"/>
<field name="type">qweb</field>
<field name="website_id" ref="base.default_website"/>
<field name="website_id" ref="property_listing.default_website"/>
<field name="arch" type="xml">
<t name="Contact Us" t-name="website.contactus">
<t t-call="website.layout"
Expand Down Expand Up @@ -151,12 +151,18 @@
</t>
</field>
</record>

<function model="ir.ui.view" name="write">
<value model="ir.ui.view" eval="obj().env.ref('real_estate.contactus').id"/>
<value model="ir.ui.view" eval="{'arch': obj().env.ref('real_estate.contactus').arch.replace( 'value=&quot;*salesteam*&quot;', 'value=&quot;%s&quot;' % str( (team := obj().env.ref('sales_team.team_sales_department', raise_if_not_found=False) or obj().env['crm.team'].search([], limit=1) ) and team.id or 0))}"/>
</function>

<record id="matchmaking" model="ir.ui.view">
<field name="name">Matchmaking</field>
<field name="key">real_estate.matchmaking</field>
<field name="type">qweb</field>
<field name="active" eval="True"/>
<field name="website_id" ref="base.default_website"/>
<field name="website_id" ref="property_listing.default_website"/>
<field name="arch" type="xml">
<t t-name="website.matchmaking">
<t t-call="website.layout">
Expand Down Expand Up @@ -289,14 +295,19 @@
</field>
</record>

<!-- Studio fields the website form builder is allowed to write. -->
<function model="ir.model.fields" name="formbuilder_whitelist">
<value eval="'crm.lead'"/>
<value eval="['x_interested_in_id']"/>
</function>
<function model="ir.model.fields" name="formbuilder_whitelist">
<value eval="'res.partner'"/>
<value eval="[
'x_criteria_ids',
'x_subscribe',
'x_categories_ids',
'x_max_price',
'x_min_price',
'x_criteria_ids',
'x_subscribe',
'x_categories_ids',
'x_max_price',
'x_min_price',
]"/>
</function>
</odoo>
Loading