Conversation
…e module installation.
estate/demo/estate_property.xml
Outdated
| <field name="state">new</field> | ||
| <field name="description">A nice and big villa</field> | ||
| <field name="postcode">12345</field> | ||
| <field name="date_availability">2020-02-02</field> |
There was a problem hiding this comment.
This should preferably be relative to the date of install (see codebase for examples)
estate/demo/estate_property.xml
Outdated
| <odoo> | ||
| <record id="estate_property_1" model="estate.property"> | ||
| <field name="name">Big Villa</field> | ||
| <field name="state">new</field> |
There was a problem hiding this comment.
As it is the default value, you're not forced to provide it
| <field name="state">new</field> |
estate/demo/estate_property.xml
Outdated
| <field name="postcode">54321</field> | ||
| <field name="date_availability">1970-01-01</field> | ||
| <field name="expected_price">100000</field> | ||
| <field name="selling_price">120000</field> |
There was a problem hiding this comment.
Why a selling_price if the state is cancelled?
| <function model="estate.property.offer" name="action_offer_refuse" eval="[ref('estate_property_offer_1')]"/> | ||
| <function model="estate.property.offer" name="action_offer_refuse" eval="[ref('estate_property_offer_2')]"/> | ||
| <function model="estate.property.offer" name="action_offer_accept" eval="[ref('estate_property_offer_3')]"/> | ||
| </odoo> No newline at end of file |
…d/cancelled property. -Added check to raise an error if a property is sold without any offer accepted. -Created tests cases to verify total area calculation, verify action_property_sold, and verify offer creation for sold property. -Added missing new lines in some files.
estate/tests/test_estate_property.py
Outdated
|
|
||
| cls.properties = cls.env['estate.property'].create([{'name': 'test_house'}]) | ||
| cls.partner = cls.env['res.partner'].create([{ | ||
| 'id': 'test_partner', |
There was a problem hiding this comment.
id?! don't touch this 😄
| 'id': 'test_partner', |
estate/tests/test_estate_property.py
Outdated
| 'company_name': 'test_company', | ||
| 'street': 'test_street', | ||
| 'city': 'test_city', | ||
| 'zip': '12345', | ||
| 'country_id': cls.env.ref('base.us').id, | ||
| 'state_id': cls.env.ref('base.state_us_39').id, | ||
| 'phone': '+1 555-555-5555', | ||
| 'email': '[email protected]', | ||
| 'tz': 'Europe/Brussels', |
There was a problem hiding this comment.
Do you need all this? I bet a name is sufficient for your case
| 'company_name': 'test_company', | |
| 'street': 'test_street', | |
| 'city': 'test_city', | |
| 'zip': '12345', | |
| 'country_id': cls.env.ref('base.us').id, | |
| 'state_id': cls.env.ref('base.state_us_39').id, | |
| 'phone': '+1 555-555-5555', | |
| 'email': '[email protected]', | |
| 'tz': 'Europe/Brussels', |
estate/tests/test_estate_property.py
Outdated
| # add env on cls and many other things | ||
| super().setUpClass() | ||
|
|
||
| cls.properties = cls.env['estate.property'].create([{'name': 'test_house'}]) |
There was a problem hiding this comment.
Plural is misleading
| cls.properties = cls.env['estate.property'].create([{'name': 'test_house'}]) | |
| cls.property = cls.env['estate.property'].create([{'name': 'test_house'}]) |
estate/tests/test_estate_property.py
Outdated
| self.assertRecordValues(self.properties, [ | ||
| {'total_area': 35}, | ||
| ]) |
There was a problem hiding this comment.
assertEqual if only one value to check, no?
estate/tests/test_estate_property.py
Outdated
| self.properties.offer_ids.action_offer_accept() | ||
| self.properties.action_property_sold() |
There was a problem hiding this comment.
Not related to tests, but I have the feeling that action_offer_accept should mark the property as sold, so why do you need the call to action_property_sold?
There was a problem hiding this comment.
In the estate tutorial accepting the offer and selling the property are two different states.
After accepting an offer you can still cancel the property, not sell it.
estate/tests/test_estate_property.py
Outdated
| def test_action_sell_with_accepted_offer(self): | ||
| """Test that everything behaves like it should when selling a valid property.""" | ||
|
|
||
| self.properties.offer_ids.create({ |
There was a problem hiding this comment.
Weird way to create an offer. Either use self.env['property.offer'].create(...), either create it while editing the field offer_ids with Command
No description provided.