Server Framework 101 - Solusi 13
Solusi untuk tutorial https://www.odoo.com/documentation/18.0/developer/tutorials/server_framework_101/14_qwebintro.html
file estate_property.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Estate Property</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,kanban,form</field>
<field name="context">{'search_default_avaliable': True}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a property advertisement
</p>
<p>
Create real estate properties and follow the selling process.
</p>
</field>
</record>
<!--search-->
<record id="estate_property_search" model="ir.ui.view">
<field name="name">estate.property.search</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search properties">
<field name="name" string="Title"/>
<field name="postcode"/>
<field name="expected_price"/>
<field name="bedrooms"/>
<field name="living_area" string="Living Area (sqm)" filter_domain="[('living_area', '>=', self)]"/>
<field name="facades"/>
<separator/>
<filter string="Available" name="avaliable" domain="['|', ('state', '=', 'new'),
('state', '=', 'offer received')]"/>
<group expand="1" string="Group By">
<filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"/>
</group>
</search>
</field>
</record>
<!--list view-->
<record id="estate_property_view_tree" model="ir.ui.view">
<field name="name">estate.property.tree</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Properties" decoration-success="state in ('offer received', 'offer accepted')" decoration-muted="state == 'sold'" decoration-bf="state == 'offer accepted'">
<field name="name" string="Title"/>
<field name="postcode"/>
<field name="bedrooms"/>
<field name="living_area"/>
<field name="expected_price"/>
<field name="selling_price"/>
<field name="date_availability" string="Available from" optional='hide'/>
</list>
</field>
</record>
<!--form-->
<record id="estate_property_view_form" model="ir.ui.view">
<field name="name">estate.property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_sold" type="object" string="Sold" invisible="state=='sold'"/>
<button name="action_cancel" type="object" string="Cancel" invisible="state=='sold'"/>
<field name="state" widget="statusbar" statusbar_visible="new,over accepted,offer received,sold"/>
</header>
<sheet>
<h1><field name="name" placeholder="Property Title"/></h1>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<group>
<group>
<field name="property_type_id" options="{'no_create': True, 'no_edit': True}"/>
<field name="postcode"/>
<field name="date_availability" string="Available From"/>
</group>
<group>
<field name="expected_price"/>
<field name="best_price"/>
<field name="selling_price"/>
</group>
</group>
<notebook>
<page string="Description">
<group>
<field name="description"/>
<field name="bedrooms"/>
<field name="living_area" string="Living Area (sqm)"/>
<field name="facades"/>
<field name="garage"/>
<field name="garden"/>
<field name="garden_area" string="Garden Area (sqm)" invisible="not garden"/>
<field name="garden_orientation" invisible="not garden"/>
<field name="total_area"/>
</group>
</page>
<page string="Offers">
<field name="offer_ids" readonly="state in ('offer accepted', 'sold', 'canceled')" />
</page>
<page string="Other Info">
<group>
<field name="user_id"/>
<field name="buyer_id"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="estate_property_view_kanban" model="ir.ui.view">
<field name="name">estate.property.kanban</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<kanban default_group_by="property_type_id" records_draggable="0">
<field name="state"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div>
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
</div>
<div>
Expected Price: <field name="expected_price"/>
</div>
<div t-if="record.state.raw_value == 'offer_received'">
Best Offer: <field name="best_price"/>
</div>
<div t-if="record.selling_price.raw_value">
Selling Price: <field name="selling_price"/>
</div>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
</div>
</t>
</templates>
</kanban>
</field>
</record>
</odoo>
Comments
Post a Comment