Purnendu Singh (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi/+merge/76163

Hello,

This merge proposal contains following improvements:
1) Remove the field 'property_reserve_and_surplus_account' from res.company 
object.
2) Change in company view accordingly
3) update the generic chart of accounts accordingly.
4) Remove the field 'reserve_account_id' from balance sheet report.
5) New Code for Net profit and Net Loss accounts for profit/loss and balance 
sheet reports.
6) remove "reserve and surplus account" field from wizard and add the line 
automatically as for profit&loss suggested by qdp

Thanks,
Purnendu Singh
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi/+merge/76163
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi.
=== modified file 'account/account.py'
--- account/account.py	2011-09-19 14:12:51 +0000
+++ account/account.py	2011-09-20 07:30:37 +0000
@@ -896,7 +896,7 @@
     _sql_constraints = [
         ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),
     ]
-    
+
     def _check_duration(self,cr,uid,ids,context=None):
         obj_period = self.browse(cr, uid, ids[0], context=context)
         if obj_period.date_stop < obj_period.date_start:
@@ -2150,7 +2150,7 @@
                 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
             except:
                 raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))
-                
+
             move_id = account_move_obj.create(cr, uid, {
                 'ref': entry['name'],
                 'period_id': period_id,
@@ -2515,7 +2515,6 @@
         'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),
         'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
         'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
-        'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
         'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'),
         'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'),
     }
@@ -3112,7 +3111,6 @@
             ('property_account_income_categ','product.category','account.account'),
             ('property_account_expense','product.template','account.account'),
             ('property_account_income','product.template','account.account'),
-            ('property_reserve_and_surplus_account','res.company','account.account')
         ]
         for record in todo_list:
             r = []

=== modified file 'account/account_view.xml'
--- account/account_view.xml	2011-09-19 15:01:46 +0000
+++ account/account_view.xml	2011-09-20 07:30:37 +0000
@@ -2149,7 +2149,6 @@
                     <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
                     <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
                     <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
-                    <field name="property_reserve_and_surplus_account" />
                     </group>
                 </form>
             </field>

=== modified file 'account/company.py'
--- account/company.py	2011-08-27 21:19:48 +0000
+++ account/company.py	2011-09-20 07:30:37 +0000
@@ -25,14 +25,6 @@
     _inherit = "res.company"
     _columns = {
         'overdue_msg': fields.text('Overdue Payments Message', translate=True),
-        'property_reserve_and_surplus_account': fields.property(
-            'account.account',
-            type='many2one',
-            relation='account.account',
-            string="Reserve and Profit/Loss Account",
-            view_load=True,
-            domain="[('type', '=', 'other')]",
-            help="This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profit & Loss Report"),
     }
 
     _defaults = {

=== modified file 'account/company_view.xml'
--- account/company_view.xml	2011-09-17 11:03:17 +0000
+++ account/company_view.xml	2011-09-20 07:30:37 +0000
@@ -16,17 +16,5 @@
             </field>
         </record>
 
-        <record model="ir.ui.view" id="view_company_inherit_1_form">
-            <field name="name">res.company.form.inherit</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="model">res.company</field>
-            <field name="type">form</field>
-            <field name="arch" type="xml">
-                <field name="currency_id" position="after">
-                      <field name="property_reserve_and_surplus_account" colspan="2"/>
-                </field>
-            </field>
-        </record>
-
     </data>
 </openerp>

=== modified file 'account/configurable_account_chart.xml'
--- account/configurable_account_chart.xml	2011-08-04 12:09:57 +0000
+++ account/configurable_account_chart.xml	2011-09-20 07:30:37 +0000
@@ -223,17 +223,8 @@
 			            <field name="user_type" ref="conf_account_type_liability"/>
 			        </record>
 
-			        <record id="conf_a_reserve_and_surplus" model="account.account.template">
+			        <record id="conf_o_expense" model="account.account.template">
 			            <field name="code">1113</field>
-			            <field name="name">Reserve and Profit/Loss Account</field>
-			            <field ref="conf_cli" name="parent_id"/>
-			            <field name="type">other</field>
-			            <field eval="True" name="reconcile"/>
-			            <field name="user_type" ref="conf_account_type_liability"/>
-			        </record>
-
-			        <record id="conf_o_expense" model="account.account.template">
-			            <field name="code">1114</field>
 			            <field name="name">Opening Expense Account</field>
 			            <field ref="conf_cli" name="parent_id"/>
 			            <field name="type">other</field>
@@ -446,8 +437,7 @@
             <field name="property_account_expense_categ" ref="conf_a_expense"/>
             <field name="property_account_income_categ" ref="conf_a_sale"/>
             <field name="property_account_income_opening" ref="conf_o_income"/>
-            <field name="property_account_expense_opening" ref="conf_o_expense"/>            
-            <field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
+            <field name="property_account_expense_opening" ref="conf_o_expense"/>
         </record>
 
      	<!-- VAT Codes -->
@@ -611,7 +601,7 @@
 		<record id="conf_a_expense" model="account.account.template">
 			<field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/>
 		</record>
-		
+
 		<record id="action_wizard_multi_chart_todo" model="ir.actions.todo">
 			<field name="name">Generate Chart of Accounts from a Chart Template</field>
 			<field name="action_id" ref="account.action_wizard_multi_chart"/>

=== modified file 'account/demo/account_minimal.xml'
--- account/demo/account_minimal.xml	2011-03-03 14:59:00 +0000
+++ account/demo/account_minimal.xml	2011-09-20 07:30:37 +0000
@@ -205,16 +205,8 @@
             <field name="user_type" ref="account_type_liability"/>
         </record>
 
-        <record id="rsa" model="account.account">
+        <record id="o_expense" model="account.account">
             <field name="code">X1113</field>
-            <field name="name">Reserve and Profit/Loss - (test)</field>
-            <field ref="cli" name="parent_id"/>
-            <field name="type">other</field>
-            <field name="user_type" ref="account_type_liability"/>
-        </record>
-
-        <record id="o_expense" model="account.account">
-            <field name="code">X1114</field>
             <field name="name">Opening Expense - (test)</field>
             <field ref="cli" name="parent_id"/>
             <field name="type">other</field>
@@ -344,14 +336,6 @@
             <field name="company_id" ref="base.main_company"/>
         </record>
 
-        <record forcecreate="True" id="property_reserve_and_surplus_account" model="ir.property">
-            <field name="name">property_account_receivable</field>
-            <field name="fields_id" search="[('model','=','res.company'),('name','=','property_reserve_and_surplus_account')]"/>
-            <field eval="'account.account,'+str(rsa)" name="value"/>
-            <field name="company_id" ref="base.main_company"/>
-        </record>
-
-
         <!--
         Account Journal
         -->

=== modified file 'account/report/account_balance_sheet.py'
--- account/report/account_balance_sheet.py	2011-06-10 16:45:54 +0000
+++ account/report/account_balance_sheet.py	2011-09-20 07:30:37 +0000
@@ -122,8 +122,9 @@
         else:
             self.res_bl['type'] = _('Net Loss')
         pl_dict  = {
-            'code': self.res_bl['type'],
+            'code': self.res_bl['code'],
             'name': self.res_bl['type'],
+            'type': self.res_bl['type'],
             'level': False,
             'balance':self.res_bl['balance'],
         }
@@ -152,9 +153,10 @@
                             accounts_temp.append(account_dict)
                     else:
                         accounts_temp.append(account_dict)
-                    if account.id == data['form']['reserve_account_id']:
-                        pl_dict['level'] = account['level'] + 1
-                        accounts_temp.append(pl_dict)
+
+            if typ == 'liability' and self.res_bl['balance']:
+                pl_dict['level'] = 0
+                accounts_temp.append(pl_dict)
 
             self.result[typ] = accounts_temp
             cal_list[typ]=self.result[typ]

=== modified file 'account/report/account_profit_loss.py'
--- account/report/account_profit_loss.py	2011-06-16 09:53:39 +0000
+++ account/report/account_profit_loss.py	2011-09-20 07:30:37 +0000
@@ -124,12 +124,15 @@
                         accounts_temp.append(account)
             if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):
                 self.res_pl['type'] = None
