<?xml version="1.0" encoding="utf-8"?>

<!--
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<odoo>
  <data>

    <!-- Actions -->
    <record model="ir.actions.act_window" id="action_membership_products">
      <field name="name">Subscriptions</field>
      <field name="res_model">product.template</field>
      <field name="domain">[('membership','=',True), ('type', '=', 'service')]</field>
      <field name="context" eval="{'membership':True, 'type':'service', 'default_membership': True, 'default_type': 'service', 'default_property_account_income_id': ref('golem_membership.account_756200')}" />
      <field name="search_view_id" ref="membership.membership_product_search_form_view" />
    </record>
    <record model="ir.actions.act_window.view" id="action_membership_product_view_tree">
      <field name="sequence" eval="1"/>
      <field name="view_mode">tree</field>
      <field name="view_id" ref="membership.membership_products_tree"/>
      <field name="act_window_id" ref="action_membership_products"/>
    </record>

    <record model="ir.actions.act_window.view" id="action_membership_product_view_form">
      <field name="sequence" eval="2"/>
      <field name="view_mode">form</field>
      <field name="view_id" ref="membership.membership_products_form"/>
      <field name="act_window_id" ref="action_membership_products"/>
    </record>
    <!-- Menus reorganization -->
    <!-- Deactivate classic membership list -->
    <record id="membership.menu_membership" model="ir.ui.menu">
      <field name="active">0</field>
    </record>
    <record id="membership.menu_marketing_config_association" model="ir.ui.menu">
      <field name="active">0</field>
    </record>
    <record id="membership.menu_association" model="ir.ui.menu">
      <field name="active">0</field>
    </record>
    <!-- New menus -->
    <menuitem name="Members and users" id="menu_association"
      sequence="15" web_icon="membership,static/description/icon.png" />
    <menuitem name="Configuration" id="menu_config_association"
      parent="menu_association" sequence="100" />
    <menuitem name="Subscriptions" id="subscription_product_menu"
      parent="menu_config_association" sequence="5"
      action="action_membership_products" />

  </data>
</odoo>