Skip to content

Commit 92b51a5

Browse files
committed
[ADD] estate_account: create initial module structure with estate property integration and invoice creation
1 parent f7d447d commit 92b51a5

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
'name': "Estate Account",
3+
'description': """
4+
Link the Estate app with the account
5+
""",
6+
'version': '1.0',
7+
'author': "Odoo S.A.",
8+
'license': "LGPL-3",
9+
'depends': ['estate', 'account'],
10+
}

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, Command
2+
3+
4+
class EstateProperty(models.Model):
5+
_inherit = 'estate.property'
6+
7+
def action_set_property_as_sold(self):
8+
journal = self.env['account.journal'].search([('type', '=', 'sale')], limit=1)
9+
self.env['account.move'].create(
10+
{
11+
'partner_id': self.buyer_id.id,
12+
'move_type': 'out_invoice',
13+
'journal_id': journal.id,
14+
'line_ids': [
15+
Command.create(
16+
{
17+
'name': self.name,
18+
'quantity': 1,
19+
'price_unit': 0.06 * self.selling_price,
20+
}
21+
),
22+
Command.create(
23+
{
24+
'name': 'Administrative fees',
25+
'quantity': 1,
26+
'price_unit': 100,
27+
}
28+
),
29+
],
30+
}
31+
)
32+
return super().action_set_property_as_sold()

0 commit comments

Comments
 (0)