-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] estate: add sprinkles, colored tag/offers, add stat button
- add status bar widget, model ordering on basis of their name, id and manual ordering -Add conditional display of buttons(invisible, optional, readonly) -Add a default filter. make the ‘Available’ filter selected by default in the estate.property action. -add the stat button - Covered chapter 11
- Loading branch information
Showing
9 changed files
with
221 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
from odoo import models, fields | ||
from odoo import api, models, fields | ||
|
||
|
||
class estate_property_type(models.Model): | ||
_name = "estate_property_type" | ||
_description = "Estate Property Type" | ||
name = fields.Char(required=True) | ||
_order = "sequence, name" | ||
sequence = fields.Integer('Sequence') | ||
property_list_id = fields.One2many('estate_property', 'property_type') | ||
offer_ids = fields.One2many("estate_property_offer", "property_type_id", string="offers") | ||
offer_count = fields.Integer(string="Numbers of offer", compute='_compute_offer_count', store=True) | ||
|
||
@api.depends('offer_ids') | ||
def _compute_offer_count(self): | ||
for record in self: | ||
record.offer_count = len(record.offer_ids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,65 @@ | ||
<odoo> | ||
|
||
<record id="estate_property_type_action" model="ir.actions.act_window"> | ||
<field name="name">Property Type</field> | ||
<field name="res_model">estate_property_type</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
|
||
<record id="estate_property_type_list_action" model="ir.ui.view"> | ||
<field name="name">estate_property_type_form</field> | ||
<field name="model">estate_property_type</field> | ||
<field name="arch" type="xml"> | ||
<tree> | ||
<field name='sequence' widget='handle' /> | ||
<field name="name" /> | ||
|
||
</tree> | ||
</field> | ||
|
||
</record> | ||
|
||
<record id="estate_property_list_action" model="ir.ui.view"> | ||
<field name="name">estate_property_type_form</field> | ||
<field name="model">estate_property_type</field> | ||
<field name="arch" type="xml"> | ||
|
||
<form> | ||
|
||
<button type="action" name="%(estate_property_offer_check)d" string="offers" class="oe_stat_button" | ||
icon="fa-ticket"> | ||
|
||
<div class="o_stat_info"> | ||
<field name="offer_count" widget="statinfo" string="" /> | ||
<span class="o_stat_text"> Offer</span> | ||
</div> | ||
|
||
</button> | ||
|
||
|
||
<header> | ||
<h1> | ||
<field name="name" placeholder="e.g House"> | ||
|
||
</field> | ||
</h1> | ||
</header> | ||
<notebook> | ||
<page string="properties"> | ||
<field name="property_list_id"> | ||
<tree> | ||
<field name="name" /> | ||
<field name="expected_price" /> | ||
<field name="state" /> | ||
|
||
</tree> | ||
|
||
</field> | ||
|
||
</page> | ||
</notebook> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
Oops, something went wrong.