<?xml version="1.0"?>
<odoo>

    <record id="act_res_partner_2_sale_order" model="ir.actions.act_window">
        <field name="name">Quotations and Sales</field>
        <field name="res_model">sale.order</field>
        <field name="view_mode">list,kanban,form,graph</field>
        <field name="domain">[('partner_id', 'child_of', active_ids)]</field>
        <field name="context">{'default_partner_id': active_id}</field>
        <field name="group_ids" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
            Create a new quotation, the first step of a new sale!
            </p><p>
            Once the quotation is confirmed by the customer, it becomes a sales order.<br/> You will be able to create an invoice and collect the payment.
            </p>
        </field>
    </record>

    <record id="res_partner_view_buttons" model="ir.ui.view">
        <field name="name">res.partner.view.buttons</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="priority" eval="3"/>
        <field name="arch" type="xml">
            <div name="button_box" position="inside">
                <button
                    class="oe_stat_button"
                    type="action"
                    name="sale.act_res_partner_2_sale_order"
                    groups="sales_team.group_sale_salesman"
                    icon="fa-usd">
                    <field string="Sales" name="sale_order_count" widget="statinfo"/>
                </button>
            </div>
            <group name="warnings" position="inside">
                <group groups="sale.group_warning_sale" col="2">
                    <separator string="Warning on Sales Orders and Invoices" colspan="2"/>
                    <field name="sale_warn_msg"
                           placeholder="e.g. This customer has reported recurring issues with previous orders."
                           nolabel="1" colspan="2"/>
                </group>
            </group>
        </field>
    </record>

    <record id="res_partner_view_form_payment_defaultcreditcard" model="ir.ui.view">
        <field name="name">res.partner.view.form.payment.defaultcreditcard</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="payment.view_partners_form_payment_defaultcreditcard"/>
        <field name="arch" type="xml">
            <button name="%(payment.action_payment_token)d" position="attributes">
                <attribute name="groups">sales_team.group_sale_salesman</attribute>
            </button>
        </field>
    </record>

    <record id="res_partner_view_form_property_inherit" model="ir.ui.view">
        <field name="name">res.partner.view.form.property.inherit</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="account.view_partner_property_form"/>
        <field name="arch" type="xml">
            <group name="fiscal_information" position="attributes">
                <attribute name="groups">account.group_account_invoice,sales_team.group_sale_salesman</attribute>
            </group>
            <field name="property_payment_term_id" position="attributes">
                <attribute name="groups">account.group_account_invoice,sales_team.group_sale_salesman</attribute>
            </field>
            <field name="property_supplier_payment_term_id" position="attributes">
                <attribute name="groups">account.group_account_invoice,sales_team.group_sale_salesman</attribute>
            </field>
        </field>
    </record>

</odoo>
