Last active
July 2, 2018 10:56
-
-
Save legalsylvain/b901c0f526b2cac38abe274921fe759c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Multi Action | |
<act_window id="base.action_partner_mass_mail" | |
name="[TITLE]" | |
src_model="my.src.model" | |
res_model="my.target.model.wizard" | |
view_mode="form" | |
multi="True" | |
target="new" | |
key2="client_action_multi" | |
context="{}"/> | |
# Action par python | |
## Ajout du bouton (SRC MODEL) | |
<button class="oe_inline oe_stat_button" type="object" | |
name="nom_action_dans_code_python" icon="fa-copy" | |
attrs="{'invisible': [('xxx_qty', '=', 0)]}"> | |
<field string="XXX" name="xxx_qty" widget="statinfo"/> | |
## Code Python (SRC MODEL) | |
def nom_action_dans_code_python(self): | |
action = self.env.ref('MODULE.NOM_ACTION_XML') | |
action_data = action.read()[0] | |
ids = [x, y] | |
action_data['domain'] = "[('id','in',[" +\ | |
','.join(map(str, ids)) + "])]" | |
return action_data | |
## Action XML (TARGET MODEL) | |
<record id="NOM_ACTION_XML" model="ir.actions.act_window"> | |
<field name="name">NAME</field> | |
<field name="res_model">target.model</field> | |
<field name="view_type">form</field> | |
<field name="view_mode">tree</field> | |
<field name="view_id" ref="NOM_VIEW_XML"/> <!-- OPTIONAL --> | |
</record> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment