Skip to content

Commit 77e21d7

Browse files
committed
[ADD] estate_account: module to create invoice from properties when sold
1 parent 4bddac7 commit 77e21d7

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
'name': "Estate account",
3+
'depends': [
4+
'estate',
5+
'account',
6+
],
7+
}

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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from odoo import models, api, Command
2+
3+
4+
class InheritedProperty(models.Model):
5+
_inherit = "estate_property"
6+
7+
def action_sold(self):
8+
res = super().action_sold()
9+
self.env['account.move'].create({
10+
"move_type": 'out_invoice',
11+
"partner_id": self.buyer.id,
12+
"line_ids": [
13+
Command.create({
14+
"name": "6% Fee",
15+
"quantity": 1,
16+
"price_unit": 0.06 * self.selling_price,
17+
}),
18+
Command.create({
19+
"name": "Administrative Fee",
20+
"quantity": 1,
21+
"price_unit": 100,
22+
}),
23+
]
24+
})
25+
return res

0 commit comments

Comments
 (0)