-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: implement new estate_account module
-Initialize the estate_account module with dependencies on estate and account. -Inherit the estate.property model and override the action_sold method. -create an account.move with partner_id from the property and move_type. -Add two invoice line 6% of selling price and additional 100 administrative fees
- Loading branch information
Showing
4 changed files
with
41 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,10 @@ | ||
{ | ||
'name': 'Estate Account', | ||
'version': '1.0', | ||
'depends': ['estate', 'account'], | ||
'data': [], | ||
'installable': True, | ||
'application': True, | ||
'auto_install': False, | ||
'license': 'LGPL-3' | ||
} |
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 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,29 @@ | ||
from odoo import models, api | ||
|
||
|
||
class EstateProperty(models.Model): | ||
_inherit = 'estate.property' | ||
|
||
def action_set_sold(self): | ||
# print("Overridden action_set_sold method in estate_account") | ||
move_values = { | ||
'partner_id': self.buyer_id.id, | ||
'move_type': 'out_invoice', | ||
'invoice_line_ids': [ | ||
# 6% of the selling price | ||
(0, 0, { | ||
'name': 'Commission (6% of selling price)', | ||
'quantity': 1, | ||
'price_unit': self.selling_price * 0.06, | ||
}), | ||
# Administrative fees of 100.00 | ||
(0, 0, { | ||
'name': 'Administrative Fees', | ||
'quantity': 1, | ||
'price_unit': 100.00, | ||
}), | ||
], | ||
} | ||
account_move = self.env['account.move'].create(move_values) | ||
# print(f"Created account.move with ID: {account_move.id} and invoice lines") | ||
return super(EstateProperty, self).action_set_sold() |