[IMP] When trying to launch the Chart of Accounts configuration wizard, there is...
[odoo/odoo.git] / addons / account / account_view.xml
index 004ccab..a7d3eb2 100644 (file)
                         <field name="user_type" select="1"/>
                         <field name="active" groups="base.group_extended" />
                         <newline/>
-                        <field name="debit" invisible="context.get('config_invisible', True)"/>
-                        <field name="credit" invisible="context.get('config_invisible', True)"/>
+                        <field name="debit" invisible="context.get('config_invisible', True)" attrs="{'readonly':[('type','=','view')]}"/>
+                        <field name="credit" invisible="context.get('config_invisible', True)" attrs="{'readonly':[('type','=','view')]}"/>
                         <field name="balance" invisible="context.get('config_invisible', True)"/>
                     </group>
                     <notebook colspan="4">
             <field name="domain">[('parent_id','=',False)]</field>
         </record>
 
+         <record id="view_account_gain_loss_tree" model="ir.ui.view">
+           <field name="name">Unrealized Gain or Loss</field>
+            <field name="model">account.account</field>
+            <field name="type">tree</field>
+            <field name="arch" type="xml">
+                <tree string="Unrealized Gains and losses">
+                    <field name="code"/>
+                    <field name="name"/>
+                    <field name="parent_id" invisible="1"/>
+                    <field name="user_type" invisible="1"/>
+                    <field name="type" invisible="1"/>
+                    <field name="currency_id"/>
+                    <field name="exchange_rate"/>
+                    <field name="foreign_balance"/>
+                    <field name="adjusted_balance"/>
+                    <field name="balance"/>
+                    <field name="unrealized_gain_loss"/>
+                </tree>
+            </field>
+        </record>
+
+          <record id="action_account_gain_loss" model="ir.actions.act_window">
+            <field name="name">Unrealized Gain or Loss</field>
+            <field name="res_model">account.account</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="view_account_gain_loss_tree"/>
+            <field name="domain">[('currency_id','!=',False)]</field>
+            <field name="help">When doing multi-currency transactions, you may loose or gain some amount due to changes of exchange rate. This menu gives you a forecast of the Gain or Loss you'd realized if those transactions were ended today. Only for accounts having a secondary currency set.</field>
+        </record>
+
+        <menuitem
+            name="Unrealized Gain or Loss"
+            action="action_account_gain_loss"
+            groups="account.group_account_user"
+            id="menu_unrealized_gains_losses"
+            parent="account.menu_multi_currency"/>
+
         <!--
         Journal
 
                                 <separator string="Company" colspan="4"/>
                                 <field name="company_id" groups="base.group_multi_company"/>
                                 <field name="user_id" groups="base.group_extended"/>
-                                <field name="currency"/>
+                                <field name="currency" groups="base.group_extended"/>
                             </group>
                             <group colspan="2" col="2" groups="base.group_extended">
                                 <separator string="Validations" colspan="4"/>
             <field name="arch" type="xml">
                 <search string="Search Bank Statements">
                     <group>
-                        <filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
-                        <filter string="Confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
+                        <filter string="Draft" name="state_draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
+                        <filter string="Open" name="state_open" domain="[('state','=','open')]" icon="terp-check"/>
+                        <filter string="Confirmed" name="state_confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
                         <separator orientation="vertical"/>
                         <field name="date"/>
                         <field name="name"/>
                 <form string="Bank Statement">
                     <group col="7" colspan="4">
                         <field name="name" select="1"/>
-                        <field name="date" select="1" on_change="onchange_date(date)"/>
+                        <field name="date" select="1" on_change="onchange_date(date, company_id)"/>
                         <field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" select="1" widget="selection"/>
                         <newline/>
                         <field name="period_id"/>
                 <form string="Bank Statement">
                     <group col="7" colspan="4">
                         <field name="name" select="1"/>
-                        <field name="date" select="1" on_change="onchange_date(date)"/>
+                        <field name="date" select="1" on_change="onchange_date(date, company_id)"/>
+                        <field name='company_id' widget="selection" groups="base.group_multi_company" />
                         <field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
                         <newline/>
                         <field name="period_id"/>
                     <group col="2" colspan="2">
                         <separator string="Reporting Configuration" colspan="4"/>
                         <field name="report_type" select="2"/>
-                        <field name="sign" />                        
                     </group>
                     <group col="2" colspan="2">
                         <separator string="Closing Method" colspan="4"/>
                     </group>
                     <newline/>
                     <group>
-                        <field name="journal_id" widget="selection" context="{'journal_id':self, 'visible_id':self, 'normal_view':False}"/>
-                        <field name="period_id" context="{'period_id':self, 'search_default_period_id':self}"/>
+                        <field name="journal_id" widget="selection" context="{'journal_id':self}"/>
+                        <field name="period_id" context="{'period_id':self}"/>
                     </group>
                     <newline/>
                     <group expand="0" string="Group By...">
             <field name="model">account.account</field>
             <field name="name">Open Journal Items</field>
             <field eval="'ir.actions.act_window,%d'%action_move_line_select" name="value"/>
-            <field eval="True" name="object"/>
         </record>
         <!--
     Account.Entry Edition
                     </group>
                     <notebook colspan="4">
                         <page string="Journal Items">
-                            <field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
+                            <field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" context="{'lines':line_id ,'journal':journal_id }">
                                 <form string="Journal Item">
                                     <group col="6" colspan="4">
                                         <field name="name"/>
             context="{'search_default_account_id':[active_id], 'search_default_unreconciled':1, 'default_account_id': active_id}"
             src_model="account.account"/>
 
-        <act_window domain="[('reconcile_id', '=', active_id)]" id="act_account_acount_move_line_reconcile_open" name="Reconciled entries" res_model="account.move.line" src_model="account.move.reconcile"/>
+        <act_window
+            domain="[('reconcile_id', '=', active_id)]"
+            id="act_account_acount_move_line_reconcile_open"
+            name="Reconciled entries"
+            res_model="account.move.line"
+            src_model="account.move.reconcile"/>
 
 
         <!--
                 <tree string="Journal Entry Model Line" editable="bottom">
                     <field name="sequence"/>
                     <field name="name"/>
-                    <field name="account_id"/>
+                    <field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
                     <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
                     <field name="partner_id"/>
                     <field name="debit"/>
                 <form string="Journal Entry Model Line">
                     <field colspan="4" name="name" select="1"/>
                     <field name="sequence"/>
-                    <field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
+                    <field name="account_id" domain="[('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
                     <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
                     <field name="partner_id"/>
                     <field name="debit" select="1"/>
                     <field name="credit" select="1"/>
-                     <field name="quantity"/>
+                    <field name="quantity"/>
                     <field name="date_maturity"/>
                 </form>
             </field>
             <field name="arch" type="xml">
                 <form string="Payment Term">
                     <group>
-                           <group colspan="2" col="4">
-                               <field name="name" select="1"/>
-                               <separator string="Amount Computation" colspan="4"/>
-                               <field name="value" colspan="4"/>
-                               <field name="value_amount" colspan="4" attrs="{'readonly':[('value','=','balance')]}"/>
-                           </group>
-                           <group colspan="2" col="4">
-                               <field name="sequence"/>
-                               <separator string="Due Date Computation" colspan="4"/>
-                               <field name="days" colspan="4"/>
-                               <field name="days2" colspan="4"/>
-                           </group>
+                        <group colspan="2" col="4">
+                            <field name="name" select="1"/>
+                            <separator string="Amount Computation" colspan="4"/>
+                            <field name="value" colspan="4"/>
+                            <field name="value_amount" colspan="4" attrs="{'readonly':[('value','=','balance')]}"/>
+                        </group>
+                        <group colspan="2" col="4">
+                            <field name="sequence"/>
+                            <separator string="Due Date Computation" colspan="4"/>
+                            <field name="days" colspan="4"/>
+                            <field name="days2" colspan="4"/>
+                        </group>
                     </group>
                     <newline/>
-                    <label string="Example: at 14 net days 2 percents, remaining amount at 30 days end of month." colspan="4"/>
+                    <separator string="Example" colspan="4"/>
+                    <label string="At 14 net days 2 percent, remaining amount at 30 days end of month." colspan="4"/>
                     <group colspan="2" col="2">
                         <label string="Line 1:" colspan="2"/>
