Skip to content

Maxence Tutorial#1155

Draft
TheToto42 wants to merge 2 commits intoodoo:19.0from
max6417:19.0
Draft

Maxence Tutorial#1155
TheToto42 wants to merge 2 commits intoodoo:19.0from
max6417:19.0

Conversation

@TheToto42
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Feb 10, 2026

Pull request status dashboard

Copy link
Author

@TheToto42 TheToto42 left a comment

Choose a reason for hiding this comment

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

from . import property_type
from . import estate_property_tag
from . import estate_property_offer
from . import res_users No newline at end of file
Copy link
Author

Choose a reason for hiding this comment

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

Tu peux installer flake8 sur ton VS Code pour être sûr d'avoir un retour à la ligne à la fin des fichiers

@@ -0,0 +1,5 @@
from . import estate_property
from . import property_type
Copy link
Author

Choose a reason for hiding this comment

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

En termes de nomenclature des fichiers, j'essaie tjrs de préfixer les nouveaux modèles par le nom du module pour bien les identifier

Ca aurait du donner ça du coup :

Suggested change
from . import property_type
from . import estate_property_type

"Date Availability",
copy=False,
help="Enter the date at which the property is available. By default set to 2 weeks",
default=fields.Date.today() + datetime.timedelta(weeks=12) # Equivalent to 3 months
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
default=fields.Date.today() + datetime.timedelta(weeks=12) # Equivalent to 3 months
default=lambda _: fields.Date.today() + datetime.timedelta(weeks=12) # Equivalent to 3 months

Ici, tu as mis une valeur fixe, pas une valeur calculée. Ça veut dire que cette semaine, la valeur sera bonne, mais dans 3 semaines, ce ne sera plus juste pcq tu aura la date calculée il y a 3 semaine

Btw, le help n'est pas alignée avec 3 mois, mais c'est pas grave

expected_price = fields.Float(
"Expected Price",
required=True,
help="Enter the expected price for the property. This field is required."
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
help="Enter the expected price for the property. This field is required."
help="Enter the expected price for the property."

Visuellement, il est affiché qu'un champ est obligatoire ou pas. Tu n'es pas obligé de le mettre dans le help du coup

bedrooms = fields.Integer(
"Nb Bedrooms",
default=2,
help="Enter the number of bedrooms that the property has. By default set to 2."
Copy link
Author

Choose a reason for hiding this comment

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

En général le message help, c'est une description plus longue de ce qu'est le champ. Du coup, ça donne qqchose comme ça

Suggested change
help="Enter the number of bedrooms that the property has. By default set to 2."
help="The number of bedrooms that the property has. By default set to 2."

Comment on lines 3 to 6
# TODO - Separate Command.create() and Invoice
# TODO - utiliser xpath
# Inside property view => nb invoices
# More on Command.create/update/etc.
Copy link
Author

Choose a reason for hiding this comment

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

Tu les as fait au final ou c'est juste des leftovers ?


def sold_property_action(self):
res = super().sold_property_action()
account = self.env['account.move']
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
account = self.env['account.move']
account_model = self.env['account.move']

Il faut faire attention à ne pas mélanger des instances de modèle et le modèle en tant que tel. Pour être sûr, j'utiliser bcp les suffixes et préfixes

Comment on lines 17 to 23
account.create(
{
'partner_id': record.buyer.id,
'move_type': 'out_invoice',
'journal_id': self.env['account.journal'].search([('type', '=', 'sale')], limit=1).id,
}
)
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
account.create(
{
'partner_id': record.buyer.id,
'move_type': 'out_invoice',
'journal_id': self.env['account.journal'].search([('type', '=', 'sale')], limit=1).id,
}
)
account_id = account.create(
{
'partner_id': record.buyer.id,
'move_type': 'out_invoice',
'journal_id': self.env['account.journal'].search([('type', '=', 'sale')], limit=1).id,
}
)

Comment on lines 29 to 35
'account_id': account.id,
}),
(0, 0, {
'name': "Administrative fees",
'quantity': 1,
'price_unit': 100.00,
'account_id': account.id,
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
'account_id': account.id,
}),
(0, 0, {
'name': "Administrative fees",
'quantity': 1,
'price_unit': 100.00,
'account_id': account.id,
'account_id': account_id,
}),
(0, 0, {
'name': "Administrative fees",
'quantity': 1,
'price_unit': 100.00,
'account_id': account_id,

Ici, tu as pris l'ID du modèle, pas celui de l'objet que tu viens de créer. Ça a pt marché par chance pcq les IDs matchaient, mais c'est risqué et je ne suis pas sûr que ça fonctionne sur le long terme

'application': True,
'installable': True,
'category': 'Linker',
'version': '0.1',
Copy link
Author

Choose a reason for hiding this comment

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

Au niveau des versions, essaie de faire tjrs 3 numéros

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.

3 participants