Turkesh Patel (openERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-v62_account_groups-tpa into 
lp:~openerp-dev/openobject-addons/trunk-v62_config_account-uco.

Requested reviews:
  Ujjvala Collins (OpenERP) (uco-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-v62_account_groups-tpa/+merge/96750

--> [IMP] Improved code for group fields

--> [IMP] Applied grops on fields 
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-v62_account_groups-tpa/+merge/96750
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-v62_config_account-uco.
=== modified file 'account/__init__.py'
=== modified file 'account/__openerp__.py'
--- account/__openerp__.py	2012-03-09 10:38:12 +0000
+++ account/__openerp__.py	2012-03-09 12:08:22 +0000
@@ -126,7 +126,13 @@
         'company_view.xml',
         'board_account_view.xml',
         "edi/invoice_action_data.xml",
+<<<<<<< TREE
 #        "account_pre_install.yml",
+=======
+        "account_bank_view.xml",
+        "account_pre_install.yml",
+        "res_config_view.xml",
+>>>>>>> MERGE-SOURCE
     ],
     'demo_xml': [
         'demo/account_demo.xml',

=== modified file 'account/account_invoice_view.xml'
--- account/account_invoice_view.xml	2012-02-28 14:08:16 +0000
+++ account/account_invoice_view.xml	2012-03-09 12:08:22 +0000
@@ -61,7 +61,7 @@
                     <field name="price_unit"/>
                     <field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
                     <field name="discount" groups="base.group_extended"/>
-                    <field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
+                    <field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="base.group_analytic_account_for_sale,base.group_analytic_account_for_purchase"/>
                     <field name="company_id" groups="base.group_multi_company" readonly="1"/>
                     <separator string="Notes" colspan="4"/>
                     <field colspan="4" name="note" nolabel="1"/>
@@ -122,7 +122,7 @@
                     <field name="reference" invisible="1"/>
                     <field name="name" invisible="1"/>
                     <field name="journal_id" invisible="1"/>
-                    <field name="period_id" invisible="1" groups="account.group_account_user"/>
+                    <field name="period_id" invisible="1" groups="base.group_dates_periods"/>
                     <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                     <field name="user_id"/>
                     <field name="date_due"/>
@@ -157,7 +157,7 @@
                         <field name="fiscal_position" groups="base.group_extended" widget="selection"/>
                         <newline/>
                         <field name="date_invoice"/>
-                        <field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/>
+                        <field name="period_id" domain="[('state', '=', 'draft')]" groups="base.group_dates_periods" widget="selection"/>
                         <group colspan="2" col="1" groups="account.group_account_user">
                             <label align="0.0" string="(keep empty to use the current period)"/>
                         </group>
@@ -173,7 +173,7 @@
                                     <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.address_invoice_id, parent.currency_id, context, parent.company_id)"/>
                                     <field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)"/>
                                     <field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/>
-                                    <field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
+                                    <field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="base.group_analytic_account_for_purchase"/>
                                     <field name="quantity"/>
                                     <field name="price_unit"/>
                                      <!-- Removed if subtotal is set -->
@@ -267,7 +267,7 @@
                     <field name="fiscal_position" groups="base.group_extended" widget="selection" options='{"quick_create": false}'/>
                     <newline/>
                     <field name="date_invoice"/>
-                    <field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/>
+                    <field name="period_id" domain="[('state', '=', 'draft')]" groups="base.group_dates_periods" widget="selection"/>
                     <field name="payment_term" widget="selection"/>
                     <newline/>
                     <field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/>
@@ -306,7 +306,7 @@
                                     <button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
                                     <button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" icon="gtk-convert" 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."/>
                                     <button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
-                                    <button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
+                                    <button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="base.group_proforma_invoices"/>
                                     <button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
                                     <button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
                                 </group>
@@ -355,7 +355,7 @@
                 <search string="Search Invoice">
                    <group>
                         <filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
-                        <filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices"/>
+                        <filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices" groups="base.group_proforma_invoices"/>
                         <filter name="invoices" icon="terp-dolar" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>
                         <separator orientation="vertical"/>
                         <filter name="unpaid" icon="terp-dolar_ok!" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>
@@ -371,7 +371,7 @@
                     <newline/>
                     <group>
                         <field name="journal_id" widget="selection"/>
-                        <field name="period_id" string="Period"/>
+                        <field name="period_id" string="Period" groups="base.group_dates_periods"/>
                     </group>
                     <newline/>
                     <group expand="0" string="Group By...">

=== modified file 'account/res_config.py'
--- account/res_config.py	2012-03-09 10:53:12 +0000
+++ account/res_config.py	2012-03-09 12:08:22 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
@@ -234,4 +235,130 @@
 
 account_configuration()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:=======
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from operator import itemgetter
+
+from osv import fields, osv
+from tools.translate import _
+
+class account_configuration(osv.osv_memory):
+    _inherit = 'res.config.settings'
+    
+    def _get_charts(self, cr, uid, context=None):
+        modules = self.pool.get('ir.module.module')
+        # Looking for the module with the 'Account Charts' category
+        category_name, category_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'module_category_localization_account_charts')
+        ids = modules.search(cr, uid, [('category_id', '=', category_id)], context=context)
+        charts = list(
+            sorted(((m.name, m.shortdesc)
+                    for m in modules.browse(cr, uid, ids, context=context)),
+                   key=itemgetter(1)))
+        charts.insert(0, ('configurable', 'Generic Chart Of Accounts'))
+        return charts
+
+    _columns = {
+            'company_id': fields.many2one('res.company', 'Company'),
+            'currency_id': fields.many2one('res.currency','Main Currency'),
+            'sale_tax': fields.float('Default Sale Tax'),
+            'purchase_tax': fields.float('Default Purchase Tax'),
+            'charts': fields.selection(_get_charts, 'Chart of Accounts',
+                                        required=True,
+                                        help="Installs localized accounting charts to match as closely as "
+                                             "possible the accounting needs of your company based on your "
+                                             "country."),
+            'chart_template_id': fields.many2one('account.chart.template', 'Chart Template'),
+            'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year'),
+            'paypal_account': fields.char("Your Paypal Account", size=128, help="Paypal username (usually email) for receiving online payments."),
+            'company_footer': fields.char("Footer of Reports", size=128),
+            'customer_invoice_sequence_prefix': fields.char('Invoice Sequence', size=64),
+            'customer_invoice_sequence_padding': fields.integer('Invoice Sequence Padding'),
+            'customer_refund_sequence_prefix': fields.char('Refund Sequence', size=64),
+            'customer_refund_sequence_padding': fields.integer('Refund Sequence Padding'),
+            'supplier_invoice_sequence_prefix': fields.char('Supplier Invoice Sequence', size=64),
+            'supplier_invoice_sequence_padding': fields.integer('Supplier Invoice Sequence Padding'),
+            'supplier_refund_sequence_prefix': fields.char('Supplier Refund Sequence', size=64),
+            'supplier_refund_sequence_padding': fields.integer('Supplier Refund Sequence Padding'),
+
+            'module_account_check_writing': fields.boolean('Support check writings'),
+            'module_account_accountant': fields.boolean('Accountant Features'),
+            'module_account_asset': fields.boolean('Assets Management'),
+            'module_account_budget': fields.boolean('Budgets Management'),
+            'module_account_payment': fields.boolean('Supplier Payment Orders'),
+            'module_account_voucher': fields.boolean('Manage Customer Payments'),
+            'module_account_followup': fields.boolean('Customer Follow-Ups'),
+            'module_account_analytic_plans': fields.boolean('Support Multiple Analytic Plans'),
+            'module_account_analytic_default': fields.boolean('Rules for Analytic Assignation'),
+            'module_account_invoice_layout': fields.boolean('Allow notes and subtotals'),
+
+            'group_analytic_account_for_sales': fields.boolean('Analytic Accounting for Sales', group='base.group_user', implied_group='base.group_analytic_account_for_sales'),
+            'group_analytic_account_for_purchase': fields.boolean('Analytic Accounting for Purchase', group='base.group_user', implied_group='base.group_analytic_account_for_purchase'),
+            'group_dates_periods': fields.boolean('Allow dates/periods', group='base.group_user', implied_group='base.group_dates_periods'),
+            'group_proforma_invoices': fields.boolean('Allow Pro-forma Invoices', group='base.group_user', implied_group='base.group_proforma_invoices'),
+    }
+
+    _defaults = {
+            'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
+            'currency_id': lambda s, cr, uid, c: s.pool.get('res.currency').search(cr, uid, [])[0],
+            'charts': 'configurable',
+    }
+
+    def _check_default_tax(self, cr, uid, context=None):
+        ir_values_obj = self.pool.get('ir.values')
+        taxes = {}
+        for tax in ir_values_obj.get(cr, uid, 'default', False, ['product.product']):
+            if tax[1] == 'taxes_id':
+                taxes.update({'taxes_id': tax[2]})
+            if tax[1] == 'supplier_taxes_id':
+                taxes.update({'supplier_taxes_id': tax[2]})
+            return taxes
+        return False
+
+    def default_get(self, cr, uid, fields_list, context=None):
+        ir_values_obj = self.pool.get('ir.values')
+        chart_template_obj = self.pool.get('account.chart.template')
+        res = super(account_configuration, self).default_get(cr, uid, fields_list, context=context)
+        res.update({'sale_tax': 15.0, 'purchase_tax': 15.0})
+        taxes = self._check_default_tax(cr, uid, context)
+        chart_template_ids = chart_template_obj.search(cr, uid, [('visible', '=', True)], context=context)
+        if chart_template_ids:
+            res.update({'chart_template_id': chart_template_ids[0]})
+        if taxes:
+            sale_tax_id = taxes.get('taxes_id')
+            res.update({'sale_tax': sale_tax_id and sale_tax_id[0]})
+            purchase_tax_id = taxes.get('supplier_taxes_id')
+            res.update({'purchase_tax': purchase_tax_id and purchase_tax_id[0]})
+        return res
+    
+    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+        ir_values_obj = self.pool.get('ir.values')
+        res = super(account_configuration, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
+        if self._check_default_tax(cr, uid, context) and taxes:
+            if res['fields'].get('sale_tax') and res['fields'].get('purchase_tax'):
+                res['fields']['sale_tax'] = {'domain': [], 'views': {}, 'context': {}, 'selectable': True, 'type': 'many2one', 'relation': 'account.tax', 'string': 'Default Sale Tax'}
+                res['fields']['purchase_tax'] = {'domain': [], 'views': {}, 'context': {}, 'selectable': True, 'type': 'many2one', 'relation': 'account.tax', 'string': 'Default Purchase Tax'}
+        return res
+
+account_configuration()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:>>>>>>> MERGE-SOURCE

=== modified file 'account/res_config_view.xml'
--- account/res_config_view.xml	2012-03-09 10:53:12 +0000
+++ account/res_config_view.xml	2012-03-09 12:08:22 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data>
@@ -109,4 +110,114 @@
         <menuitem id="menu_account_config" name="Accounting" parent="base.menu_config" sequence="2" action="action_account_config"/>
         
     </data>
-</openerp>
\ No newline at end of file
+</openerp>=======
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+    
+        <record id="view_account_config" model="ir.ui.view">
+            <field name="name">Accounting Application</field>
+            <field name="model">res.config.settings</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="base.view_res_config_settings"/>
+            <field name="arch" type="xml">
+                <form position="replace">
+                    <form string="Accounting Applications">
+                        <field name="chart_template_id" invisible="1"/>
+                        <group col="4" colspan="4" string="Warning" attrs="{'invisible': [('chart_template_id','!=',False)]}">
+                           <label string="You have no chart of accounts or taxes defined for this company. Select a chart of account to proceed." colspan="4"/>
+                           <field name="charts"/>
+                           <button name="%(action_account_configuration_installer)d" string="Install Chart of Account" icon="gtk-execute" type="action"/>
+                        </group>
+                        <field name="fiscalyear_id" invisible="1"/>
+                        <group col="4" colspan="4" string="Warning" attrs="{'invisible': [('fiscalyear_id','!=',False)]}">
+                           <label string="You have no fiscal year/period open for this date." colspan="4"/>
+                           
+                        </group>
+                        <field name="company_id" widget="selection"/>
+                        <separator string="Accounting Configuration" colspan="4"/>
+                        <group col="4" colspan="4">
+                            <group col="2" colspan="2">
+                                <field name="sale_tax"/>
+                                <field name="module_account_accountant"/>
+                                <field name="module_account_asset"/>
+                                <field name="group_dates_periods"/>
+                            </group>
+                            <group col="2" colspan="2">
+                                <field name="purchase_tax"/>
+                                <field name="currency_id" widget="selection"/>
+                                <field name="module_account_budget"/>
+                            </group>
+                        </group>
+                        <group col="2" colspan="2">
+                            <separator string="Customer Invoices" colspan="2"/>
+                            <group col="4" colspan="2">
+                                <field name="customer_invoice_sequence_prefix"/>
+                                <field name="customer_invoice_sequence_padding" nolabel="1"/>
+                            </group>
+                            <group col="4" colspan="2">
+                                <field name="customer_refund_sequence_prefix"/>
+                                <field name="customer_refund_sequence_padding" nolabel="1"/>
+                            </group>
+                            <field name="module_account_invoice_layout"/>
+                            <newline/>
+                            <field name="module_account_voucher"/>
+                            <newline/>
+                            <field name="module_account_followup"/>
+                            <newline/>
+                            <field name="group_proforma_invoices"/>
+                        </group>
+                        <group col="2" colspan="2">
+                            <separator string="Supplier Invoices" colspan="2"/>
+                            <group col="4" colspan="2">
+                                <field name="supplier_invoice_sequence_prefix"/>
+                                <field name="supplier_invoice_sequence_padding" nolabel="1" colspan="1"/>
+                            </group>
+                            <newline/>
+                            <group col="4" colspan="2">
+                                <field name="supplier_refund_sequence_prefix"/>
+                                <field name="supplier_refund_sequence_padding" nolabel="1"/>
+                            </group>
+                            <field name="module_account_payment"/>
+                        </group>
+                        <group col="2" colspan="2">
+                            <separator string="Electronic Payments" colspan="2"/>
+                            <field name="paypal_account"/>
+                        </group>
+                        <group col="2" colspan="2">
+                            <separator string="Bank &amp; Cash" colspan="2"/>
+                            <field name="company_footer"/>
+                            <newline/>
+                            <label string="Setup your bank accounts: "/>
+                            <button name="%(action_bank_tree)d" string="Setup Your Bank Accounts" icon="gtk-execute" type="action"/>
+                            <newline/>
+                            <field name="module_account_check_writing"/>
+                        </group>
+                        <group col="2" colspan="2">
+                            <separator string="Analytic Accounting" colspan="2"/>
+                            <field name="group_analytic_account_for_sales"/>
+                            <newline/>
+                            <field name="group_analytic_account_for_purchase"/>
+                            <newline/>
+                            <field name="module_account_analytic_plans"/>
+                            <newline/>
+                            <field name="module_account_analytic_default"/>
+                        </group>
+                    </form>
+                </form>
+            </field>
+        </record>
+        
+        <record id="action_account_config" model="ir.actions.act_window">
+            <field name="name">Configure Accounting Application</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">res.config.settings</field>
+            <field name="view_id" ref="view_account_config"/>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+        </record>
+        
+        <menuitem id="menu_account_config" name="Accounting" parent="base.menu_config" sequence="4" action="action_account_config"/>
+        
+    </data>
+</openerp>>>>>>>> MERGE-SOURCE

=== modified file 'purchase/purchase_view.xml'
--- purchase/purchase_view.xml	2012-02-07 13:17:19 +0000
+++ purchase/purchase_view.xml	2012-03-09 12:08:22 +0000
@@ -366,7 +366,7 @@
                             <field name="date_planned" widget="date"/>
                             <field name="price_unit"/>
                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
-                            <field name="account_analytic_id" colspan="4" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]" />
+                            <field name="account_analytic_id" colspan="4" groups="base.group_analytic_account_for_purchase" domain="[('parent_id','!=',False)]" />
                             <group colspan="4" col="4" groups="base.group_extended">
                                 <separator colspan="4" string="Taxes"/>
                                 <field colspan="4" nolabel="1" name="taxes_id"