-                        <label string="  valuation: percent"/>
-                        <label string="  number of days: 14"/>
-                        <label string="  value amount: 0.02"/>
-                        <label string="  day of the month: 0"/>
+                        <label string="  Valuation: Percent"/>
+                        <label string="  Number of Days: 14"/>
+                        <label string="  Value amount: 0.02"/>
+                        <label string="  Day of the Month: 0"/>
                     </group>
                     <newline/>
                     <group colspan="2" col="2">
                         <label string="Line 2:" colspan="2"/>
-                        <label string="  valuation: balance"/>
-                        <label string="  number of days: 30"/>
-                        <label string="  value amount: n.a"/>
-                        <label string="  day of the month= -1"/>
+                        <label string="  Valuation: Balance"/>
+                        <label string="  Number of Days: 30"/>
+                        <label string="  Value amount: n.a"/>
+                        <label string="  Day of the Month= -1"/>
                     </group>
                 </form>
             </field>
                     <field name="active" select="1"/>
                     <separator colspan="4" string="Description On Invoices"/>
                     <field colspan="4" name="note" nolabel="1"/>
+                    <separator colspan="4" string="Computation"/>
                     <field colspan="4" name="line_ids" nolabel="1"/>
                 </form>
             </field>
             <field name="model">account.tax.code</field>
             <field name="name">Tax Details</field>
             <field eval="'ir.actions.act_window,%d'%action_tax_code_line_open" name="value"/>
-            <field eval="True" name="object"/>
         </record>
 
 
            res_model="account.move.line"
            src_model="account.journal"/>
 
-        <act_window context="{'search_default_reconcile_id':False, 'search_default_partner_id':[active_id], 'default_partner_id': active_id}" domain="[('account_id.reconcile', '=', True),('account_id.type', 'in', ['receivable', 'payable'])]" id="act_account_partner_account_move_all" name="Receivables &amp; Payables" res_model="account.move.line" src_model="res.partner" groups="base.group_extended"/>
+        <act_window
+            context="{'search_default_reconcile_id':False, 'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
+            domain="[('account_id.reconcile', '=', True),('account_id.type', 'in', ['receivable', 'payable'])]"
+            id="act_account_partner_account_move_all"
+            name="Receivables &amp; Payables"
+            res_model="account.move.line"
+            src_model="res.partner"
+            groups="base.group_extended"/>
 
         <act_window context="{'search_default_partner_id':[active_id], 'default_partner_id': active_id}" id="act_account_partner_account_move" name="Journal Items" res_model="account.move.line" src_model="res.partner" groups="account.group_account_user"/>
 
 
                             <field name="currency_id"/>
                             <field name="reconcile"/>
+                            <field name="chart_template_id"/>
                             <separator string="Default taxes" colspan="4"/>
                             <field name="tax_ids" colspan="4" nolabel="1"/>
                         </page>
                 <form string="Chart of Accounts Template">
                     <group>
                     <field name="name"/>
-                    <field name="account_root_id"/>
-                    <field name="bank_account_view_id"/>
-                    <field name="tax_code_root_id"/>
+                    <field name="account_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
+                    <field name="bank_account_view_id" attrs="{'required': [('parent_id', '=', False)]}"/>
+                    <field name="tax_code_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
+                    <field name="parent_id" />
+                    <!--<field name="code_digits" />-->
+                    <field name="visible" />
+                    <field name="complete_tax_set" />
                     </group>
                     <field name="tax_template_ids" colspan="4" readonly="1" nolabel="1"/>
                     <separator string="Properties" colspan="4"/>
                         <field name="chart_template_id"/>
                         <field name="type"/>
                         <field name="type_tax_use"/>
-                        <field name="price_include"/>
+                        <group colspan="2" col="4">
+                            <field name="price_include"/>
+                        </group>
                     </group>
                     <notebook colspan="4">
                         <page string="Tax Definition">
                 <group string="res_config_contents" position="replace">
                     <field name="company_id" widget="selection"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
                     <field name ="code_digits" groups="account.group_account_user"/>
