-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] estate_account: Chapter 14-link module estate and accounting
Override the sold action of the estate module to create an invoice when a property is sold. The invoice is a 6% down payement with a 100€ admin fees.
- Loading branch information
1 parent
d83235a
commit 22f74cc
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
{ | ||
'name': "estate_account", | ||
'version': '1.0', | ||
'depends': ['estate', 'account'], | ||
'author': "Clément Cardot (cacl)", | ||
'license': "LGPL-3", | ||
'description': """ | ||
A link module to create invoices from property sales | ||
""", | ||
|
||
'data': [ | ||
|
||
], | ||
|
||
'application': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from . import estate_property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import models, Command | ||
|
||
class EstateProperty(models.Model): | ||
_inherit = "estate.property" | ||
|
||
def action_sold(self): | ||
values = { | ||
'move_type': 'out_invoice', | ||
'partner_id': self.buyer_id.id, | ||
#'journal_id': self.env['account.journal'].search([('type', '=', 'sale')], limit=1).id | ||
'invoice_line_ids': [ | ||
Command.create({ | ||
'name': self.name + ' - 6% down payment', | ||
'quantity': 1, | ||
'price_unit': self.selling_price * 0.06, | ||
}), | ||
Command.create({ | ||
'name': 'administrative fees', | ||
'quantity': 1, | ||
'price_unit': 100.00, | ||
}), | ||
] | ||
} | ||
self.env['account.move'].create(values) | ||
return super().action_sold() |