콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
4553 화면

Hey,

I try to acces to the buttons (type="object") of the header of a module because on click, it's set the wrong state to my statusbar..

I'm using studio, is it possible to access them ? How to create new ones (object type, not action type) for futur creations ?


PS: I only saw method for action buttons..

아바타
취소
작성자

Thanks, but with the Sales module, I don't see where the create invoice button is liked. When I found his action (Settings > Technical > Actions) There's nothing but the type. No code that tell me how it's create a new invoice into the Accounting module.

Cause I'm looking for adding autofill data. Is it possible ?

베스트 답변

Hi,

To make changes to the buttons or to add new buttons, you have to modify the XML code of the view.

For that, you need to enable debug mode. Then select the 'Edit View: Form' option from the debug options. You can see the main view. Navigate to the 'Inherited Views' tab and click on Add a line. A new form will be opened, where you can add the new button/ make changes to the new button by inheriting the existing view.

Provide a 'View Name' and select the current form view(The view from which the button is added(Either the parent view or any of its inherited view)) as 'Inherited View'. Then add the code in the text box under the 'Architecture' tab. For example:

<?xml version="1.0"?>


<data>


    <xpath expr="//button[@name='existing_button_1']" position="replace">


        <button name="replace_button_function" type="object" class="btn-primary" string="Updated Button"/>


    </xpath>


    <xpath expr="//button[@name='existing_button_2']" position="after">


        <button name="new_button_function" type="object" class="btn-primary" string="New Button"/>


    </xpath>


</data>


You have to add the changes in XML code in either a new inherited view or in the inherited view created by Odoo for Studio customizations(Preferred): The External ID starts with studio_customization.odoo_studio_. Don't modify the other existing views.

Regards

아바타
취소
베스트 답변

Hi,

Using studio if you need to add a button that executes python functions, you can do it as follows.


Write a server action for that model with action to do as execute python code and write the necessary python codes there. Now in the view add button with type action and specify the id of the created action in the name of the button.


This is how type object in the code side is handled in the odoo studio.


For more, see this tutorial: https://www.youtube.com/watch?v=HC6Zw8A_uXo


Thanks

아바타
취소
관련 게시물 답글 화면 활동
2
3월 15
8071
2
7월 17
4724
1
7월 25
1282
2
3월 25
1545
0
2월 25
1189