Skip to content

Commit 46a0f1f

Browse files
[IMP] estate: Server101 Finished Chapter 13
1 parent 2666a3c commit 46a0f1f

File tree

5 files changed

+54
-2
lines changed

5 files changed

+54
-2
lines changed

estate/views/estate_property_type_views.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@
1313
<field name="arch" type="xml">
1414
<form string="Property type Form">
1515
<sheet>
16-
<div class="oe_stat_button">
17-
<button name="%(estate.estate_property_offer_model_action)d" string="Offers" type="action"/>
16+
<div class="oe_button_box">
17+
<button name="%(estate.estate_property_offer_model_action)d" string="Offers" class="oe_stat_button" type="action" icon="fa-bars">
18+
<div class="o_stat_info">
19+
<span class="o_stat_value">
20+
<field name="offer_count"/>
21+
</span>
22+
<span class="o_stat_text">
23+
Offers
24+
</span>
25+
</div>
26+
</button>
1827
</div>
1928
<group>
2029
<h1 class="mb32">

estate_account/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

estate_account/__manifest__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
'name': "estate_account",
3+
'description': "link the estate module to the invoiceing module",
4+
'depends': [
5+
'base_setup', 'estate', 'account'
6+
],
7+
'category': "Tutorials",
8+
'installable': True,
9+
'application': False,
10+
'data': [],
11+
'author': 'Odoo S.A.',
12+
'license': 'LGPL-3'
13+
14+
}

estate_account/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import estate_property
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from odoo import models, Command
2+
3+
4+
class EstateProperty(models.Model):
5+
_inherit = "estate.property"
6+
7+
def sell_property(self):
8+
for record in self:
9+
invoice_val = {
10+
'state': 'draft',
11+
'move_type': 'out_invoice',
12+
'partner_id': int(record.buyer_id),
13+
'line_ids': [
14+
Command.create({
15+
"name": "First Payment",
16+
"quantity": 1,
17+
"price_unit": record.selling_price * 0.06
18+
}),
19+
Command.create({
20+
"name": "Administrative Fees",
21+
"quantity": 1,
22+
"price_unit": 100.00
23+
})
24+
]
25+
}
26+
self.env['account.move'].sudo().with_context(default_move_type='out_invoice').create(invoice_val)
27+
return super().sell_property()

0 commit comments

Comments
 (0)