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
1=== modified file 'account/account.py'
2--- account/account.py 2011-09-19 14:12:51 +0000
3+++ account/account.py 2011-09-21 06:38:25 +0000
4@@ -896,7 +896,7 @@
5 _sql_constraints = [
6 ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),
7 ]
8-
9+
10 def _check_duration(self,cr,uid,ids,context=None):
11 obj_period = self.browse(cr, uid, ids[0], context=context)
12 if obj_period.date_stop < obj_period.date_start:
13@@ -2150,7 +2150,7 @@
14 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
15 except:
16 raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))
17-
18+
19 move_id = account_move_obj.create(cr, uid, {
20 'ref': entry['name'],
21 'period_id': period_id,
22@@ -2515,7 +2515,6 @@
23 'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),
24 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
25 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
26- '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'),
27 'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'),
28 'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'),
29 }
30@@ -3112,7 +3111,6 @@
31 ('property_account_income_categ','product.category','account.account'),
32 ('property_account_expense','product.template','account.account'),
33 ('property_account_income','product.template','account.account'),
34- ('property_reserve_and_surplus_account','res.company','account.account')
35 ]
36 for record in todo_list:
37 r = []
38
39=== modified file 'account/account_view.xml'
40--- account/account_view.xml 2011-09-19 15:01:46 +0000
41+++ account/account_view.xml 2011-09-21 06:38:25 +0000
42@@ -2149,7 +2149,6 @@
43 <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
44 <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
45 <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
46- <field name="property_reserve_and_surplus_account" />
47 </group>
48 </form>
49 </field>
50
51=== modified file 'account/company.py'
52--- account/company.py 2011-08-27 21:19:48 +0000
53+++ account/company.py 2011-09-21 06:38:25 +0000
54@@ -25,14 +25,6 @@
55 _inherit = "res.company"
56 _columns = {
57 'overdue_msg': fields.text('Overdue Payments Message', translate=True),
58- 'property_reserve_and_surplus_account': fields.property(
59- 'account.account',
60- type='many2one',
61- relation='account.account',
62- string="Reserve and Profit/Loss Account",
63- view_load=True,
64- domain="[('type', '=', 'other')]",
65- 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"),
66 }
67
68 _defaults = {
69
70=== modified file 'account/company_view.xml'
71--- account/company_view.xml 2011-09-17 11:03:17 +0000
72+++ account/company_view.xml 2011-09-21 06:38:25 +0000
73@@ -16,17 +16,5 @@
74 </field>
75 </record>
76
77- <record model="ir.ui.view" id="view_company_inherit_1_form">
78- <field name="name">res.company.form.inherit</field>
79- <field name="inherit_id" ref="base.view_company_form"/>
80- <field name="model">res.company</field>
81- <field name="type">form</field>
82- <field name="arch" type="xml">
83- <field name="currency_id" position="after">
84- <field name="property_reserve_and_surplus_account" colspan="2"/>
85- </field>
86- </field>
87- </record>
88-
89 </data>
90 </openerp>
91
92=== modified file 'account/configurable_account_chart.xml'
93--- account/configurable_account_chart.xml 2011-08-04 12:09:57 +0000
94+++ account/configurable_account_chart.xml 2011-09-21 06:38:25 +0000
95@@ -223,17 +223,8 @@
96 <field name="user_type" ref="conf_account_type_liability"/>
97 </record>
98
99- <record id="conf_a_reserve_and_surplus" model="account.account.template">
100+ <record id="conf_o_expense" model="account.account.template">
101 <field name="code">1113</field>
102- <field name="name">Reserve and Profit/Loss Account</field>
103- <field ref="conf_cli" name="parent_id"/>
104- <field name="type">other</field>
105- <field eval="True" name="reconcile"/>
106- <field name="user_type" ref="conf_account_type_liability"/>
107- </record>
108-
109- <record id="conf_o_expense" model="account.account.template">
110- <field name="code">1114</field>
111 <field name="name">Opening Expense Account</field>
112 <field ref="conf_cli" name="parent_id"/>
113 <field name="type">other</field>
114@@ -446,8 +437,7 @@
115 <field name="property_account_expense_categ" ref="conf_a_expense"/>
116 <field name="property_account_income_categ" ref="conf_a_sale"/>
117 <field name="property_account_income_opening" ref="conf_o_income"/>
118- <field name="property_account_expense_opening" ref="conf_o_expense"/>
119- <field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
120+ <field name="property_account_expense_opening" ref="conf_o_expense"/>
121 </record>
122
123 <!-- VAT Codes -->
124@@ -611,7 +601,7 @@
125 <record id="conf_a_expense" model="account.account.template">
126 <field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/>
127 </record>
128-
129+
130 <record id="action_wizard_multi_chart_todo" model="ir.actions.todo">
131 <field name="name">Generate Chart of Accounts from a Chart Template</field>
132 <field name="action_id" ref="account.action_wizard_multi_chart"/>
133
134=== modified file 'account/demo/account_minimal.xml'
135--- account/demo/account_minimal.xml 2011-03-03 14:59:00 +0000
136+++ account/demo/account_minimal.xml 2011-09-21 06:38:25 +0000
137@@ -205,16 +205,8 @@
138 <field name="user_type" ref="account_type_liability"/>
139 </record>
140
141- <record id="rsa" model="account.account">
142+ <record id="o_expense" model="account.account">
143 <field name="code">X1113</field>
144- <field name="name">Reserve and Profit/Loss - (test)</field>
145- <field ref="cli" name="parent_id"/>
146- <field name="type">other</field>
147- <field name="user_type" ref="account_type_liability"/>
148- </record>
149-
150- <record id="o_expense" model="account.account">
151- <field name="code">X1114</field>
152 <field name="name">Opening Expense - (test)</field>
153 <field ref="cli" name="parent_id"/>
154 <field name="type">other</field>
155@@ -344,14 +336,6 @@
156 <field name="company_id" ref="base.main_company"/>
157 </record>
158
159- <record forcecreate="True" id="property_reserve_and_surplus_account" model="ir.property">
160- <field name="name">property_account_receivable</field>
161- <field name="fields_id" search="[('model','=','res.company'),('name','=','property_reserve_and_surplus_account')]"/>
162- <field eval="'account.account,'+str(rsa)" name="value"/>
163- <field name="company_id" ref="base.main_company"/>
164- </record>
165-
166-
167 <!--
168 Account Journal
169 -->
170
171=== modified file 'account/report/account_balance_sheet.py'
172--- account/report/account_balance_sheet.py 2011-06-10 16:45:54 +0000
173+++ account/report/account_balance_sheet.py 2011-09-21 06:38:25 +0000
174@@ -122,8 +122,9 @@
175 else:
176 self.res_bl['type'] = _('Net Loss')
177 pl_dict = {
178- 'code': self.res_bl['type'],
179+ 'code': self.res_bl['code'],
180 'name': self.res_bl['type'],
181+ 'type': self.res_bl['type'],
182 'level': False,
183 'balance':self.res_bl['balance'],
184 }
185@@ -152,9 +153,10 @@
186 accounts_temp.append(account_dict)
187 else:
188 accounts_temp.append(account_dict)
189- if account.id == data['form']['reserve_account_id']:
190- pl_dict['level'] = account['level'] + 1
191- accounts_temp.append(pl_dict)
192+
193+ if typ == 'liability' and self.res_bl['balance']:
194+ pl_dict['level'] = account['level'] + 1
195+ accounts_temp.append(pl_dict)
196
197 self.result[typ] = accounts_temp
198 cal_list[typ]=self.result[typ]
199
200=== modified file 'account/report/account_profit_loss.py'
201--- account/report/account_profit_loss.py 2011-06-16 09:53:39 +0000
202+++ account/report/account_profit_loss.py 2011-09-21 06:38:25 +0000
203@@ -124,12 +124,15 @@
204 accounts_temp.append(account)
205 if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):
206 self.res_pl['type'] = None
207+ self.res_pl['code'] = None
208 self.res_pl['balance'] = 0.0
209 elif self.result_sum_dr > self.result_sum_cr:
210 self.res_pl['type'] = _('Net Loss')
211+ self.res_pl['code'] = 'NL'
212 self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
213 else:
214 self.res_pl['type'] = _('Net Profit')
215+ self.res_pl['code'] = 'NP'
216 self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)
217 self.result[typ] = accounts_temp
218 cal_list[typ] = self.result[typ]
219
220=== modified file 'account/wizard/account_report_balance_sheet.py'
221--- account/wizard/account_report_balance_sheet.py 2011-06-08 10:04:27 +0000
222+++ account/wizard/account_report_balance_sheet.py 2011-09-21 06:38:25 +0000
223@@ -30,44 +30,19 @@
224 _inherit = "account.common.account.report"
225 _description = 'Account Balance Sheet Report'
226
227- def _get_def_reserve_account(self, cr, uid, context=None):
228- chart_id = self._get_account(cr, uid, context=context)
229- res = self.onchange_chart_id(cr, uid, [], chart_id, context=context)
230- if not res:
231- return False
232- return res['value']['reserve_account_id']
233-
234 _columns = {
235 'display_type': fields.boolean("Landscape Mode"),
236- 'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
237- required=True,
238- help='This Account is used for transfering Profit/Loss ' \
239- '(Profit: Amount will be added, Loss: Amount will be duducted), ' \
240- 'which is calculated from Profilt & Loss Report',
241- domain = [('type','=','other')]),
242 }
243
244 _defaults={
245 'display_type': False,
246 'journal_ids': [],
247- 'reserve_account_id': _get_def_reserve_account,
248 }
249
250- def onchange_chart_id(self, cr, uid, ids, chart_id, context=None):
251- if not chart_id:
252- return {}
253- account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context)
254- if not account.company_id.property_reserve_and_surplus_account:
255- return {'value': {'reserve_account_id': False}}
256- return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}}
257-
258-
259 def _print_report(self, cr, uid, ids, data, context=None):
260 if context is None:
261 context = {}
262- data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0])
263- if not data['form']['reserve_account_id']:
264- raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
265+ data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
266 data = self.pre_print_report(cr, uid, ids, data, context=context)
267 if data['form']['display_type']:
268 return {
269
270=== modified file 'account/wizard/account_report_balance_sheet_view.xml'
271--- account/wizard/account_report_balance_sheet_view.xml 2011-01-14 00:11:01 +0000
272+++ account/wizard/account_report_balance_sheet_view.xml 2011-09-21 06:38:25 +0000
273@@ -10,7 +10,7 @@
274 <field name="arch" type="xml">
275 <data>
276 <xpath expr="//field[@name='chart_account_id']" position="replace">
277- <field name="chart_account_id" widget="selection" on_change="onchange_chart_id(chart_account_id)"/>
278+ <field name="chart_account_id" widget="selection"/>
279 </xpath>
280 <xpath expr="//field[@name='journal_ids']" position="replace">
281 <field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>
282@@ -21,7 +21,6 @@
283 </xpath>
284 <xpath expr="//field[@name='target_move']" position="after">
285 <field name="display_account"/>
286- <field name="reserve_account_id" required="1"/>
287 <field name="display_type"/>
288 <newline/>
289 </xpath>

Subscribers

People subscribed via source and target branches

to all changes: