Merge lp:~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi into lp:openobject-addons

Proposed by Purnendu Singh (OpenERP)
Status: Rejected
Rejected by: qdp (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi
Merge into: lp:openobject-addons
Diff against target: 289 lines (+17/-87)
10 files modified
account/account.py (+2/-4)
account/account_view.xml (+0/-1)
account/company.py (+0/-8)
account/company_view.xml (+0/-12)
account/configurable_account_chart.xml (+3/-13)
account/demo/account_minimal.xml (+1/-17)
account/report/account_balance_sheet.py (+6/-4)
account/report/account_profit_loss.py (+3/-0)
account/wizard/account_report_balance_sheet.py (+1/-26)
account/wizard/account_report_balance_sheet_view.xml (+1/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-reserve-surplus-account-remove-psi
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Approve
Purnendu Singh (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Pending
Review via email: mp+76163@code.launchpad.net

Description of the change

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

To post a comment you must log in.
5101. By Purnendu Singh (OpenERP)

[MERGE] merge with main addons

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Error when i try to print B&S report:

/trunk/openerp/report/render/rml2pdf/trml2pdf.py", line 633, in _table [2011-09-21 10:38:23,580][?] ERROR:web-services:[44]: st = copy.deepcopy(self.styles.table_styles[tr.get('style')])

KeyError: 'Table0'

Can you fix it ?

Thanks,
Mustufa

review: Needs Fixing
5102. By Purnendu Singh (OpenERP)

[FIX] account: fix the KeyError: 'Table0' while generating balance sheet report

Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) wrote :

Hello,

I have fix the problem KeyError: 'Table0'

Thanks,
Purnendu Singh

review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

as we will soon have something better that the balance sheet and the profit & loss reports, we should not loose anymore more time with this.

So i'm rejecting it for now but please keep it somewhere because we still may need the removal of the account property_reserve_and_surplus_account at that time.

thanks

Unmerged revisions

5102. By Purnendu Singh (OpenERP)

[FIX] account: fix the KeyError: 'Table0' while generating balance sheet report

5101. By Purnendu Singh (OpenERP)

[MERGE] merge with main addons

5100. By Purnendu Singh (OpenERP)

[IMP] account: remove reserve and surpluse account

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account/account.py'
--- account/account.py 2011-09-19 14:12:51 +0000
+++ account/account.py 2011-09-21 06:38:25 +0000
@@ -896,7 +896,7 @@
896 _sql_constraints = [896 _sql_constraints = [
897 ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),897 ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),
898 ]898 ]
899 899
900 def _check_duration(self,cr,uid,ids,context=None):900 def _check_duration(self,cr,uid,ids,context=None):
901 obj_period = self.browse(cr, uid, ids[0], context=context)901 obj_period = self.browse(cr, uid, ids[0], context=context)
902 if obj_period.date_stop < obj_period.date_start:902 if obj_period.date_stop < obj_period.date_start:
@@ -2150,7 +2150,7 @@
2150 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}2150 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
2151 except:2151 except:
2152 raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))2152 raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))
2153 2153
2154 move_id = account_move_obj.create(cr, uid, {2154 move_id = account_move_obj.create(cr, uid, {
2155 'ref': entry['name'],2155 'ref': entry['name'],
2156 'period_id': period_id,2156 'period_id': period_id,
@@ -2515,7 +2515,6 @@
2515 'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),2515 'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),
2516 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),2516 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
2517 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),2517 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
2518 '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'),
2519 'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'),2518 'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'),
2520 'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'),2519 'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'),
2521 }2520 }
@@ -3112,7 +3111,6 @@
3112 ('property_account_income_categ','product.category','account.account'),3111 ('property_account_income_categ','product.category','account.account'),
3113 ('property_account_expense','product.template','account.account'),3112 ('property_account_expense','product.template','account.account'),
3114 ('property_account_income','product.template','account.account'),3113 ('property_account_income','product.template','account.account'),
3115 ('property_reserve_and_surplus_account','res.company','account.account')
3116 ]3114 ]
3117 for record in todo_list:3115 for record in todo_list:
3118 r = []3116 r = []
31193117
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2011-09-19 15:01:46 +0000
+++ account/account_view.xml 2011-09-21 06:38:25 +0000
@@ -2149,7 +2149,6 @@
2149 <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>2149 <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
2150 <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>2150 <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
2151 <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>2151 <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
2152 <field name="property_reserve_and_surplus_account" />
2153 </group>2152 </group>
2154 </form>2153 </form>
2155 </field>2154 </field>
21562155
=== modified file 'account/company.py'
--- account/company.py 2011-08-27 21:19:48 +0000
+++ account/company.py 2011-09-21 06:38:25 +0000
@@ -25,14 +25,6 @@
25 _inherit = "res.company"25 _inherit = "res.company"
26 _columns = {26 _columns = {
27 'overdue_msg': fields.text('Overdue Payments Message', translate=True),27 'overdue_msg': fields.text('Overdue Payments Message', translate=True),
28 'property_reserve_and_surplus_account': fields.property(
29 'account.account',
30 type='many2one',
31 relation='account.account',
32 string="Reserve and Profit/Loss Account",
33 view_load=True,
34 domain="[('type', '=', 'other')]",
35 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"),
36 }28 }
3729
38 _defaults = {30 _defaults = {
3931
=== modified file 'account/company_view.xml'
--- account/company_view.xml 2011-09-17 11:03:17 +0000
+++ account/company_view.xml 2011-09-21 06:38:25 +0000
@@ -16,17 +16,5 @@
16 </field>16 </field>
17 </record>17 </record>
1818
19 <record model="ir.ui.view" id="view_company_inherit_1_form">
20 <field name="name">res.company.form.inherit</field>
21 <field name="inherit_id" ref="base.view_company_form"/>
22 <field name="model">res.company</field>
23 <field name="type">form</field>
24 <field name="arch" type="xml">
25 <field name="currency_id" position="after">
26 <field name="property_reserve_and_surplus_account" colspan="2"/>
27 </field>
28 </field>
29 </record>
30
31 </data>19 </data>
32</openerp>20</openerp>
3321
=== 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-21 06:38:25 +0000
@@ -223,17 +223,8 @@
223 <field name="user_type" ref="conf_account_type_liability"/>223 <field name="user_type" ref="conf_account_type_liability"/>
224 </record>224 </record>
225225
226 <record id="conf_a_reserve_and_surplus" model="account.account.template">226 <record id="conf_o_expense" model="account.account.template">
227 <field name="code">1113</field>227 <field name="code">1113</field>
228 <field name="name">Reserve and Profit/Loss Account</field>
229 <field ref="conf_cli" name="parent_id"/>
230 <field name="type">other</field>
231 <field eval="True" name="reconcile"/>
232 <field name="user_type" ref="conf_account_type_liability"/>
233 </record>
234
235 <record id="conf_o_expense" model="account.account.template">
236 <field name="code">1114</field>
237 <field name="name">Opening Expense Account</field>228 <field name="name">Opening Expense Account</field>
238 <field ref="conf_cli" name="parent_id"/>229 <field ref="conf_cli" name="parent_id"/>
239 <field name="type">other</field>230 <field name="type">other</field>
@@ -446,8 +437,7 @@
446 <field name="property_account_expense_categ" ref="conf_a_expense"/>437 <field name="property_account_expense_categ" ref="conf_a_expense"/>
447 <field name="property_account_income_categ" ref="conf_a_sale"/>438 <field name="property_account_income_categ" ref="conf_a_sale"/>
448 <field name="property_account_income_opening" ref="conf_o_income"/>439 <field name="property_account_income_opening" ref="conf_o_income"/>
449 <field name="property_account_expense_opening" ref="conf_o_expense"/> 440 <field name="property_account_expense_opening" ref="conf_o_expense"/>
450 <field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
451 </record>441 </record>
452442
453 <!-- VAT Codes -->443 <!-- VAT Codes -->
@@ -611,7 +601,7 @@
611 <record id="conf_a_expense" model="account.account.template">601 <record id="conf_a_expense" model="account.account.template">
612 <field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/>602 <field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/>
613 </record>603 </record>
614 604
615 <record id="action_wizard_multi_chart_todo" model="ir.actions.todo">605 <record id="action_wizard_multi_chart_todo" model="ir.actions.todo">
616 <field name="name">Generate Chart of Accounts from a Chart Template</field>606 <field name="name">Generate Chart of Accounts from a Chart Template</field>
617 <field name="action_id" ref="account.action_wizard_multi_chart"/>607 <field name="action_id" ref="account.action_wizard_multi_chart"/>
618608
=== 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-21 06:38:25 +0000
@@ -205,16 +205,8 @@
205 <field name="user_type" ref="account_type_liability"/>205 <field name="user_type" ref="account_type_liability"/>
206 </record>206 </record>
207207
208 <record id="rsa" model="account.account">208 <record id="o_expense" model="account.account">
209 <field name="code">X1113</field>209 <field name="code">X1113</field>
210 <field name="name">Reserve and Profit/Loss - (test)</field>
211 <field ref="cli" name="parent_id"/>
212 <field name="type">other</field>
213 <field name="user_type" ref="account_type_liability"/>
214 </record>
215
216 <record id="o_expense" model="account.account">
217 <field name="code">X1114</field>
218 <field name="name">Opening Expense - (test)</field>210 <field name="name">Opening Expense - (test)</field>
219 <field ref="cli" name="parent_id"/>211 <field ref="cli" name="parent_id"/>
220 <field name="type">other</field>212 <field name="type">other</field>
@@ -344,14 +336,6 @@
344 <field name="company_id" ref="base.main_company"/>336 <field name="company_id" ref="base.main_company"/>
345 </record>337 </record>
346338
347 <record forcecreate="True" id="property_reserve_and_surplus_account" model="ir.property">
348 <field name="name">property_account_receivable</field>
349 <field name="fields_id" search="[('model','=','res.company'),('name','=','property_reserve_and_surplus_account')]"/>
350 <field eval="'account.account,'+str(rsa)" name="value"/>
351 <field name="company_id" ref="base.main_company"/>
352 </record>
353
354
355 <!--339 <!--
356 Account Journal340 Account Journal
357 -->341 -->
358342
=== 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-21 06:38:25 +0000
@@ -122,8 +122,9 @@
122 else:122 else:
123 self.res_bl['type'] = _('Net Loss')123 self.res_bl['type'] = _('Net Loss')
124 pl_dict = {124 pl_dict = {
125 'code': self.res_bl['type'],125 'code': self.res_bl['code'],
126 'name': self.res_bl['type'],126 'name': self.res_bl['type'],
127 'type': self.res_bl['type'],
127 'level': False,128 'level': False,
128 'balance':self.res_bl['balance'],129 'balance':self.res_bl['balance'],
129 }130 }
@@ -152,9 +153,10 @@
152 accounts_temp.append(account_dict)153 accounts_temp.append(account_dict)
153 else:154 else:
154 accounts_temp.append(account_dict)155 accounts_temp.append(account_dict)
155 if account.id == data['form']['reserve_account_id']:156
156 pl_dict['level'] = account['level'] + 1157 if typ == 'liability' and self.res_bl['balance']:
157 accounts_temp.append(pl_dict)158 pl_dict['level'] = account['level'] + 1
159 accounts_temp.append(pl_dict)
158160
159 self.result[typ] = accounts_temp161 self.result[typ] = accounts_temp
160 cal_list[typ]=self.result[typ]162 cal_list[typ]=self.result[typ]
161163
=== 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-21 06:38:25 +0000
@@ -124,12 +124,15 @@
124 accounts_temp.append(account)124 accounts_temp.append(account)
125 if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):125 if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):
126 self.res_pl['type'] = None126 self.res_pl['type'] = None
127 self.res_pl['code'] = None
127 self.res_pl['balance'] = 0.0128 self.res_pl['balance'] = 0.0
128 elif self.result_sum_dr > self.result_sum_cr:129 elif self.result_sum_dr > self.result_sum_cr:
129 self.res_pl['type'] = _('Net Loss')130 self.res_pl['type'] = _('Net Loss')
131 self.res_pl['code'] = 'NL'
130 self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)132 self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
131 else:133 else:
132 self.res_pl['type'] = _('Net Profit')134 self.res_pl['type'] = _('Net Profit')
135 self.res_pl['code'] = 'NP'
133 self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)136 self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)
134 self.result[typ] = accounts_temp137 self.result[typ] = accounts_temp
135 cal_list[typ] = self.result[typ]138 cal_list[typ] = self.result[typ]
136139
=== 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-21 06:38:25 +0000
@@ -30,44 +30,19 @@
30 _inherit = "account.common.account.report"30 _inherit = "account.common.account.report"
31 _description = 'Account Balance Sheet Report'31 _description = 'Account Balance Sheet Report'
3232
33 def _get_def_reserve_account(self, cr, uid, context=None):
34 chart_id = self._get_account(cr, uid, context=context)
35 res = self.onchange_chart_id(cr, uid, [], chart_id, context=context)
36 if not res:
37 return False
38 return res['value']['reserve_account_id']
39
40 _columns = {33 _columns = {
41 'display_type': fields.boolean("Landscape Mode"),34 'display_type': fields.boolean("Landscape Mode"),
42 'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
43 required=True,
44 help='This Account is used for transfering Profit/Loss ' \
45 '(Profit: Amount will be added, Loss: Amount will be duducted), ' \
46 'which is calculated from Profilt & Loss Report',
47 domain = [('type','=','other')]),
48 }35 }
4936
50 _defaults={37 _defaults={
51 'display_type': False,38 'display_type': False,
52 'journal_ids': [],39 'journal_ids': [],
53 'reserve_account_id': _get_def_reserve_account,
54 }40 }
5541
56 def onchange_chart_id(self, cr, uid, ids, chart_id, context=None):
57 if not chart_id:
58 return {}
59 account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context)
60 if not account.company_id.property_reserve_and_surplus_account:
61 return {'value': {'reserve_account_id': False}}
62 return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}}
63
64
65 def _print_report(self, cr, uid, ids, data, context=None):42 def _print_report(self, cr, uid, ids, data, context=None):
66 if context is None:43 if context is None:
67 context = {}44 context = {}
68 data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0])45 data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
69 if not data['form']['reserve_account_id']:
70 raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
71 data = self.pre_print_report(cr, uid, ids, data, context=context)46 data = self.pre_print_report(cr, uid, ids, data, context=context)
72 if data['form']['display_type']:47 if data['form']['display_type']:
73 return {48 return {
7449
=== 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-21 06:38:25 +0000
@@ -10,7 +10,7 @@
10 <field name="arch" type="xml">10 <field name="arch" type="xml">
11 <data>11 <data>
12 <xpath expr="//field[@name='chart_account_id']" position="replace">12 <xpath expr="//field[@name='chart_account_id']" position="replace">
13 <field name="chart_account_id" widget="selection" on_change="onchange_chart_id(chart_account_id)"/>13 <field name="chart_account_id" widget="selection"/>
14 </xpath>14 </xpath>
15 <xpath expr="//field[@name='journal_ids']" position="replace">15 <xpath expr="//field[@name='journal_ids']" position="replace">
16 <field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>16 <field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>
@@ -21,7 +21,6 @@
21 </xpath>21 </xpath>
22 <xpath expr="//field[@name='target_move']" position="after">22 <xpath expr="//field[@name='target_move']" position="after">
23 <field name="display_account"/>23 <field name="display_account"/>
24 <field name="reserve_account_id" required="1"/>
25 <field name="display_type"/>24 <field name="display_type"/>
26 <newline/>25 <newline/>
27 </xpath>26 </xpath>

Subscribers

People subscribed via source and target branches

to all changes: