Skip to content

Commit e11a31e

Browse files
committed
[ADD] estate_account: generate invoice on property sale
Introduce a new link module `estate_account` that depends on `estate` and `account`. This ensures that invoicing is optional and only available when both modules are installed. When a property is marked as 'Sold', an invoice is automatically created in the Invoicing application for the buyer. The invoice includes two lines: - 6% commission fee of the selling price - fixed administrative fee of 100.00 This design keeps the estate module independent while allowing integration with the accounting module for agencies that require it. By isolating this feature in a link module, we respect Odoo’s modularity principles and allow users to enable or disable invoicing without impacting the base real estate workflow.
1 parent 9b593fa commit e11a31e

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Real Estate Accounting",
3+
"descrption": "",
4+
"sequence": 2,
5+
"category": "Real Estate",
6+
"depends": ["estate", "account"],
7+
"license": "LGPL-3",
8+
"installable": True,
9+
}

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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from odoo import models, fields, Command
2+
3+
4+
class EstateProperty(models.Model):
5+
_inherit = "estate.property"
6+
7+
def action_set_sold(self):
8+
self.env["account.move"].sudo().create(
9+
{
10+
"partner_id": self.buyer_id.id,
11+
"move_type": "out_invoice",
12+
"invoice_date": fields.Date.context_today(self),
13+
"invoice_line_ids": [
14+
Command.create(
15+
{
16+
"name": self.name,
17+
"quantity": 1,
18+
"price_unit": self.selling_price * 0.06,
19+
}
20+
),
21+
Command.create(
22+
{
23+
"name": "Administration fees",
24+
"quantity": 1,
25+
"price_unit": 100.00,
26+
}
27+
),
28+
],
29+
}
30+
)
31+
32+
return super().action_set_sold()

0 commit comments

Comments
 (0)