File tree Expand file tree Collapse file tree 6 files changed +48
-6
lines changed Expand file tree Collapse file tree 6 files changed +48
-6
lines changed Original file line number Diff line number Diff line change @@ -103,15 +103,13 @@ def action_property_cancel(self):
103103 for single_property in self :
104104 if single_property .state == "sold" :
105105 raise UserError ("Sold properties cannot be cancelled!" )
106- return False
107106 single_property .state = "cancelled"
108107 return True
109108
110109 def action_property_sold (self ):
111110 for single_property in self :
112111 if single_property .state == "cancelled" :
113112 raise UserError ("Cancelled properties cannot be sold!" )
114- return False
115113 single_property .state = "sold"
116114 return True
117115
@@ -127,6 +125,7 @@ def check_selling_price_in_range(self):
127125 raise ValidationError (
128126 "Selling price cannot be lower than 90%% of Expected price"
129127 )
128+ return True
130129
131130 @api .ondelete (at_uninstall = False )
132131 def _unlink_check_property_state (self ):
@@ -135,3 +134,4 @@ def _unlink_check_property_state(self):
135134 raise UserError (
136135 "Property cannot be deleted unless it is new or cancelled"
137136 )
137+ return True
Original file line number Diff line number Diff line change @@ -81,8 +81,9 @@ def action_offer_refuse(self):
8181
8282 @api .model_create_multi
8383 def create (self , vals ):
84- single_property = self .env ["estate.property" ].browse (vals ["property_id" ])
85- if vals ["price" ] < single_property .best_price :
86- raise UserError ("An offer cannot be lower than an existing offer" )
87- single_property .state = "offer-received"
84+ for val in vals :
85+ single_property = self .env ["estate.property" ].browse (val ["property_id" ])
86+ if val ["price" ] < single_property .best_price :
87+ raise UserError ("An offer cannot be lower than an existing offer" )
88+ single_property .state = "offer-received"
8889 return super ().create (vals )
Original file line number Diff line number Diff line change 1+ from . import models
Original file line number Diff line number Diff line change 1+ {
2+ "name" : "Real Estate Account" ,
3+ "license" : "LGPL-3" ,
4+ "application" : True ,
5+ "depends" : ["estate" , "account" ],
6+ }
Original file line number Diff line number Diff line change 1+ from . import estate_property
Original file line number Diff line number Diff line change 1+ from odoo import models , Command
2+
3+
4+ class EstateProperty (models .Model ):
5+ _inherit = "estate.property"
6+
7+ def action_property_sold (self ):
8+ result_super = super ().action_property_sold ()
9+
10+ for single_property in self :
11+ self .env ["account.move" ].create (
12+ {
13+ "partner_id" : single_property .buyer_id .id ,
14+ "move_type" : "out_invoice" ,
15+ "invoice_line_ids" : [
16+ Command .create (
17+ {
18+ "name" : "6%% of the selling price" ,
19+ "quantity" : 1 ,
20+ "price_unit" : 0.06 * single_property .selling_price ,
21+ }
22+ ),
23+ Command .create (
24+ {
25+ "name" : "Administrative fees" ,
26+ "quantity" : 1 ,
27+ "price_unit" : 100.0 ,
28+ }
29+ ),
30+ ],
31+ }
32+ )
33+ return result_super
You can’t perform that action at this time.
0 commit comments