-
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: override action_sold to create invoices
- Created estate_account module to link estate and account modules. - In estate_property.py, inherited estate.property model. - Overrode action_sold method to return the super call.
- Loading branch information
Showing
6 changed files
with
93 additions
and
27 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
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
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,13 @@ | ||
{ | ||
'name': 'Estate Account Integration', | ||
'version': '1.0', | ||
'summary': 'Integration between Estate and Accounting modules', | ||
'description': 'This module creates invoices for sold properties.', | ||
'category': 'Accounting', | ||
'author': 'yasp', | ||
'depends': ['estate', 'account'], | ||
'license': 'LGPL-3', | ||
'data': [], | ||
'installable': True, | ||
'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 @@ | ||
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 @@ | ||
from odoo import models, api, Command | ||
|
||
class EstateProperty(models.Model): | ||
_inherit = 'estate.property' | ||
|
||
@api.model | ||
def action_sold(self): | ||
# Create an invoice with two lines | ||
self.env['account.move'].create({ | ||
'partner_id': self.buyer_id.id, # Assuming 'buyer_id' is the field holding the customer | ||
'move_type': 'out_invoice', # 'Customer Invoice' | ||
'invoice_line_ids': [ | ||
Command.create({ | ||
'name': 'Property Sale Commission', | ||
'quantity': 1, | ||
'price_unit': self.selling_price * 0.06, # 6% of the selling price | ||
}), | ||
Command.create({ | ||
'name': 'Administrative Fees', | ||
'quantity': 1, | ||
'price_unit': 100.00, # Fixed administrative fee | ||
}) | ||
], | ||
}) | ||
|
||
# Call the original action_sold method | ||
return super().action_sold() |