Skip to content

Commit 73518fa

Browse files
committed
[ADD] estate_account: Add link between estate and account
1 parent 2a00cff commit 73518fa

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
'name': "estate_account",
3+
'version': '0.1',
4+
'depends': ['estate', 'account'],
5+
'author': "baje",
6+
'category': 'Uncategorized',
7+
'description': """
8+
Link between estate and accounting apps
9+
""",
10+
'auto_install': True,
11+
'license': 'LGPL-3',
12+
}

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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from odoo import models
2+
3+
4+
class EstateProperty(models.Model):
5+
6+
_inherit = "estate.property"
7+
8+
def action_sold(self):
9+
res = super().action_sold()
10+
journal = self.env["account.journal"].search([("type", "=", "sale")], limit=1)
11+
for prop in self:
12+
self.env["account.move"].create(
13+
{
14+
"partner_id": prop.buyer_id.id,
15+
"move_type": "out_invoice",
16+
"journal_id": journal.id,
17+
"invoice_line_ids": [
18+
(
19+
0,
20+
0,
21+
{
22+
"name": prop.name,
23+
"quantity": 1.0,
24+
"price_unit": prop.selling_price * 6.0 / 100.0,
25+
},
26+
),
27+
(
28+
0,
29+
0,
30+
{
31+
"name": "Administrative fees",
32+
"quantity": 1.0,
33+
"price_unit": 100.0,
34+
},
35+
),
36+
],
37+
}
38+
)
39+
return res

0 commit comments

Comments
 (0)