File tree Expand file tree Collapse file tree 5 files changed +55
-2
lines changed
Expand file tree Collapse file tree 5 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -89,15 +89,15 @@ def _onchange_garden(self):
8989 def action_sold_property (self ):
9090 for record in self :
9191 if record .state == "cancelled" :
92- raise exceptions . UserError ("Cancelled Property cannot be Sold" )
92+ raise UserError ("Cancelled Property cannot be Sold" )
9393 else :
9494 record .state = "sold"
9595 return True
9696
9797 def action_cancel_offer (self ):
9898 for record in self :
9999 if record .state == "sold" :
100- raise exceptions . UserError ("Sold Property cannot be Cancelled" )
100+ raise UserError ("Sold Property cannot be Cancelled" )
101101 else :
102102 record .state = "cancelled"
103103 return True
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ from . import models
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ {
3+ "name" : "Estate Account" ,
4+ "description" : """
5+ Estate account module to manage Estate Customers and Salesman.
6+ """ ,
7+ "version" : "1.0" ,
8+ "depends" : ["estate" , "account" ],
9+ "author" : "danal" ,
10+ "category" : "Category" ,
11+ "license" : "LGPL-3" ,
12+ "data" : [],
13+ }
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ from . import estate_property
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ from odoo .exceptions import UserError
3+
4+ from odoo import fields , models , Command
5+
6+
7+ class EstatePropertyInherit (models .Model ):
8+ _inherit = "estate.property"
9+
10+ def action_sold_property (self ):
11+ for record in self :
12+ if record .selling_price == 0 :
13+ raise UserError ("Cannot sell Property without any accepted offer" )
14+ self .env ["account.move" ].create (
15+ {
16+ "partner_id" : self .customer .id ,
17+ "move_type" : "out_invoice" ,
18+ "invoice_line_ids" : [
19+ Command .create (
20+ {
21+ "name" : "6% of the selling price" ,
22+ "quantity" : 1 ,
23+ "price_unit" : record .selling_price * 0.06 ,
24+ }
25+ ),
26+ Command .create (
27+ {
28+ "name" : "an additional 100.00 from administrative fees" ,
29+ "quantity" : 1 ,
30+ "price_unit" : 100 ,
31+ }
32+ ),
33+ ],
34+ }
35+ )
36+ return super ().action_sold_property ()
You can’t perform that action at this time.
0 commit comments