@@ -429,7 +429,7 @@
                             <field name="date_planned" widget="date"  readonly="1"/>
                             <field name="price_unit"/>
                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
-                            <field name="account_analytic_id" colspan="4" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
+                            <field name="account_analytic_id" colspan="4" groups="base.group_analytic_account_for_purchase" domain="[('parent_id','!=',False)]"/>
                             <group colspan="4" col="4" groups="base.group_extended">
                                 <separator colspan="4" string="Taxes"/>
                                 <field colspan="4" nolabel="1" name="taxes_id"

=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml	2012-01-31 13:36:57 +0000
+++ sale/sale_view.xml	2012-03-09 12:08:22 +0000
@@ -120,7 +120,7 @@
                             <field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id" groups="base.group_extended" options='{"quick_create": false}'/>
                             <field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id" groups="base.group_extended" options='{"quick_create": false}'/>
                             <field domain="[('type','=','sale')]" name="pricelist_id" groups="base.group_extended" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
-                            <field name="project_id" context="{'partner_id':partner_id, 'contact_id':partner_order_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
+                            <field name="project_id" context="{'partner_id':partner_id, 'contact_id':partner_order_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="base.group_analytic_account_for_sales" domain="[('parent_id','!=',False)]"/>
                             <newline/>
                             <field colspan="4" name="order_line" nolabel="1" widget="one2many_list">
                                 <form string="Sales Order Lines">

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to