Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
7644 Lượt xem

Dear friends,

I am trying to override a core Odoo 12 action on res_partner but I am unable to achieve what I want.
I need to remove the option "Send SMS" from Actions menu on res.partner form.

The code for the "sms" module that creates the menu is:

       <!-- Add action entry in the Action Menu for Partners -->
      <act_window id="send_sms_action"
          name="Send SMS"
          src_model="res.partner"
          res_model="sms.send_sms"
          view_type="form"
          view_mode="form"
          key2="client_action_multi"
          target="new"/>

This code adds an entry "Send SMS" to Action menu for the res_partner model.

I can see that under "Window Actions" on Technical Settings, that the action exists and has the external ID "sms.send_sms_action".

The problem is this action uses the model "sms.send_sms" as the object and "res.partner" as the source object.

I have tried to (with no luck):

Python class for "res_partner":

      @api.model
      def delete_send_sms_option(self):
          if self.env.ref('sms.send_sms_action'):
              self.env.ref('sms.send_sms_action').unlink

XML Function call:

      <function model="res.partner" name="delete_send_sms_option"/>                                                                                                           

This is not working.

Can anyone help me please?

Thank you all in advance

Best regards

Paulo

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Paulo: Create a new Security Group with no users in it and assign this group to the SMS window action that you want to hide.

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you @Paresh,

It solved my problem.

Best regards

Paulo

Câu trả lời hay nhất

you can  try this:

<odoo>

    <data noupdate="1">

        <delete model="ir.actions.act_window" id="sms.send_sms_action"/>

    </data>

</odoo>


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
3680
0
thg 3 24
1413
3
thg 1 24
9099
0
thg 4 23
1695
0
thg 10 22
2596