File tree 6 files changed +48
-6
lines changed
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):
103
103
for single_property in self :
104
104
if single_property .state == "sold" :
105
105
raise UserError ("Sold properties cannot be cancelled!" )
106
- return False
107
106
single_property .state = "cancelled"
108
107
return True
109
108
110
109
def action_property_sold (self ):
111
110
for single_property in self :
112
111
if single_property .state == "cancelled" :
113
112
raise UserError ("Cancelled properties cannot be sold!" )
114
- return False
115
113
single_property .state = "sold"
116
114
return True
117
115
@@ -127,6 +125,7 @@ def check_selling_price_in_range(self):
127
125
raise ValidationError (
128
126
"Selling price cannot be lower than 90%% of Expected price"
129
127
)
128
+ return True
130
129
131
130
@api .ondelete (at_uninstall = False )
132
131
def _unlink_check_property_state (self ):
@@ -135,3 +134,4 @@ def _unlink_check_property_state(self):
135
134
raise UserError (
136
135
"Property cannot be deleted unless it is new or cancelled"
137
136
)
137
+ return True
Original file line number Diff line number Diff line change @@ -81,8 +81,9 @@ def action_offer_refuse(self):
81
81
82
82
@api .model_create_multi
83
83
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"
88
89
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