Skip to content

Commit d1ad400

Browse files
committed
[IMP] estate: Chapter 13 - Other modules
- Create module to generate invoices in Invoicing
1 parent a9e718c commit d1ad400

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Estate Account",
3+
"version": "19.0.1.0.0",
4+
"summary": "Manage properties invoices",
5+
"description": "Manage properties invoices",
6+
"author": "wimar-odoo",
7+
"license": "OEEL-1",
8+
"depends": [
9+
"estate",
10+
"account",
11+
],
12+
"application": True,
13+
"data": [
14+
15+
],
16+
}

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_property_sold(self):
8+
values = {
9+
"partner_id": self.salesperson_id.id,
10+
"move_type": "out_invoice",
11+
"journal_id": self.env["account.journal"].search([('type', '=', 'sale')], limit=1).id,
12+
"invoice_line_ids": [
13+
Command.create({
14+
"name": self.name,
15+
"quantity": 1,
16+
"price_unit": self.selling_price,
17+
}),
18+
Command.create({
19+
"name": "6% commission",
20+
"quantity": 1,
21+
"price_unit": self.selling_price * 0.06,
22+
}),
23+
Command.create({
24+
"name": "Administrative fees",
25+
"quantity": 1,
26+
"price_unit": 100.00,
27+
})
28+
],
29+
}
30+
31+
self.env["account.move"].create(values)
32+
return super().action_property_sold()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
access_estate_property_user,access_estate_property_user,model_estate_property,base.group_user,1,1,1,1

0 commit comments

Comments
 (0)