-
Notifications
You must be signed in to change notification settings - Fork 2.1k
18.0 tutorial importable modules aras #811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
18.0 tutorial importable modules aras #811
Conversation
-added menus to access estate views from main menu.
-Added list view to estate property type. -Added menu to access estate property type. -Added access rights to estate property type. -Added some related fields to estate property. -Added the new fields to the view.
-created list view for estate property tag. -created menu to access estate property tags. -created a filed for tag ids in estate property. -Added the new field to estate property view.
-Added access rights to the model. -created list and form view to model. -Added offer ids field to estate property model, and added it to its view.
… field to evaluate its value. -Added the new field to the models form view.
… country. -Added the field to the model's form view.
-Added the action to a button in estate property view.
-Added access rights to public user. -Added read and write record rules to public user. -Added server action to return estate property list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. Please find a few remarks while going through your code. Hope it helps
<field name="name">x_user_id</field> | ||
<field name="field_description">Salesperson</field> | ||
<field name="ttype">many2one</field> | ||
<field name="relation">res.partner</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Salesperson is a user, no?
</record> | ||
|
||
<record id="field_estate_property_proprty_type_id" model="ir.model.fields"> | ||
<field name="model_id" ref="estate.model_estate_property" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref
to an id of the same module works without having to specify the complete xmlid
<field name="model_id" ref="estate.model_estate_property" /> | |
<field name="model_id" ref="model_estate_property" /> |
This is not true when dealing with env.ref
<field name="model_id" ref="estate.model_estate_property" /> | ||
<field name="name">x_total_area</field> | ||
<field name="field_description">Total Area</field> | ||
<field name="ttype">float</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since both areas are integers, you may want to stick with integers
<field name="ttype">float</field> | |
<field name="ttype">integer</field> |
for offer in records: | ||
offer.write({'x_status': 'accepted'}) | ||
offer.x_property_id.write({'x_selling_price': offer.x_price, 'x_partner_id': offer.x_partner_id}) | ||
for rejected_offer in offer.x_property_id.x_property_offer_ids: | ||
if rejected_offer != offer: | ||
rejected_offer.write({'x_status': 'refused'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but what if you accept two offers for the same property? It seems like only one will be accepted, but it is kind of magic, no? Shouldn't we take more care (and maybe raise in such cases)?
|
||
<record id="field_estate_property_api_published" model="ir.model.fields"> | ||
<field name="model_id" ref="estate.model_estate_property" /> | ||
<field name="name">x_api_published</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you find out how to set a default value for this field?
<field name="model_id" ref="model_estate_property"/> | ||
<field name="domain_force">[('x_api_published','=',True)]</field> | ||
<field name="groups" eval="[(4, ref('base.group_public'))]"/> | ||
<field name="perm_read" eval="True"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default the rule applies to all perm_* fields, so this one is not mandatory (and somehow misleading, because you are giving other rights too)
<field name="perm_read" eval="True"/> |
|
||
|
||
registry.category("web_tour.tours").add('estate_tour', { | ||
url: "/web", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url is now defined in the xml web_tour (and should point to /odoo). But since this is the default value, you don't have to :-)
url: "/web", |
url: "/web", | ||
steps: () => [{ | ||
trigger: '.o_app[data-menu-xmlid="estate.menu_root"]', | ||
content: 'Start selling your properties from this app!', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you want to translate the string here?
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
|
|||
<odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User probably don't want this tour to show up anytime they upgrade, so setting this as noupdate seems appropriate
<group> | ||
<field name="x_property_offer_ids"/> | ||
</group> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better without a group here
<group> | |
<field name="x_property_offer_ids"/> | |
</group> | |
<field name="x_property_offer_ids"/> |
|
||
<record id="field_estate_property_total_area" model="ir.model.fields"> | ||
<field name="model_id" ref="estate.model_estate_property" /> | ||
<field name="name">x_total_area</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to store that field?
No description provided.