-                    <field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)"/>
-                    <field name ="seq_journal" groups="account.group_account_user"/>
-                    <field name="sale_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
-                    <field name="purchase_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('purchase', 'all'))]"/>
+                    <field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
+                    <field name ="seq_journal" groups="base.group_extended"/>
+                    <field name="sale_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
+                    <field name="purchase_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('purchase', 'all'))]"/>
+                    <newline/>
+                    <field name ="sale_tax_rate" attrs="{'invisible': [('complete_tax_set', '=', True)]}" on_change="onchange_tax_rate(sale_tax_rate)"/>
+                    <field name ="purchase_tax_rate" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
+                    <field name ="complete_tax_set" invisible="1"/>
                     <newline/> <!-- extended view because the web UI is not good for one2many -->
                     <field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list" groups="account.group_account_user">
                         <form string="Bank Information">
             <field name="model_id" ref="base.model_ir_actions_todo"/>
             <field eval="5" name="sequence"/>
             <field name="code">
-act_window_ids = pool.get('ir.actions.act_window').search(cr, uid,[('name', 'in', ('Accounting Chart Configuration', 'Generate Chart of Accounts from a Chart Template'))], context=context)
-todo_ids = pool.get('ir.actions.todo').search(cr, uid, [('action_id', 'in', act_window_ids)], context=context)
+account_installer_obj = self.pool.get('account.installer')
+account_installer_obj.check_unconfigured_cmp(cr, uid, context=context)
+action_ids = []
+ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_wizard_multi_chart')
+if ref:
+    action_ids += [ref[1]]
+ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_account_configuration_installer')
+if ref:
+    action_ids += [ref[1]]
+todo_ids = pool.get('ir.actions.todo').search(cr, uid, [('action_id', 'in', action_ids)], context=context)
 pool.get('ir.actions.todo').write(cr, uid, todo_ids, {'state':'open'}, context=context)
 action = pool.get('res.config').next(cr, uid, [], context)
 </field>
@@ -2557,7 +2627,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
                 <form string="Statement">
                     <group col="6" colspan="4">
                         <field name="name" select="1"/>
-                        <field name="company_id" select="1" groups="base.group_multi_company"/>
+                        <field name='company_id' widget="selection" groups="base.group_multi_company" />
                         <field name="journal_id" on_change="onchange_journal_id(journal_id)" select="1" widget="selection"/>
                         <field name="user_id" select="1" readonly="1"/>
                         <field name="period_id" select="1"/>
@@ -2630,7 +2700,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
                     <group col="6" colspan="4">
                         <group col="2" colspan="2">
                             <separator string="Dates" colspan="4"/>
-                            <field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}"  on_change="onchange_date(date)"/>
+                            <field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}"  on_change="onchange_date(date, company_id)"/>
                             <field name="closing_date" select="1" readonly="1"/>
                         </group>
                         <group col="2" colspan="2">
@@ -2721,10 +2791,15 @@ action = pool.get('res.config').next(cr, uid, [], context)
                         <field name="parent_id"/>
                         <field name="sequence"/>
                         <field name="type"/>
+                        <field name="sign"/>
+                        <field name="style_overwrite"/>
                     </group>
-                    <notebook colspan="4">
-                        <page string="Report" attrs="{'invisible': [('state','!=','confirm')]}">
-                            <field name="display_detail" attrs="{'invisible': [('type','!=','accounts')]}"/>
+                    <notebook colspan="6">
+                        <page string="Report">
+                            <group colspan="4" col="4">
+                                <field name="display_detail" attrs="{'invisible': [('type','not in',['accounts','account_type'])]}"  colspan="2"/>
+                                <label string="" colspan="2"/>
+                            </group>
                             <newline/>
                             <field name="account_ids" nolabel="1" colspan="6" attrs="{'invisible': [('type', '!=', 'accounts')]}"/>
                             <newline/>
@@ -2733,9 +2808,6 @@ action = pool.get('res.config').next(cr, uid, [], context)
                             <field name="account_type_ids" nolabel="1" attrs="{'invisible': [('type', '!=', 'account_type')]}"/>
                             <newline/>
                         </page>
-                        <page string="Notes" attrs="{'invisible': [('state','!=','confirm')]}">
-                            <field name="note" nolabel="1" colspan="4"/>
-                        </page>
                     </notebook>
                 </form>
             </field>