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

        <!-- Top menu item -->
        <!--
            This menu item's purpose is to overwrite another one defined in
            the base module in order to set new groups.
        -->
        <menuitem name="Sales"
            id="base.menu_base_partner"
            web_icon="sale,static/description/icon.png"
            groups="base.group_sale_salesman,base.group_sale_manager" sequence="6"/>

        <menuitem
            id= "base.menu_sales_config"
            parent= "base.menu_sale_config"
            sequence= "1"
            name= "Sales"
            groups= "base.group_sale_manager,base.group_sale_salesman,account.group_account_manager,account.group_account_user"/>

        <record id="view_sale_order_calendar" model="ir.ui.view">
            <field name="name">sale.order.calendar</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <calendar string="Sales Orders" color="state" date_start="date_order">
                    <field name="partner_id"/>
                    <field name="amount_total" widget="monetary"/>
                </calendar>
            </field>
        </record>
        <record model="ir.ui.view" id="view_sale_order_graph">
            <field name="name">sale.order.graph</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <graph string="Sales Orders">
                    <field name="partner_id"/>
                    <field name="amount_total" type="measure"/>
                </graph>
            </field>
        </record>
        <record model="ir.ui.view" id="view_sale_order_pivot">
            <field name="name">sale.order.pivot</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <pivot string="Sales Orders">
                    <field name="date_order" type="row"/>
                    <field name="amount_total" type="measure"/>
                </pivot>
            </field>
        </record>

        <!-- Sales Orders Kanban View  -->
        <record model="ir.ui.view" id="view_sale_order_kanban">
            <field name="name">sale.order.kanban</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_mobile">
                    <field name="name"/>
                    <field name="partner_id"/>
                    <field name="amount_total"/>
                    <field name="date_order"/>
                    <field name="state"/>
                    <field name="currency_id"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_card oe_kanban_global_click">
                                <div class="row">
                                    <div class="col-xs-6">
                                        <strong><span><t t-esc="record.partner_id.value"/></span></strong>
                                    </div>
                                    <div class="col-xs-6 pull-right text-right">
                                        <strong><field name="amount_total" widget="monetary"/></strong>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-6 text-muted">
                                        <span><t t-esc="record.name.value"/> <t t-esc="record.date_order.value"/></span>
                                    </div>
                                    <div class="col-xs-6">
                                        <span t-attf-class="pull-right text-right label #{['draft', 'cancel'].indexOf(record.state.raw_value) > -1 ? 'label-default' : ['done'].indexOf(record.state.raw_value) > -1 ? 'label-success' : 'label-primary'}"><t t-esc="record.state.value"/></span>
                                    </div>
                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>

        <record id="view_order_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="priority">2</field>
            <field name="arch" type="xml">
                <tree string="Sales Orders" decoration-bf="message_needaction==True" decoration-muted="state=='cancel'">
                    <field name="message_needaction" invisible="1"/>
                    <field name="name" string="Order Number"/>
                    <field name="date_order"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="amount_total" sum="Total Tax Included" widget="monetary"/>
                    <field name="invoice_status"/>
                    <field name="state" invisible="1"/>
                </tree>
            </field>
        </record>

        <record id="view_quotation_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="priority">4</field>
            <field name="arch" type="xml">
                <tree string="Quotation" decoration-bf="message_needaction==True" decoration-muted="state=='cancel'">
                    <field name="message_needaction" invisible="1"/>
                    <field name="name" string="Quotation Number"/>
                    <field name="date_order"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="amount_total" sum="Total Tax Included" widget="monetary"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_order_form" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <form string="Sales Order">
                <header>
                    <button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
                        type="action" class="btn-primary"
                        attrs="{'invisible': [('invoice_status', '!=', 'to invoice')]}"/>
                    <button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
                        type="action" context="{'default_advance_payment_method': 'percentage'}"
                        attrs="{'invisible': ['|',('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}"/>
                    <button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="btn-primary"/>
                    <button name="action_quotation_send" string="Send by Email" type="object" states="sent,sale"/>
                    <button name="print_quotation" string="Print" type="object" states="draft" class="btn-primary"/>
                    <button name="print_quotation" string="Print" type="object" states="sent,sale"/>
                    <button name="action_confirm" states="sent" string="Confirm Sale" class="btn-primary" type="object" context="{'show_sale': True}"/>
                    <button name="action_confirm" states="draft" string="Confirm Sale" type="object" context="{'show_sale': True}"/>
                    <button name="action_cancel" states="draft,sent,sale" type="object" string="Cancel"/>
                    <button name="action_draft" states="cancel" type="object" string="Set to Quotation"/>
                    <button name="action_done" type="object" string="Set to Done" states="sale"
                        help="If a sale order is done, you cannot modify it manually anymore. However, you will still be able to invoice or deliver. This is used to freeze the sale order."/>
                    <field name="state" widget="statusbar" statusbar_visible="draft,sent,sale,done"/>
                </header>
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button name="action_view_invoice"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-pencil-square-o"
                            attrs="{'invisible': [('invoice_count', '=', 0)]}">
                            <field name="invoice_count" widget="statinfo" string="Invoices"/>
                        </button>
                    </div>
                    <div class="oe_title">
                        <h1>
                            <field name="name" readonly="1"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="partner_id" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
                            <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>
                            <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>
                            <field name="project_id" context="{'default_partner_id':partner_invoice_id, 'default_name':name}"/>
                        </group>
                        <group>
                            <field name="date_order" invisible="1"/>
                            <field name="pricelist_id" groups="product.group_sale_pricelist"/>
                            <field name="currency_id" invisible="1"/>
                            <field name="validity_date"/>
                            <field name="payment_term_id" options="{'no_create': True}"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Order Lines">
                            <field name="order_line" mode="tree,kanban"
                                attrs="{'readonly': [('state', 'in', ('done','cancel'))]}">
                                <form string="Sales Order Lines">
                                    <group>
                                        <group>
                                            <field name="product_id"
                                                attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"
                                               />
                                            <field name="invoice_status" invisible="1"/>
                                            <field name="qty_to_invoice" invisible="1"/>
                                            <field name="qty_delivered_updateable" invisible="1"/>
                                            <label for="product_uom_qty" string="Ordered Quantity"/>
                                            <div>
                                                <field
                                                    name="product_uom_qty" class="oe_inline"/>
                                                <field name="product_uom" groups="product.group_uom" class="oe_inline oe_no_button"
                                                    attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"/>
                                            </div>
                                            <label for="qty_delivered" string="Delivered Quantity"
                                                invisible="not context.get('show_sale')"/>
                                            <div>
                                                <field name="qty_delivered" invisible="not context.get('show_sale')"
                                                    attrs="{'readonly': [('qty_delivered_updateable', '=', False)]}"/>
                                            </div>
                                            <label for="qty_invoiced" string="Invoiced Quantity" invisible="not context.get('show_sale')"/>
                                            <div>
                                                <field name="qty_invoiced" invisible="not context.get('show_sale')"/>
                                            </div>
                                            <field name="price_unit"/>
                                            <label for="discount" groups="sale.group_discount_per_so_line"/>
                                            <div name="discount" groups="sale.group_discount_per_so_line">
                                                <field name="discount" class="oe_inline"/> %%
                                            </div>
                                        </group>
                                        <group>
                                            <field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"/>
                                            <label for="customer_lead"/>
                                            <div>
                                                <field name="customer_lead" class="oe_inline"/> days
                                            </div>
                                        </group>
                                    </group>
                                    <label for="name"/>
                                    <field name="name"/>
                                    <div groups="base.group_no_one"><commit_msg>Revert "[FIX] bug when creating a SO line in mobile view"<commit_after><?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <!-- Top menu item -->
        <!--
            This menu item's purpose is to overwrite another one defined in
            the base module in order to set new groups.
        -->
        <menuitem name="Sales"
            id="base.menu_base_partner"
            web_icon="sale,static/description/icon.png"
            groups="base.group_sale_salesman,base.group_sale_manager" sequence="6"/>

        <menuitem
            id= "base.menu_sales_config"
            parent= "base.menu_sale_config"
            sequence= "1"
            name= "Sales"
            groups= "base.group_sale_manager,base.group_sale_salesman,account.group_account_manager,account.group_account_user"/>

        <record id="view_sale_order_calendar" model="ir.ui.view">
            <field name="name">sale.order.calendar</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <calendar string="Sales Orders" color="state" date_start="date_order">
                    <field name="partner_id"/>
                    <field name="amount_total" widget="monetary"/>
                </calendar>
            </field>
        </record>
        <record model="ir.ui.view" id="view_sale_order_graph">
            <field name="name">sale.order.graph</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <graph string="Sales Orders">
                    <field name="partner_id"/>
                    <field name="amount_total" type="measure"/>
                </graph>
            </field>
        </record>
        <record model="ir.ui.view" id="view_sale_order_pivot">
            <field name="name">sale.order.pivot</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <pivot string="Sales Orders">
                    <field name="date_order" type="row"/>
                    <field name="amount_total" type="measure"/>
                </pivot>
            </field>
        </record>

        <!-- Sales Orders Kanban View  -->
        <record model="ir.ui.view" id="view_sale_order_kanban">
            <field name="name">sale.order.kanban</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_mobile">
                    <field name="name"/>
                    <field name="partner_id"/>
                    <field name="amount_total"/>
                    <field name="date_order"/>
                    <field name="state"/>
                    <field name="currency_id"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_card oe_kanban_global_click">
                                <div class="row">
                                    <div class="col-xs-6">
                                        <strong><span><t t-esc="record.partner_id.value"/></span></strong>
                                    </div>
                                    <div class="col-xs-6 pull-right text-right">
                                        <strong><field name="amount_total" widget="monetary"/></strong>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-6 text-muted">
                                        <span><t t-esc="record.name.value"/> <t t-esc="record.date_order.value"/></span>
                                    </div>
                                    <div class="col-xs-6">
                                        <span t-attf-class="pull-right text-right label #{['draft', 'cancel'].indexOf(record.state.raw_value) > -1 ? 'label-default' : ['done'].indexOf(record.state.raw_value) > -1 ? 'label-success' : 'label-primary'}"><t t-esc="record.state.value"/></span>
                                    </div>
                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>

        <record id="view_order_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="priority">2</field>
            <field name="arch" type="xml">
                <tree string="Sales Orders" decoration-bf="message_needaction==True" decoration-muted="state=='cancel'">
                    <field name="message_needaction" invisible="1"/>
                    <field name="name" string="Order Number"/>
                    <field name="date_order"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="amount_total" sum="Total Tax Included" widget="monetary"/>
                    <field name="invoice_status"/>
                    <field name="state" invisible="1"/>
                </tree>
            </field>
        </record>

        <record id="view_quotation_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="priority">4</field>
            <field name="arch" type="xml">
                <tree string="Quotation" decoration-bf="message_needaction==True" decoration-muted="state=='cancel'">
                    <field name="message_needaction" invisible="1"/>
                    <field name="name" string="Quotation Number"/>
                    <field name="date_order"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="amount_total" sum="Total Tax Included" widget="monetary"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_order_form" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <form string="Sales Order">
                <header>
                    <button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
                        type="action" class="btn-primary"
                        attrs="{'invisible': [('invoice_status', '!=', 'to invoice')]}"/>
                    <button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice"
                        type="action" context="{'default_advance_payment_method': 'percentage'}"
                        attrs="{'invisible': ['|',('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}"/>
                    <button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="btn-primary"/>
                    <button name="action_quotation_send" string="Send by Email" type="object" states="sent,sale"/>
                    <button name="print_quotation" string="Print" type="object" states="draft" class="btn-primary"/>
                    <button name="print_quotation" string="Print" type="object" states="sent,sale"/>
                    <button name="action_confirm" states="sent" string="Confirm Sale" class="btn-primary" type="object" context="{'show_sale': True}"/>
                    <button name="action_confirm" states="draft" string="Confirm Sale" type="object" context="{'show_sale': True}"/>
                    <button name="action_cancel" states="draft,sent,sale" type="object" string="Cancel"/>
                    <button name="action_draft" states="cancel" type="object" string="Set to Quotation"/>
                    <button name="action_done" type="object" string="Set to Done" states="sale"
                        help="If a sale order is done, you cannot modify it manually anymore. However, you will still be able to invoice or deliver. This is used to freeze the sale order."/>
                    <field name="state" widget="statusbar" statusbar_visible="draft,sent,sale,done"/>
                </header>
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button name="action_view_invoice"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-pencil-square-o"
                            attrs="{'invisible': [('invoice_count', '=', 0)]}">
                            <field name="invoice_count" widget="statinfo" string="Invoices"/>
                        </button>
                    </div>
                    <div class="oe_title">
                        <h1>
                            <field name="name" readonly="1"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="partner_id" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
                            <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>
                            <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>
                            <field name="project_id" context="{'default_partner_id':partner_invoice_id, 'default_name':name}"/>
                        </group>
                        <group>
                            <field name="date_order" invisible="1"/>
                            <field name="pricelist_id" groups="product.group_sale_pricelist"/>
                            <field name="currency_id" invisible="1"/>
                            <field name="validity_date"/>
                            <field name="payment_term_id" options="{'no_create': True}"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Order Lines">
                            <field name="order_line" mode="tree,kanban"
                                attrs="{'readonly': [('state', 'in', ('done','cancel'))]}">
                                <form string="Sales Order Lines">
                                    <group>
                                        <group>
                                            <field name="product_id"
                                                context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
                                                attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"
                                               />
                                            <field name="invoice_status" invisible="1"/>
                                            <field name="qty_to_invoice" invisible="1"/>
                                            <field name="qty_delivered_updateable" invisible="1"/>
                                            <label for="product_uom_qty" string="Ordered Quantity"/>
                                            <div>
                                                <field
                                                    context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'uom_qty_change':True, 'company_id': parent.company_id}"
                                                    name="product_uom_qty" class="oe_inline"/>
                                                <field name="product_uom" groups="product.group_uom" class="oe_inline oe_no_button"
                                                    attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"/>
                                            </div>
                                            <label for="qty_delivered" string="Delivered Quantity"
                                                invisible="not context.get('show_sale')"/>
                                            <div>
                                                <field name="qty_delivered" invisible="not context.get('show_sale')"
                                                    attrs="{'readonly': [('qty_delivered_updateable', '=', False)]}"/>
                                            </div>
                                            <label for="qty_invoiced" string="Invoiced Quantity" invisible="not context.get('show_sale')"/>
                                            <div>
                                                <field name="qty_invoiced" invisible="not context.get('show_sale')"/>
                                            </div>
                                            <field name="price_unit"/>
                                            <label for="discount" groups="sale.group_discount_per_so_line"/>
                                            <div name="discount" groups="sale.group_discount_per_so_line">
                                                <field name="discount" class="oe_inline"/> %%
                                            </div>
                                        </group>
                                        <group>
                                            <field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"/>
                                            <label for="customer_lead"/>
                                            <div>
                                                <field name="customer_lead" class="oe_inline"/> days
                                            </div>
                                        </group>
                                    </group>
                                    <label for="name"/>
                                    <field name="name"/>
                                    <div groups="base.group_no_one">
{'fraction_non_alphanumeric': 0.13280609882084712, 'fraction_numerical': 0.0019949413985964164, 'mean_word_length': 1.2745098039215685, 'pattern_counts': {'":': 2, '<': 441, '<?xml version=': 2, '>': 445, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 16}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 188, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3678641', 'n_tokens_mistral': 6838, 'n_tokens_neox': 6423, 'n_words': 1206}