Skip to content

Commit 4819e06

Browse files
[ADD] This is the new commit for vijan onboarding form the Server 101 training
This is a new commit and should include the Chapter 2-9 with parts of chapter 10 that are still work in progress.
1 parent ce34b4f commit 4819e06

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

estate/models/estate_property.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
class EstateProperty(models.Model):
66
_name = "estate.property"
77
_description = "Property"
8+
_positif_expected_price = models.Constraint("CHECK (expected_price > 0)","A price can't be negatif");
9+
_positif_selling_price = models.Constraint("CHECK (selling_price > 0)","A price can't be negatif");
10+
_postif_best_price = models.Constraint("CHECK (best_price > 0)", "A price can't be negatif");
11+
812
state = fields.Selection(selection = [("New","New"), ("Offer_Received","Offer Received") ,("Offer_Accepted","Offer Accepted"), ("Sold","Sold"), ("Cancelled","Cancelled")])
913
active = fields.Boolean('Active',default=True)
1014
name = fields.Char(required=True,default="Unkown")

estate/models/estate_property_offer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class EstatePropertyOffer(models.Model):
77
_name = "estate.property.offer"
88
_description = "Property Offer"
9+
_postif_price = models.Constraint("CHECK (best_price > 0)", "A price can't be negatif");
910
price = fields.Float(string="Price")
1011
status = fields.Selection(copy=False,selection = [("Accepted","Accepted"),("Refused","Refused")])
1112
partner_id = fields.Many2one('res.partner',required=True)

0 commit comments

Comments
 (0)