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,
}"
/>
Related
So I want to change the string of "Purchase Order" inside Purchase Status(Inside Purchase Request) to something like "PO Created" when the purchase_state is in [purchase] but I don't know how I can do it. I want to create fresh module as well.
Here' s what I tried so far. I've created an XML and inherit the view.
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="purchase_request_form_inherit" model="ir.ui.view">
<field name="name">purchase.request.inherit</field>
<field name="model">purchase.request</field>
<field name="inherit_id" ref="purchase_request.view_purchase_request_form"/>
<field name="arch" type="xml">
<field name="purchase_state" position="attributes">
<attribute name="attrs" string="PO Created" attrs="{'readonly': [('po_line.state','=', 'purchase')]}"/>
</field>
</field>
</record>
</odoo>
I prefer use xpath:
<record id="purchase_request_form_inherit" model="ir.ui.view">
<field name="name">purchase.request.inherit</field>
<field name="model">purchase.request</field>
<field name="inherit_id" ref="purchase_request.view_purchase_request_form"/>
<field name="arch" type="xml">
<field expr="field[#name='purchase_state']" position="attributes">
<!-- To change the String -->
<attribute name="string">PO Created</attribute>
<!-- To change the attrs -->
<attribute name="attrs">{'readonly': [('po_line.state','=', 'purchase')]}</attribute>
</field>
</field>
</record>
I hope this answer could be helpful for you.
I am odor newer.
I want to use the sale.order field and value to create a custom report by select some specific
field from sale.order.
I have created a custom model to inherit sale.order model.
And create a view to inherit view of sale.order.
Here is my code:
class SaleOrder(models.Model):
_inherit = 'sale.order'
<field name="name">Custom Sale Report</field>
<field name="res_model">sale.order</field>
<field name="view_mode">tree,form</field>
<field name="name">sale.order.inherited</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//field[#name='name']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath> </field> </record>
But I don't know why the invisible attribute is not working.
Please Help. Thanks.
Try this.
<field name="name">sale.order.inherited</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<xpath expr="//field[#name='name']" position="replace">
<field name="name" optional="hide"/>
</xpath>
</field>
</record>
I cannot find the view which contain Activities on res.partner form view
I tried to inherit mail.mail_activity_type_view_form but it is not
<record id="mail_activity_view_inherit" model="ir.ui.view">
<field name="name">mail.activity.type.view.form.inherit</field>
<field name="model">mail.activity.type</field>
<field name="inherit_id" ref="mail.mail_activity_type_view_form" />
</record>
The XML-ID is:
mail.res_partner_view_form_inherit_mail
So, mail addon, res_partner_view_form_inherit_mail view.
The view is this one:
<record id="res_partner_view_form_inherit_mail" model="ir.ui.view">
<field name="name">res.partner.view.form.inherit.mail</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='email']" position="replace">
<field name="is_blacklisted" invisible="1"/>
<label for="email" class="oe_inline"/>
<div class="o_row o_row_readonly">
<i class="fa fa-ban" style="color: red;" role="img" title="This email is blacklisted for mass mailing" aria-label="Blacklisted" attrs="{'invisible': [('is_blacklisted', '=', False)]}" groups="base.group_user"></i>
<field name="email" widget="email" context="{'gravatar_image': True}" attrs="{'required': [('user_ids','!=', [])]}" />
</div>
</xpath>
<xpath expr="//sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</xpath>
</field>
</record>
Let me try to help, you're trying to _inherit mail.activity view which is not possible by using xml, because it will not inherit from xml it is written in qweb, so for that you have to extend it like.
<t t-extend="idOfMailAvtivityQweb">
<t t-jquery='i[title="Mark as Todo"]' t-operation="before">
//Here in thread i will add something before title "Mark as Todo"
</t>
</t>
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 want to add a cron job that runs at a specific time.
I have added the cron in xml but it has interval_number and interval_type. How to make it run at a specific time of day?
<record id="ir_cron_module_get_active_sr" model="ir.cron">
<field name="name">Get Active Srs</field>
<field eval="True" name="get_active_srs" />
<!--<field name="user_id" ref="base.user_root" />-->
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field eval="'hr.attendance'" name="model" />
<field eval="'get_active_srs'" name="function" />
<field eval="'(None,)'" name="args" />
<field name="priority">1000</field>
</record>
try
<record id="ir_cron_module_get_active_sr" model="ir.cron">
<field name="name">Get Active Srs</field>
<field eval="True" name="get_active_srs" />
<!--<field name="user_id" ref="base.user_root" />-->
<field name="interval_number">1</field>
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 12:00:00')" />
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field eval="'hr.attendance'" name="model" />
<field eval="'get_active_srs'" name="function" />
<field eval="'(None,)'" name="args" />
<field name="priority">1000</field>
</record>