chean - Technical Onboarding#1341
Open
anchevalier wants to merge 1 commit into
Open
Conversation
924da73 to
fcca45b
Compare
ziriraha
requested changes
Jun 16, 2026
ziriraha
reviewed
Jun 19, 2026
ziriraha
left a comment
There was a problem hiding this comment.
Good work, can you please squash all the commits into a single one?
ziriraha
reviewed
Jun 19, 2026
ziriraha
reviewed
Jun 22, 2026
Comment on lines
+7
to
+31
| def action_sold(self): | ||
| for record in self: | ||
| self.env["account.move"].create( | ||
| { | ||
| "partner_id": record.buyer_id.id, | ||
| "move_type": "out_invoice", | ||
| "invoice_line_ids": [ | ||
| Command.create( | ||
| { | ||
| "name": f"Commission for {record.name}", | ||
| "quantity": 1.0, | ||
| "price_unit": record.selling_price * 0.06, | ||
| } | ||
| ), | ||
| Command.create( | ||
| { | ||
| "name": "Administrative Fees", | ||
| "quantity": 1.0, | ||
| "price_unit": 100.00, | ||
| } | ||
| ), | ||
| ], | ||
| } | ||
| ) | ||
| return super().action_sold() |
There was a problem hiding this comment.
In action_sold you have some check that raise errors. In this case, you are creating the account.move and then you are performing the checks. you should place the super() call above the creation of the account move, as there might a case where you create a move and then the sell errors out for some reason.
We usually do:
def func():
action = super().func()
....
return actionDont take this as a rule of thumb, there are cases where we do want to run our logic before the super() (for example to add an extra check to raise an error)
| _inherit = "estate.property" | ||
|
|
||
| def action_sold(self): | ||
| for record in self: |
There was a problem hiding this comment.
super().action_sold is ensure_one, then this one must be ensure_one too
[ADD] tutorials: complete chapters 1 to 5 [ADD] tutorials: complete chapter 6 [CLN] estate: ignore Python cache files Python cache files are environment-specific generated artifacts. Remove tracked pycache files and add the corresponding .gitignore rules. [ADD] estate: complete chapter 7 [ADD] estate: complete chapter 8 [ADD] estate: complete chapter 9 [ADD] estate: complete chapter 10 [ADD] estate: complete chapter 11 [IMP] estate: improve action methods readability Add ensure_one() to actions intended to run on a single record and use more explicit variable names to improve code readability. [ADD] estate: complete chapter 12 [ADD] estate: complete chapter 13 [IMP] estate: improve property views Add status ribbons for sold and cancelled properties and display tags in the property list view for better visibility. [ADD] estate: complete chapter 14 [REF] estate: refactor Python and XML guidelines [REF] estate: apply review suggestions and cleanup
5dd0b05 to
0cf8cf4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.