[ADD] module: add new module real estate (Onboarding)#1238
[ADD] module: add new module real estate (Onboarding)#1238
Conversation
2dd0080 to
5d0a3ce
Compare
5d0a3ce to
aeda88e
Compare
|
Hello there ! Good work already, just added a few comments. Also it seems your first commit has the wrong author set (most probably because your config was not properly set before pushing, might want to check into this as a general git exercise) |
delcourtfl
left a comment
There was a problem hiding this comment.
Hello there ! Good work already, just a few comments.
(Might also need to check runbot style CI for some additional issues)
This commit is here to introduce the testing framework of Odoo. Try running the tests using `--test-tags :TestEstateProperty`. Doc: https://www.odoo.com/documentation/18.0/developer/reference/backend/testing.html?highlight=tests#invocation The tests were made such that the first one should work but the second one should fail. Your job is to ensure both tests pass in the end. You should update the behaviour of the appropriate models. If you want, you can also add a small test of your own to get a feel for it. Chapter 15: The final word
46168e4 to
d9f9dcd
Compare
d9f9dcd to
2cbde50
Compare
6c038b6 to
014cf91
Compare
There was a problem hiding this comment.
Hello there ! Really good work, not much to say, you got the general idea for module development.
Also to end this part in a clean way you should squash your commits (using an interactive rebase) into:
- one for estate module
- one for estate_account module
(And don't forget to check the runbot style CI 👀)
|
|
||
| def action_sold(self): | ||
| for record in self: | ||
| if record.state == "sancelled": |
There was a problem hiding this comment.
Small typo there
| if record.state == "sancelled": | |
| if record.state == "cancelled": |
| @api.model | ||
| def create(self, vals_list): | ||
| return super().create(vals_list) |
| record.property_id.partner_id = record.partner_id | ||
| record.property_id.state = "offer accepted" | ||
|
|
||
| def refused_offer(self): |
There was a problem hiding this comment.
Better to explicitly keep action in the name in this case: action_refuse_offer
| for vals in val_list: | ||
| property_id = vals.get('property_id') | ||
|
|
||
| if property_id: | ||
| property_record = self.env['estate.property'].browse(property_id) |
There was a problem hiding this comment.
Avoid making search and browse calls on each iteration of the loop (this is quite important as it could cause performance issues). Batching the search and filtering inside the loop for the relevant results could be a better approach for that.
| sequence = "2" | ||
| /> | ||
| </data> | ||
| </odoo> No newline at end of file |
| for record in self: | ||
| self.env['account.move'].create({ | ||
| 'partner_id': record.user_id.id, | ||
| 'move_type': 'out_invoice', | ||
|
|
||
| 'invoice_line_ids': [ | ||
| Command.create({ | ||
| 'name': record.name, | ||
| 'quantity': 1, | ||
| 'price_unit': record.selling_price * 0.06, | ||
| }), | ||
| Command.create({ | ||
| 'name': 'Administrative Fees', | ||
| 'quantity': 1, | ||
| 'price_unit': 100.00, | ||
| }), | ||
| ], | ||
| }) |
There was a problem hiding this comment.
For performance you could also avoid creating in the loop, you can make a list of values to create and call the create on all of them at once at the end.

Create Real Estate Module for onboarding program