File tree Expand file tree Collapse file tree 6 files changed +58
-3
lines changed Expand file tree Collapse file tree 6 files changed +58
-3
lines changed Original file line number Diff line number Diff line change 33 'version' : '1.0' ,
44 'depends' : ['base' ],
55 'author' : "taskv" ,
6- 'category' : 'Category ' ,
6+ 'category' : 'Tutorials ' ,
77 'description' : """
88 Tutorial Project
99 """ ,
Original file line number Diff line number Diff line change @@ -94,13 +94,13 @@ def property_sold(self):
9494 if record .state != 'cancelled' :
9595 record .state = 'sold'
9696 else :
97- raise exceptions .UserError ("Sold properties cannot be cancelled ." )
97+ raise exceptions .UserError ("Cancelled properties cannot be sold ." )
9898 return True
9999
100100 def property_cancelled (self ):
101101 for record in self :
102102 if record .state != 'sold' :
103103 record .state = 'cancelled'
104104 else :
105- raise exceptions .UserError ("Cancelled properties cannot be sold ." )
105+ raise exceptions .UserError ("Sold properties cannot be cancelled ." )
106106 return True
Original file line number Diff line number Diff line change 1+ # Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+ from . import models
Original file line number Diff line number Diff line change 1+
2+ {
3+ 'name' : "Real Estate Invoicing" ,
4+ 'version' : '1.0' ,
5+ 'depends' : ['estate' , 'account' ],
6+ 'author' : "taskv" ,
7+ 'category' : 'Tutorials' ,
8+ 'description' : """
9+ Tutorial Project
10+ """ ,
11+ 'data' : [
12+ ],
13+ 'demo' : [
14+ ],
15+ 'installable' : True ,
16+ 'application' : True ,
17+ 'license' : 'LGPL-3' ,
18+ }
Original file line number Diff line number Diff line change 1+ # Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+ from . import estate_property
Original file line number Diff line number Diff line change 1+ # Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+ from odoo import models , Command
4+
5+
6+ class EstateProperty (models .Model ):
7+ _inherit = 'estate.property'
8+
9+ def property_sold (self ):
10+ invoice_vals_list = []
11+ for record in self :
12+ if record .state == 'offer_accepted' and record .buyer_id :
13+ invoice_vals = {
14+ 'move_type' : 'out_invoice' ,
15+ 'partner_id' : record .buyer_id .id ,
16+ 'invoice_line_ids' : [
17+ Command .create ({
18+ "name" : "Commission 6%" ,
19+ "quantity" : 1 ,
20+ "price_unit" : record .selling_price * 0.06 ,
21+ }),
22+ Command .create ({
23+ "name" : "Administrative fees" ,
24+ "quantity" : 1 ,
25+ "price_unit" : 100. ,
26+ }),
27+ ],
28+ }
29+ invoice_vals_list .append (invoice_vals )
30+ self .env ['account.move' ].sudo ().create (invoice_vals_list )
31+ return super ().property_sold ()
You can’t perform that action at this time.
0 commit comments