Skip to content
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

My First Odoo Application #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

My First Odoo Application #70

wants to merge 2 commits into from

Conversation

ncarpio
Copy link

@ncarpio ncarpio commented Oct 1, 2024

No description provided.

 Please enter the commit message for your changes. Lines starting
 Changes to be committed:
@ncarpio
Copy link
Author

ncarpio commented Oct 1, 2024

@jnc-odoo

Copy link

@jnc-odoo jnc-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job !
I see there is the last part missing about the inheritance which is my sense the real advantage of Odoo.
So you do the last part, don't hesitate to ping me, I'll be happy to look at it :)

Comment on lines +73 to +77
for property in self:
if property.state == "cancelled":
raise UserError(_("Cancelled properties cannot be sold!"))
property.state = "sold"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the solution of the slides. I suggest that you check the filtered function from Odoo to see how you could change this code with it :D

Comment on lines +90 to +93
def _unlink_if_new_or_canceled(self):
for property in self:
if property.state not in ("new", "canceled"):
raise UserError(_("Only new or canceled property can be deleted!"))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same here, you can check the filtered function :)

Comment on lines +96 to +98
def create(self, vals_list):
for vals in vals_list:
property = self.env["estate.property"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not finished function ?

@@ -0,0 +1,41 @@
from odoo import api, fields, models

class Offer(models.Model):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we uses the same name as the name of the model so here EstatePropertyOffer but it is more of a preference


@api.depends("validity", "create_date")
def _compute_deadline(self):
for estate in self:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would more appropriate to call your record with the model name

Suggested change
for estate in self:
for offer in self:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants