-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Master technical onboarding faavc #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Master technical onboarding faavc #1071
Conversation
Creating the manifest file.
New ir.model.access file to adding all kind of accesses to the base.group_user and connecting csv file to manifest [LINT] estate: fixing linter issues [LINT] estate: adding new lines to the end of the few file
[LINT] estate: linting all python files with ruff
…hapter 6 add: state field to the estate_property model security: readonly and all-rights security groups are created views: list, form, search views are created, in search view state filter and postcode groupby features are added manifest is updated with the security file
new models: estate_property_offer, estate_property_tag estate_property: adding new fields (type, salesperson, buyer, tags, offers) estate_property_view: adding offers to form view, tags to both list and form views estate_property_offer_view: adding list and form views menu: settings menu for types and tags
computed fields: deadline of the offer, best price from many offers onchange: garden affects garden_area and garden_orientation
…ffers - Chapter 9 estate_property: adding cancel and sold buttons and actions for those buttons estate_property_offer: adding accept and refuse buttons and actions for those buttons learned: actions, exception example, icons in buttons
0b0c858 to
79ff504
Compare
SQL constraints: expected_price, selling_price, offer price, property tag and type Python constraints: selling price >= 0.9 of the expected price
amah-odoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge work so far 🎉
just small comment for now
estate/models/estate_property.py
Outdated
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection(string="Orientation", selection=[("North", "North"), ("South", "South"), ("East", "East"), ("West", "West")]) | ||
|
No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not forget the new line at the end of file
estate/models/estate_property.py
Outdated
| garage = fields.Boolean() | ||
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection(string="Orientation", selection=[("North", "North"), ("South", "South"), ("East", "East"), ("West", "West")]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to right the selection options that way to make it more clearer Also the tuple first value represent the technical name so it should be in snake_case 🐍
| garden_orientation = fields.Selection(string="Orientation", selection=[("North", "North"), ("South", "South"), ("East", "East"), ("West", "West")]) | |
| garden_orientation = fields.Selection([ | |
| ("north", "North"), | |
| ("south", "South"), | |
| ("east", "East"), | |
| ("west", "West") | |
| ], string="Orientation") |
estate/models/estate_property.py
Outdated
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date( | ||
| copy=False, default=datetime.now() + relativedelta(months=3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the default values it is get evaluated on server boot-up So without the lambda once you run the server it will take the date and after 1 week if you created new property it will take the 3 month from the server boot-up not 3 month from real today.
| copy=False, default=datetime.now() + relativedelta(months=3) | |
| copy=False, default=lambda self: datetime.now() + relativedelta(months=3) |
estate/models/estate_property.py
Outdated
| buyer_id = fields.Many2one("res.partner", string="Buyer", copy=False) | ||
| tag_ids = fields.Many2many("estate_property_tag") | ||
| offer_ids = fields.One2many("estate_property_offer", "property_id", string="Offers") | ||
| total_area = fields.Integer("Total Area (sqm)", compute="_compute_area") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for compute method we tend to use the full field name if it is the only field computed in the method
| total_area = fields.Integer("Total Area (sqm)", compute="_compute_area") | |
| total_area = fields.Integer("Total Area (sqm)", compute="_compute_total_area") |
estate/models/estate_property.py
Outdated
| record.best_price = ( | ||
| 0 | ||
| if len(record.offer_ids) == 0 | ||
| else max(offer.price for offer in record.offer_ids) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the .mapped('field') return a list with the all the field values for the recordset and the or [0] will replace the list of prices with list contain 0 if the list is empty list
| record.best_price = ( | |
| 0 | |
| if len(record.offer_ids) == 0 | |
| else max(offer.price for offer in record.offer_ids) | |
| ) | |
| record.best_price = max(record.offer_ids.mapped('price') or [0]) |
ref: maximizing method and name of the computation method

No description provided.