Skip to content

Commit

Permalink
[ADD] estate_account: implement new estate_account module
Browse files Browse the repository at this point in the history
-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
pkgu-odoo committed Aug 14, 2024
1 parent 1392e98 commit ce6ceb0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions estate_account/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
10 changes: 10 additions & 0 deletions estate_account/__manifest__.py
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'
}
1 change: 1 addition & 0 deletions estate_account/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import estate_property
29 changes: 29 additions & 0 deletions estate_account/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from odoo import models


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,
}),
],
}
self.env['account.move'].create(move_values)
# print(f"Created account.move with ID: {account_move.id} and invoice lines")
return super().action_set_sold()

0 comments on commit ce6ceb0

Please sign in to comment.