I want to add in my custom module a menu link to CONTACT.
web?#view_type=kanban&model=res.partner&menu_id=99&action=97
What is the ID in ACTION for that?
<menuitem name="Member" id="" action="" parent="my_custom_menu" sequence="16"/>
In Settings => Technical => User Interface => Menu Items I don't see MENU ID after open any menu item.
<record model="ir.actions.act_window" id="action_partner_form">
<field name="name">Partner</field>
<field name="res_model">res.partner</field>
<field name="view_mode">tree</field>
</record>
<menuitem name="My Partner" id="my_partner_menu" action="action_partner_form" parent="my_parent_menu" sequence="21"/>
Related
I have a website menu defined by this code:
<record id="website_menu_apps" model="website.menu">
<field name="name">Apps</field>
<field name="url">/apps</field>
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">19</field>
</record>
and a field defined by this code:
class Website(models.Model):
_inherit = 'website'
dedicate_apps_store = fields.Boolean(string='Dedicated Apps Store', default=True)
How can I make website menu disappear when user set website.dedicate_apps_store to False?
<template id="custom_layout" inherit_id="website.layout" name="custom layout">
<xpath expr="//ul[#id='top_menu']/t/t" position="attributes">
<attribute name="t-if">submenu.name != 'Apps' or website.dedicate_apps_store</attribute>
</xpath>
</template>
You inherit webiste.layout and set position="attributes" then you can write your condition inside the attribute tag.
can anyone please help me regarding invoice configuration in odoo 12.
i am trying to add div tag inside invoice configuration page but got no success.
<record id="res_config_inherit_view_form" model="ir.ui.view">
<field name="name">res.config.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('app_settings_block')]" position="inside">
<h2>Notification</h2>
<div></div>
</xpath>
</field>
</record>
i have inherited transient model of res.config.settings in my py file.
i just changed reference from base.res_config_settings_view_form to account.res_config_settings_view_form and
in xpath i added data-key which is sat in the div tag of class named app_settings_block in account.res_config_settings_view_form xml,
in account.invoice it adds all the divs of invoice configuration.
<record id="res_config_inherit_view_form" model="ir.ui.view">
<field name="name">res.config.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[#data-key='account']" position="inside">
<h2>Notification</h2>
<div class="row mt16 o_settings_container" id="notification">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="unpaid_notification"/>
</div>
<div class="o_setting_right_pane">
<label for="unpaid_notification" string="Unpaid invoice reminder"/>
<div class="text-muted">
Auto send unpaid invoice emails to the partners
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
I have this code in odoo 12 that I want to migrate to odoo 13. But I don't know what is the equivalent of src_model in Odoo 13.
<record model="ir.actions.act_window" id="complete_pieces_jointes">
<field name="name">Complete Pieces Jointes</field>
<field name="view_id" ref="view_id_3"/>
<field name="res_model">ir.attachment.moveto.subscription</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="src_model">ir.attachment</field>
<field name="type">ir.actions.act_window</field>
</record>
Can you help me?
You can look at this example from the SMS module. The src_model has been changed to binding_model.
<!-- Add action entry in the Action Menu for Partners -->
<act_window id="res_partner_act_window_sms_composer_multi"
name="Send SMS Text Message"
binding_model="res.partner"
res_model="sms.composer"
binding_views="list"
view_mode="form"
target="new"
context="{
'default_composition_mode': 'mass',
'default_mass_keep_log': True,
'default_res_ids': active_ids
}"
/>
<act_window id="res_partner_act_window_sms_composer_single"
name="Send SMS Text Message"
binding_model="res.partner"
res_model="sms.composer"
binding_views="form"
view_mode="form"
target="new"
context="{
'default_composition_mode': 'comment',
'default_res_id': active_id,
}"
/>
i have develop a custom module which add a new menu in the attendance module to create attendance modification request for both groups "attendance/manual attendance" and "attendance/manager" the problem is my menu is added only for the admin user . If i connect with a user that has the access right manager or manual attendance for the attendance module it will be not shown. Any idea for help ?
Here is my code
hr_attendance_modification_request_view.xml
<record model="ir.ui.view" id="view_attendance_modification_request_form">
<field name="name">attendance.modification.request.form</field>
<field name="model">attendance.modification.request</field>
<field name="arch" type="xml">
<form string="Attendance modification Request">
<header>
<field name="state" statusbar_visible="draft,waiting,approved,cancel" widget="statusbar" />
<button name="submit_modification" string="Submit for manager" type="object" class="btn-primary"
attrs="{'invisible': [('state','not in','draft')]}"/>
<button name="modification_approval" type="object" string="Approve" class="oe_highlight"
groups="hr_attendance.group_hr_attendance_manager"
attrs="{'invisible': [('state','not in','waiting')]}"/>
<button name="modification_rejection" type="object" string="Cancel" class="oe_highlight"
groups="hr_attendance.group_hr_attendance_manager"
attrs="{'invisible': [('state','not in','waiting')]}"/>
</header>
<sheet>
<h2>
<group>
<field name="employee"/>
</group>
</h2>
<group string="Morning" col="4" colspan="4">
<field name="time_check_in_1"/>
<field name="time_check_out_1"/>
</group>
<group string="Afternoon" col="4" colspan="4">
<field name="time_check_in_2"/>
<field name="time_check_out_2"/>
</group>
<label for="note"/>
<field name="note"/>
</sheet>
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="attendance_modification_request_form_action">
<field name="name">Attendance modification Request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">attendance.modification.request</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="context">{"search_default_requested_by":uid}</field>
<!-- <field name="search_view_id" ref="view_attendance_request_search"/>-->
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to start a new attendance modification request process.
</p>
</field>
</record>
<menuitem action="attendance_modification_request_form_action" id="menu_attendance_modification_request"
name="Attendance modification request" parent="hr_attendance.menu_hr_attendance_manage_attendances"
sequence="14" groups="hr_attendance.group_hr_attendance"/>
<record model="ir.actions.act_window" id="action_view_attendance_request_approval">
<field name="name">Attendance modification request to approve</field>
<field name="res_model">attendance.modification.request</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','!=','approved'),('state','!=','cancel')]</field>
<field name="help" type="html">
<p class="oe_view_no_content_create">Create new Record
</p>
</field>
</record>
<menuitem action="action_view_attendance_request_approval" id="menu_attendance_modification_request_to_approve"
name="Attendance modification request to Approve"
parent="hr_attendance.menu_hr_attendance_manage_attendances"
sequence="15" groups="hr_attendance.group_hr_attendance_manager"/>
i should add ir.model.access.csv file
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_attendance_modification_request,access_attendance_modification_request,model_attendance_modification_request,hr_attendance.group_hr_attendance_manager,1,1,1,1 access_attendance_modification_request,access_attendance_modification_request,model_attendance_modification_request,hr_attendance.group_hr_attendance,1,1,1,1
I am new to Odoo 11, I have created a module called 'coupon', for this module I have created a security group and a default user that is added to this group:
<record id="default_coupon_user" model="res.users">
<field name="login">couponuser</field>
<field name="password">couponuser</field>
<field name="password_crypt">couponuser</field>
<field name="name">Default User Coupon</field>
<field name="display_name">Default Coupon User</field>
<field name="customer">False</field>
</record>
<record id="coupon_managers_group" model="res.groups" >
<field name="name">Coupon Managers Group</field>
<field name="comment">Coupon Managers Group that will be used in the Coupon microservice.</field>
<field name="category_id" ref="base.module_category_coupon"/>
<field name="users" eval="[(4, ref('coupon.default_coupon_user'))]"/>
</record>
My module depends on website because I need to create a website, for that site I created an index page:
<!-- === Coupon Page === -->
<template id="index_template">
<t t-call="website.layout">
<div id="wrap">
<div class="container">
<h1>Coupons</h1>
<a href="/payum_coupon/create" class="btn btn-primary btn-lg">
Add
</a>
<p>paginas:
<t t-esc="coupons['pg']"/>
</p>
<p>total:
<t t-esc="coupons['total']"/>
</p>
<ul class="clientes">
<t t-foreach="coupons['items']" t-as="i">
<li>
<a t-attf-href="/payum_coupon/{{i['email']}}">
<t t-esc="i['firstName']"/>
<t t-esc="i['lastName']"/>
-
<t t-esc="i['email']"/>
</a>
</li>
</t>
</ul>
</div>
</div>
</t>
</template>
<record id="coupon_page" model="website.page">
<field name="name">Index Coupon page</field>
<field name="website_published">True</field>
<field name="url">/coupon</field>
<field name="view_id" ref="index_template"/>
<field name="groups">coupon.coupon_managers_group</field>
</record>
and website.menu with the following code:
<record id="coupon_page_link" model="website.menu">
<field name="name">Coupon</field>
<field name="page_id" ref="coupon_page"/>
<field name="parent_id" ref="website.main_menu"/>
</record>
the python code in the controller that will be executed by said menu is this:
#http.route('/coupon', auth='user', website=True)
def index(self, **kw):
#<<my code here>>
I need several things:
when the 'index' page is displayed if the user in session is not in the 'coupon.coupon_managers_group' group then the menu is not shown
And that when the controller method '/coupon' is executed it is verified that the user in session is in the group 'coupon.coupon_managers_group'
This site has a particularity and that my module does not have models, since it is to manage the data of an api rest application, that is, in odoo I have to create the views of list, create, etc., but the data is written and they are read from a remote web service.
I have searched many sites on the internet but I have not found anything, as they always refer to local cases in odoo.
To hide the website menu based on the user group you could do something like this:
from odoo import api, models
class Menu(models.Model):
_inherit = "website.menu"
#api.one
def _compute_visible(self):
if self.clean_url() == '/coupon' and not self.env.user.has_group('coupon.coupon_managers_group'):
return False
return super(Menu, self)._compute_visible()
In the controller of the route /coupon you could check the user group like:
request.env.user.has_group('coupon.coupon_managers_group')