<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2022 Akretion France (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>

<record id="sale_invoice_discount_all_lines_form" model="ir.ui.view">
    <field name="model">sale.invoice.discount.all.lines</field>
    <field name="arch"  type="xml">
        <form>
            <group name="main">
                <field name="sale_id" attrs="{'invisible': [('sale_id', '=', False)]}"/>
                <field name="move_id" attrs="{'invisible': [('move_id', '=', False)]}"/>
                <label for="discount"/>
                <div name="discount">
                    <field name="discount" class="oe_inline"/> %%
                </div>
                <field name="line_type"/>
            </group>
            <footer>
                <button name="run" type="object"
                    class="btn-primary" string="Apply"/>
                <button special="cancel" string="Cancel" class="btn-default"/>
            </footer>
        </form>
    </field>
</record>

<record id="account_move_discount_all_lines_action" model="ir.actions.act_window">
    <field name="name">Discount on all lines</field>
    <field name="res_model">sale.invoice.discount.all.lines</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
    <field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
    <field name="binding_model_id" ref="account.model_account_move" />
    <field name="binding_view_types">form</field>
</record>

<record id="sale_order_discount_all_lines_action" model="ir.actions.act_window">
    <field name="name">Discount on all lines</field>
    <field name="res_model">sale.invoice.discount.all.lines</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
    <field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
    <field name="binding_model_id" ref="sale.model_sale_order" />
    <field name="binding_view_types">form</field>
</record>

</odoo>
