Skip to content

Commit 07813a2

Browse files
committed
[IMP] estate : integrate account module to automate invoice creation
1 parent 99621c5 commit 07813a2

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-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': "Real Estate Account",
3+
'summary': "Testing the real estate with the account module",
4+
'description': "Testing the description real estate account module",
5+
'depends': ['base', 'estate', 'account'],
6+
'data': [],
7+
'application': True,
8+
'author': "Odoo",
9+
'license': 'LGPL-3',
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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from odoo import Command, models
2+
3+
4+
class EstateProperty(models.Model):
5+
_inherit = 'estate.property'
6+
7+
def action_mark_as_sold(self):
8+
invoice_vals = {
9+
'partner_id': self.salesperson_id.id,
10+
'move_type': 'out_receipt',
11+
'invoice_line_ids': [
12+
Command.create(
13+
{'name': 'Administrative Fees', 'quantity': 1, 'price_unit': 100.0}
14+
),
15+
Command.create(
16+
{'name': 'Down Payment', 'quantity': 1, 'price_unit': 0.06 * self.selling_price}
17+
),
18+
],
19+
}
20+
self.env['account.move'].create(invoice_vals)
21+
return super().action_mark_as_sold()

0 commit comments

Comments
 (0)