+                self.res_pl['code'] = None
                 self.res_pl['balance'] = 0.0
             elif self.result_sum_dr > self.result_sum_cr:
                 self.res_pl['type'] = _('Net Loss')
+                self.res_pl['code'] = 'NL'
                 self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
             else:
                 self.res_pl['type'] = _('Net Profit')
+                self.res_pl['code'] = 'NP'
                 self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)
             self.result[typ] = accounts_temp
             cal_list[typ] = self.result[typ]

=== modified file 'account/wizard/account_report_balance_sheet.py'
--- account/wizard/account_report_balance_sheet.py	2011-06-08 10:04:27 +0000
+++ account/wizard/account_report_balance_sheet.py	2011-09-20 07:30:37 +0000
@@ -30,44 +30,19 @@
     _inherit = "account.common.account.report"
     _description = 'Account Balance Sheet Report'
 
-    def _get_def_reserve_account(self, cr, uid, context=None):
-        chart_id = self._get_account(cr, uid, context=context)
-        res = self.onchange_chart_id(cr, uid, [], chart_id, context=context)
-        if not res:
-            return False
-        return res['value']['reserve_account_id']
-
     _columns = {
         'display_type': fields.boolean("Landscape Mode"),
-        'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
-                                      required=True,
-                                      help='This Account is used for transfering Profit/Loss ' \
-                                           '(Profit: Amount will be added, Loss: Amount will be duducted), ' \
-                                           'which is calculated from Profilt & Loss Report',
-                                      domain = [('type','=','other')]),
     }
 
     _defaults={
         'display_type': False,
         'journal_ids': [],
-        'reserve_account_id': _get_def_reserve_account,
     }
 
-    def onchange_chart_id(self, cr, uid, ids, chart_id, context=None):
-        if not chart_id:
-            return {}
-        account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context)
-        if not account.company_id.property_reserve_and_surplus_account:
-            return {'value': {'reserve_account_id': False}}
-        return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}}
-
-
     def _print_report(self, cr, uid, ids, data, context=None):
         if context is None:
             context = {}
-        data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0])
-        if not data['form']['reserve_account_id']:
-            raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
+        data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
         data = self.pre_print_report(cr, uid, ids, data, context=context)
         if data['form']['display_type']:
             return {

=== modified file 'account/wizard/account_report_balance_sheet_view.xml'
--- account/wizard/account_report_balance_sheet_view.xml	2011-01-14 00:11:01 +0000
+++ account/wizard/account_report_balance_sheet_view.xml	2011-09-20 07:30:37 +0000
@@ -10,7 +10,7 @@
             <field name="arch" type="xml">
             <data>
             <xpath expr="//field[@name='chart_account_id']" position="replace">
-                <field name="chart_account_id" widget="selection" on_change="onchange_chart_id(chart_account_id)"/>
+                <field name="chart_account_id" widget="selection"/>
             </xpath>
             <xpath expr="//field[@name='journal_ids']" position="replace">
                 <field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>
@@ -21,7 +21,6 @@
             </xpath>
             <xpath expr="//field[@name='target_move']" position="after">
                 <field name="display_account"/>
-                <field name="reserve_account_id" required="1"/>
                 <field name="display_type"/>
                 <newline/>
             </xpath>

_______________________________________________
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