-
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: models method, inherited the res.users, add estate_acco…
…unt module - Add ondelete decorator in models and override the models method - Created the res_user_model and inherit the res.users - Add new module estate_account - Create the invoice on action of property sold from estate_account to invoice
- Loading branch information
Showing
16 changed files
with
129 additions
and
54 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,10 +1,10 @@ | ||
from odoo import models, fields | ||
from odoo import fields, models | ||
|
||
|
||
class EstatePropertyTag(models.Model): | ||
_name = 'estate.property.tag' | ||
_description = 'Estate Property tag' | ||
name = fields.Char(required=True) | ||
_sql_constraints = [('name_uniq', 'unique (name)', "Tag name already exists!")] | ||
_order = 'name' | ||
color = fields.Integer() | ||
_order = 'name' | ||
_sql_constraints = [('name_uniq', 'unique (name)', "Tag name already exists!")] |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from odoo import models, fields | ||
|
||
|
||
class ResUserModel(models.Model): | ||
_inherit = 'res.users' | ||
property_ids = fields.One2many('estate.property', 'salesman_id', string='Properties', domain="['|', ('state', '=', 'new'),('state', '=', 'offer_recived')]") |
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,14 +1,11 @@ | ||
<odoo> | ||
<menuitem id="estate_property_root" name="Real Estate"> | ||
|
||
<menuitem id="estate_property_first_level_menu" name="Advertisment"> | ||
<menuitem id="estate_property_model_menu_action" action="estate_property_action"/> | ||
</menuitem> | ||
|
||
<menuitem id="estate_property_type_level_menu" name="Setting"> | ||
<menuitem id="estate_property_type_menu_action" action="estate_property_type_action"/> | ||
<menuitem id="estate_property_tag_menu_action" action="estate_property_tag_action"/> | ||
</menuitem> | ||
|
||
</menuitem> | ||
</odoo> |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data> | ||
<record id="res_users_view_form" model="ir.ui.view"> | ||
<field name="name">res.users.form.inherit.properties</field> | ||
<field name="model">res.users</field> | ||
<field name="inherit_id" ref="base.view_users_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook" position="inside"> | ||
<page string="Properties"> | ||
<field name="property_ids"> | ||
<tree string="Real Estate Properties"> | ||
<field name="name" /> | ||
<field name="postcode"/> | ||
<field name="property_type_id" /> | ||
<field name="state"/> | ||
<field name="tag_ids" widget="many2many_tags" /> | ||
<field name="bedrooms" /> | ||
<field name="living_area" /> | ||
<field name="selling_price" /> | ||
<field name="expected_price" /> | ||
</tree> | ||
</field> | ||
</page> | ||
</xpath> | ||
</field> | ||
</record> | ||
</data> | ||
</odoo> | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
'name': "estate_account", | ||
'version': '0.1', | ||
'depends': ['base', 'account', 'estate'], | ||
'description': "Technical practice", | ||
'installable': True, | ||
'application': True, | ||
'license': 'LGPL-3', | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import estate_property |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from odoo import models, Command | ||
import logging | ||
from datetime import date | ||
|
||
|
||
class EstateProperty(models.Model): | ||
_inherit = "estate.property" | ||
|
||
def status_action_sold_button(self): | ||
logging.info("Request to create the invoices of property") | ||
for record in self: | ||
if record.buyer_id: | ||
partner_id = record.buyer_id.id | ||
self.env["account.move"].create( | ||
{ | ||
"partner_id": partner_id, | ||
"move_type": "out_invoice", | ||
"invoice_date": date.today(), | ||
"narration": "Tutorials traning", | ||
"amount_total": record.selling_price, | ||
"invoice_line_ids": [ | ||
Command.create( | ||
{ | ||
"name": record.name, | ||
"quantity": 1, | ||
"price_unit": record.selling_price * 0.06, | ||
"invoice_date": date.today(), | ||
} | ||
), | ||
Command.create( | ||
{ | ||
"name": "Administrative Fee", | ||
"quantity": 1, | ||
"price_unit": 100, | ||
"invoice_date": date.today(), | ||
}, | ||
), | ||
], | ||
} | ||
) | ||
return super().status_action_sold_button() |