# HG changeset patch
# User Patrice Journoud <patrice.journoud@xcg-consulting.fr>
# Date 1455033007 -3600
#      Tue Feb 09 16:50:07 2016 +0100
# Branch 1.8
# Node ID 8e7c76eb58ba5881a6188da3292f79ef10c2f18e
# Parent  c5fd252ac819c179890c7a315eeecb10945cf6de
the streamline invoice form is now an inheritance of the invoice form of the account module

diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
+++ b/__openerp__.py
@@ -20,7 +20,7 @@
 ##############################################################################
 {
     "name": "Account Invoice Streamline",
-    "version": "1.8.1",
+    "version": "7.0.1.9",
     "author": "XCG Consulting",
     "category": 'Accounting',
     "description": """Enhancements to the account
diff --git a/views/account_invoice.xml b/views/account_invoice.xml
--- a/views/account_invoice.xml
+++ b/views/account_invoice.xml
@@ -205,213 +205,32 @@
         </record>
 
         <!-- Override the invoice form to:
-            - Remove the <sheet> tag.
             - Add analytic fields.
             - Make the due date read-only when a payment term is selected.
             - Add a "Reverse Invoice" button. -->
-        <record id="account.invoice_form" model="ir.ui.view">
+        <record id="invoice_form" model="ir.ui.view">
+            <field name="name">account.invoice.streamline.invoice.form</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form" />
             <field name="arch" type="xml">
-                <form string="Invoice" version="7.0">
-                    <header>
-                        <button name="action_invoice_sent" type="object"
-                            string="Send by Email"
-                            attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}"
-                            class="oe_highlight" groups="base.group_user" />
-                        <button name="invoice_print" string="Print" type="object"
-                            attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}"
-                            class="oe_highlight" groups="base.group_user" />
-                        <button name="action_invoice_sent" type="object"
-                            string="Send by Email"
-                            attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}"
-                            groups="base.group_user" />
-                        <button name="invoice_print" string="Print Invoice"
-                            type="object"
-                            attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}"
-                            groups="base.group_user" />
-                        <button name="invoice_open" states="draft"
-                            string="Validate" class="oe_highlight" groups="base.group_user" />
-                        <button name="invoice_open" states="proforma2"
-                            string="Validate" groups="base.group_user" />
-                        <button name="invoice_proforma2" states="draft"
-                            string="PRO-FORMA" groups="account.group_proforma_invoices" />
-                        <button name="%(account.action_account_invoice_refund)d"
-                            type='action' string='Refund Invoice' states='open,proforma2,paid'
-                            groups="base.group_user" />
-                        <button name="invoice_cancel" states="draft,proforma2,open"
-                            string="Cancel Invoice" groups="base.group_no_one" />
-                        <button name="wizard_invoice_cancel" string="Reverse Invoice"
-                            type="object" groups="account.group_account_user" />
-                        <button name="action_cancel_draft" states="cancel"
-                            string="Reset to Draft" type="object" groups="base.group_user" />
-                        <button name='%(account.action_account_state_open)d'
-                            type='action' string='Re-Open' groups="account.group_account_invoice"
-                            attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}"
-                            help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created." />
-                        <field name="state" widget="statusbar" nolabel="1"
-                            statusbar_visible="draft,open,paid"
-                            statusbar_colors='{"proforma":"blue","proforma2":"blue"}' />
-                    </header>
-                    <h1>
-                        <label string="Draft Invoice "
-                            attrs="{'invisible': ['|',('state','not in',('draft',)), ('type','&lt;&gt;','out_invoice')]}" />
-                        <label string="Draft Refund "
-                            attrs="{'invisible': ['|',('state','not in',('draft',)), ('type','&lt;&gt;','out_refund')]}" />
-                        <label string="Pro Forma Invoice "
-                            attrs="{'invisible': [('state','not in',('proforma','proforma2'))]}" />
-                        <label string="Invoice "
-                            attrs="{'invisible': ['|',('state','in',('draft','proforma','proforma2')), ('type','&lt;&gt;','out_invoice')]}" />
-                        <label string="Refund "
-                            attrs="{'invisible': ['|',('state','in',('draft','proforma','proforma2')), ('type','&lt;&gt;','out_refund')]}" />
-                        <field name="number" readonly="1" class="oe_inline" />
-                    </h1>
-                    <field name="type" invisible="1" />
-                    <group>
-                        <group>
-                            <field string="Customer" name="partner_id"
-                                on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"
-                                groups="base.group_user"
-                                context="{'search_default_customer':1, 'show_address': 1}"
-                                options='{"always_reload": True}' domain="[('customer', '=', True)]" />
-                            <field name="fiscal_position" widget="selection" />
-                        </group>
-                        <group>
-                            <field name="date_invoice" />
-                            <field name="journal_id" groups="account.group_account_user"
-                                on_change="onchange_journal_id(journal_id, context)"
-                                widget="selection" />
-                            <field
-                                domain="[('company_id', '=', company_id),('type','=', 'receivable')]"
-                                name="account_id" groups="account.group_account_user" />
-
-                            <label for="currency_id" groups="base.group_multi_currency" />
-                            <div groups="base.group_multi_currency">
-                                <field name="currency_id" class="oe_inline" />
-                            </div>
-                        </group>
-                    </group>
-                    <field name="sent" invisible="1" />
-                    <notebook colspan="4">
-                        <page string="Invoice Lines">
-                            <field name="invoice_line" nolabel="1"
-                                widget="one2many_list" context="{'type': type}">
-                                <tree string="Invoice Lines" editable="bottom">
-                                    <field name="sequence" widget="handle" />
-                                    <field name="product_id"
-                                        on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)" />
-                                    <field name="name" />
-                                    <field name="company_id" invisible="1" />
-                                    <field name="account_id"
-                                        groups="account.group_account_user"
-                                        domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '=', 'other')]"
-                                        on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)" />
-                                    <field name="account_analytic_id"
-                                        groups="analytic.group_analytic_accounting"
-                                        domain="[('type','!=','view'), ('company_id', '=', parent.company_id)]" />
-                                    <field name="quantity" />
-                                    <field name="uos_id" groups="product.group_uom"
-                                        on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)" />
-                                    <field name="price_unit" />
-                                    <field name="discount"
-                                        groups="sale.group_discount_per_so_line" />
-                                    <field name="invoice_line_tax_id"
-                                        widget="many2many_tags" context="{'type':parent.type}"
-                                        domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]" />
-                                    <field name="price_subtotal" />
-                                    <div class="oe_analytic" />
-                                </tree>
-                            </field>
-                            <group class="oe_subtotal_footer oe_right">
-                                <field name="amount_untaxed" widget="monetary"
-                                    options="{'currency_field': 'currency_id'}" />
-                                <div>
-                                    <label for="amount_tax" />
-                                    <button name="button_reset_taxes"
-                                        states="draft,proforma2" string="(update)"
-                                        class="oe_link oe_edit_only" type="object"
-                                        help="Recompute taxes and total" />
-                                </div>
-                                <field name="amount_tax" nolabel="1"
-                                    widget="monetary" options="{'currency_field': 'currency_id'}" />
-                                <field name="amount_total" class="oe_subtotal_footer_separator"
-                                    widget="monetary" options="{'currency_field': 'currency_id'}" />
-                                <field name="residual" groups="account.group_account_user"
-                                    widget="monetary" options="{'currency_field': 'currency_id'}" />
-                                <field name="reconciled" invisible="1" />
-                            </group>
-                            <group>
-                                <field name="payment_term" class="oe_inline" />
-                            </group>
-                            <div class="oe_clear">
-                                <label for="comment" />
-                            </div>
-                            <field name="comment" class="oe_inline"
-                                placeholder="Additional notes..." />
-                        </page>
-                        <page string="Other Info">
-                            <group col="4">
-                                <group>
-                                    <field name="company_id"
-                                        on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)"
-                                        widget="selection" groups="base.group_multi_company" />
-                                    <field name="user_id" groups="base.group_user" />
-                                    <field
-                                        domain="[('partner_id.ref_companies', 'in', [company_id])]"
-                                        name="partner_bank_id" />
-                                    <field name="period_id"
-                                        domain="[('state', '=', 'draft'), ('company_id', '=', company_id)]"
-                                        groups="account.group_account_manager"
-                                        string="Accounting Period" placeholder="force period" />
-                                    <field name="date_due"
-                                        attrs="{'readonly': [('payment_term', '!=', False)]}" />
-                                </group>
-                                <group>
-                                    <field name="origin" groups="base.group_user" />
-                                    <field name="name" string="Customer Reference" />
-                                    <field name="move_id"
-                                        groups="account.group_account_user" />
-                                </group>
-                            </group>
-                            <field name="tax_line">
-                                <tree editable="bottom" string="Taxes">
-                                    <field name="name" />
-                                    <field name="account_id"
-                                        groups="account.group_account_user" />
-                                    <field name="base"
-                                        on_change="base_change(base,parent.currency_id,parent.company_id,parent.date_invoice)"
-                                        readonly="1" />
-                                    <field name="amount"
-                                        on_change="amount_change(amount,parent.currency_id,parent.company_id,parent.date_invoice)" />
-                                    <field invisible="True" name="base_amount" />
-                                    <field invisible="True" name="tax_amount" />
-                                    <field name="factor_base" invisible="True" />
-                                    <field name="factor_tax" invisible="True" />
-                                </tree>
-                            </field>
-                        </page>
-                        <page string="Payments" groups="base.group_user">
-                            <field name="payment_ids">
-                                <tree string="Payments">
-                                    <field name="date" />
-                                    <field name="move_id" />
-                                    <field name="ref" />
-                                    <field name="name" />
-                                    <field name="journal_id" groups="base.group_user" />
-                                    <field name="debit" />
-                                    <field name="credit" />
-                                    <field name="amount_currency"
-                                        groups="base.group_multi_currency" />
-                                    <field name="currency_id"
-                                        groups="base.group_multi_currency" />
-                                </tree>
-                            </field>
-                        </page>
-                    </notebook>
-                    <div class="oe_chatter">
-                        <field name="message_follower_ids" widget="mail_followers"
-                            groups="base.group_user" />
-                        <field name="message_ids" widget="mail_thread" />
-                    </div>
-                </form>
+                <xpath expr="//button[@name='invoice_cancel']" position="after">
+                    <button name="wizard_invoice_cancel" string="Reverse Invoice"
+                        type="object" groups="account.group_account_user" />
+                </xpath>
+                <xpath expr="//field[@name='journal_id']" position="replace">
+                    <field name="journal_id" groups="account.group_account_user"
+                        on_change="onchange_journal_id(journal_id, context)"
+                        widget="selection" />
+                </xpath>
+                <xpath expr="//field[@name='account_analytic_id']" position="replace">
+                    <field name="account_analytic_id"
+                        groups="analytic.group_analytic_accounting"
+                        domain="[('type','!=','view'), ('company_id', '=', parent.company_id)]" />
+                </xpath>
+                <xpath expr="//field[@name='date_due']" position="replace">
+                    <field name="date_due"
+                         attrs="{'readonly': [('payment_term', '!=', False)]}" />
+                </xpath>
             </field>
         </record>
     </data>