Conversation
estate/models/__init__.py
Outdated
| from . import property_type | ||
| from . import estate_property_tag | ||
| from . import estate_property_offer | ||
| from . import res_users No newline at end of file |
There was a problem hiding this comment.
Tu peux installer flake8 sur ton VS Code pour être sûr d'avoir un retour à la ligne à la fin des fichiers
estate/models/__init__.py
Outdated
| @@ -0,0 +1,5 @@ | |||
| from . import estate_property | |||
| from . import property_type | |||
There was a problem hiding this comment.
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 :
| from . import property_type | |
| from . import estate_property_type |
estate/models/estate_property.py
Outdated
| "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 |
There was a problem hiding this comment.
| 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
estate/models/estate_property.py
Outdated
| expected_price = fields.Float( | ||
| "Expected Price", | ||
| required=True, | ||
| help="Enter the expected price for the property. This field is required." |
There was a problem hiding this comment.
| 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
estate/models/estate_property.py
Outdated
| bedrooms = fields.Integer( | ||
| "Nb Bedrooms", | ||
| default=2, | ||
| help="Enter the number of bedrooms that the property has. By default set to 2." |
There was a problem hiding this comment.
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
| 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." |
| # TODO - Separate Command.create() and Invoice | ||
| # TODO - utiliser xpath | ||
| # Inside property view => nb invoices | ||
| # More on Command.create/update/etc. |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
| 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
| account.create( | ||
| { | ||
| 'partner_id': record.buyer.id, | ||
| 'move_type': 'out_invoice', | ||
| 'journal_id': self.env['account.journal'].search([('type', '=', 'sale')], limit=1).id, | ||
| } | ||
| ) |
There was a problem hiding this comment.
| 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, | |
| } | |
| ) |
| 'account_id': account.id, | ||
| }), | ||
| (0, 0, { | ||
| 'name': "Administrative fees", | ||
| 'quantity': 1, | ||
| 'price_unit': 100.00, | ||
| 'account_id': account.id, |
There was a problem hiding this comment.
| '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', |
There was a problem hiding this comment.
Au niveau des versions, essaie de faire tjrs 3 numéros

No description provided.