Skip to content

Commit 7c34470

Browse files
committed
[IMP] estate: invoice creation when property sold
1 parent 5403072 commit 7c34470

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

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

0 commit comments

Comments
 (0)