Merge lp:~vauxoo/account-financial-report/miguel-bug-918857 into lp:~vauxoo/account-financial-report/trunk
- miguel-bug-918857
- Merge into trunk
Proposed by
Miguel Delgado (Vauxoo)
Status: | Merged |
---|---|
Merged at revision: | 6 |
Proposed branch: | lp:~vauxoo/account-financial-report/miguel-bug-918857 |
Merge into: | lp:~vauxoo/account-financial-report/trunk |
Diff against target: |
1247 lines (+392/-247) 10 files modified
account_financial_report/report/account_balance.py (+24/-21) account_financial_report/report/account_balance_2_cols.py (+99/-57) account_financial_report/report/account_balance_4_cols.py (+29/-26) account_financial_report/report/balance_full.rml (+11/-22) account_financial_report/report/balance_full_2_cols.rml (+14/-38) account_financial_report/report/balance_full_4_cols.rml (+11/-16) account_financial_report/wizard/account_report_wizard.xml (+12/-12) account_financial_report/wizard/wizard_account_balance_2_report.py (+55/-19) account_financial_report/wizard/wizard_account_balance_4_report.py (+83/-18) account_financial_report/wizard/wizard_account_balance_report.py (+54/-18) |
To merge this branch: | bzr merge lp:~vauxoo/account-financial-report/miguel-bug-918857 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gabriela Quilarque | Pending | ||
Review via email: mp+89508@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_financial_report/report/account_balance.py' | |||
2 | --- account_financial_report/report/account_balance.py 2012-01-02 22:27:49 +0000 | |||
3 | +++ account_financial_report/report/account_balance.py 2012-01-20 23:38:23 +0000 | |||
4 | @@ -53,8 +53,8 @@ | |||
5 | 53 | 'lines': self.lines, | 53 | 'lines': self.lines, |
6 | 54 | 'get_fiscalyear_text': self.get_fiscalyear_text, | 54 | 'get_fiscalyear_text': self.get_fiscalyear_text, |
7 | 55 | 'get_periods_and_date_text': self.get_periods_and_date_text, | 55 | 'get_periods_and_date_text': self.get_periods_and_date_text, |
10 | 56 | 'get_inf_text': self.get_informe_text, | 56 | 'get_informe_text': self.get_informe_text, |
11 | 57 | 'get_month':self._get_month, | 57 | 'get_month':self.get_month, |
12 | 58 | }) | 58 | }) |
13 | 59 | self.context = context | 59 | self.context = context |
14 | 60 | 60 | ||
15 | @@ -72,21 +72,25 @@ | |||
16 | 72 | fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) | 72 | fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, fiscalyear_obj.find(self.cr, self.uid)) |
17 | 73 | return "%s*" % (fiscalyear.name or fiscalyear.code) | 73 | return "%s*" % (fiscalyear.name or fiscalyear.code) |
18 | 74 | 74 | ||
20 | 75 | def _get_month(self, form): | 75 | def get_month(self, form): |
21 | 76 | ''' | 76 | ''' |
22 | 77 | return day, year and month | 77 | return day, year and month |
23 | 78 | ''' | 78 | ''' |
35 | 79 | 79 | if form['filter'] in ['bydate', 'all']: | |
36 | 80 | months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"] | 80 | months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"] |
37 | 81 | 81 | mes = months[time.strptime(form['date_to'],"%Y-%m-%d")[1]-1] | |
38 | 82 | mes = months[time.strptime(form['date_to'],"%Y-%m-%d")[1]-1] | 82 | ano = time.strptime(form['date_to'],"%Y-%m-%d")[0] |
39 | 83 | ano = time.strptime(form['date_to'],"%Y-%m-%d")[0] | 83 | dia = time.strptime(form['date_to'],"%Y-%m-%d")[2] |
40 | 84 | dia = time.strptime(form['date_to'],"%Y-%m-%d")[2] | 84 | return 'Período del '+self.formatLang(form['date_from'], date=True)+' al '+self.formatLang(form['date_to'], date=True) |
41 | 85 | 85 | elif form['filter'] in ['byperiod', 'all']: | |
42 | 86 | if form['inf_type']=='edogp': | 86 | aux=[] |
43 | 87 | return 'DESDE: '+self.formatLang(form['date_from'], date=True)+' HASTA: '+self.formatLang(form['date_to'], date=True) | 87 | period_obj = self.pool.get('account.period') |
44 | 88 | else: | 88 | |
45 | 89 | return 'AL '+str(dia) + ' DE ' + mes.upper() + ' DE ' + str(ano) | 89 | for period in period_obj.browse(self.cr, self.uid, form['periods']): |
46 | 90 | aux.append(period.date_start) | ||
47 | 91 | aux.append(period.date_stop) | ||
48 | 92 | sorted(aux) | ||
49 | 93 | return 'Período del '+self.formatLang(aux[0], date=True)+' al '+self.formatLang(aux[-1], date=True) | ||
50 | 90 | 94 | ||
51 | 91 | def get_informe_text(self, form): | 95 | def get_informe_text(self, form): |
52 | 92 | """ | 96 | """ |
53 | @@ -107,12 +111,12 @@ | |||
54 | 107 | periods_str = None | 111 | periods_str = None |
55 | 108 | fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) | 112 | fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
56 | 109 | period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) | 113 | period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
58 | 110 | if form['state'] in ['byperiod', 'all']: | 114 | if form['filter'] in ['byperiod', 'all']: |
59 | 111 | period_ids = form['periods'] | 115 | period_ids = form['periods'] |
60 | 112 | periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) | 116 | periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
61 | 113 | 117 | ||
62 | 114 | dates_str = None | 118 | dates_str = None |
64 | 115 | if form['state'] in ['bydate', 'all']: | 119 | if form['filter'] in ['bydate', 'all']: |
65 | 116 | dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' | 120 | dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
66 | 117 | 121 | ||
67 | 118 | return {'periods':periods_str, 'date':dates_str} | 122 | return {'periods':periods_str, 'date':dates_str} |
68 | @@ -184,13 +188,12 @@ | |||
69 | 184 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)]) | 188 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)]) |
70 | 185 | else: | 189 | else: |
71 | 186 | # Use all the open fiscal years | 190 | # Use all the open fiscal years |
73 | 187 | open_fiscalyear_ids = fiscalyear_obj.search(self.cr, self.uid, [('state','=','draft')]) | 191 | open_fiscalyear_ids = fiscalyear_obj.search(self.cr, self.uid, [('filter','=','draft')]) |
74 | 188 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','in',open_fiscalyear_ids),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)]) | 192 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','in',open_fiscalyear_ids),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)]) |
75 | 189 | 193 | ||
76 | 190 | fy_balance = {} | 194 | fy_balance = {} |
77 | 191 | for acc in account_obj.read(self.cr, self.uid, [x[0] for x in account_ids], ['balance'], ctx): | 195 | for acc in account_obj.read(self.cr, self.uid, [x[0] for x in account_ids], ['balance'], ctx): |
78 | 192 | fy_balance[acc['id']] = acc['balance'] | 196 | fy_balance[acc['id']] = acc['balance'] |
79 | 193 | |||
80 | 194 | # | 197 | # |
81 | 195 | # Calculate the FY Debit/Credit | 198 | # Calculate the FY Debit/Credit |
82 | 196 | # (from full fiscal year without opening or closing periods) | 199 | # (from full fiscal year without opening or closing periods) |
83 | @@ -204,12 +207,12 @@ | |||
84 | 204 | # (from the selected period or all the non special periods in the fy) | 207 | # (from the selected period or all the non special periods in the fy) |
85 | 205 | # | 208 | # |
86 | 206 | ctx = self.context.copy() | 209 | ctx = self.context.copy() |
88 | 207 | ctx['state'] = form.get('state','all') | 210 | ctx['filter'] = form.get('filter','all') |
89 | 208 | ctx['fiscalyear'] = fiscalyear.id | 211 | ctx['fiscalyear'] = fiscalyear.id |
90 | 209 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id)]) | 212 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id)]) |
92 | 210 | if form['state'] in ['byperiod', 'all']: | 213 | if form['filter'] in ['byperiod', 'all']: |
93 | 211 | ctx['periods'] = form['periods'] | 214 | ctx['periods'] = form['periods'] |
95 | 212 | if form['state'] in ['bydate', 'all']: | 215 | if form['filter'] in ['bydate', 'all']: |
96 | 213 | ctx['date_from'] = form['date_from'] | 216 | ctx['date_from'] = form['date_from'] |
97 | 214 | ctx['date_to'] = form['date_to'] | 217 | ctx['date_to'] = form['date_to'] |
98 | 215 | 218 | ||
99 | 216 | 219 | ||
100 | === modified file 'account_financial_report/report/account_balance_2_cols.py' | |||
101 | --- account_financial_report/report/account_balance_2_cols.py 2012-01-02 22:36:00 +0000 | |||
102 | +++ account_financial_report/report/account_balance_2_cols.py 2012-01-20 23:38:23 +0000 | |||
103 | @@ -53,8 +53,8 @@ | |||
104 | 53 | 'lines': self.lines, | 53 | 'lines': self.lines, |
105 | 54 | 'get_fiscalyear_text': self.get_fiscalyear_text, | 54 | 'get_fiscalyear_text': self.get_fiscalyear_text, |
106 | 55 | 'get_periods_and_date_text': self.get_periods_and_date_text, | 55 | 'get_periods_and_date_text': self.get_periods_and_date_text, |
109 | 56 | 'get_inf_text': self.get_informe_text, | 56 | 'get_informe_text': self.get_informe_text, |
110 | 57 | 'get_month':self._get_month, | 57 | 'get_month':self.get_month, |
111 | 58 | }) | 58 | }) |
112 | 59 | self.context = context | 59 | self.context = context |
113 | 60 | 60 | ||
114 | @@ -78,27 +78,30 @@ | |||
115 | 78 | """ | 78 | """ |
116 | 79 | inf_type = { | 79 | inf_type = { |
117 | 80 | 'bgen' : ' Balance General', | 80 | 'bgen' : ' Balance General', |
121 | 81 | 'bcom' : ' Balance de Comprobacion', | 81 | 'bcom' : ' Balance de Comprobacion', |
122 | 82 | 'edogp': 'Estado de Ganancias y Perdidas', | 82 | 'edogp': 'Estado de Ganancias y Perdidas' |
120 | 83 | 'bdl': 'Libro Diario Legal', | ||
123 | 84 | } | 83 | } |
124 | 85 | return inf_type[form['inf_type']] | 84 | return inf_type[form['inf_type']] |
125 | 86 | 85 | ||
127 | 87 | def _get_month(self, form): | 86 | def get_month(self, form): |
128 | 88 | ''' | 87 | ''' |
129 | 89 | return day, year and month | 88 | return day, year and month |
130 | 90 | ''' | 89 | ''' |
142 | 91 | 90 | if form['filter'] in ['bydate', 'all']: | |
143 | 92 | months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"] | 91 | months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"] |
144 | 93 | 92 | mes = months[time.strptime(form['date_to'],"%Y-%m-%d")[1]-1] | |
145 | 94 | mes = months[time.strptime(form['date_to'],"%Y-%m-%d")[1]-1] | 93 | ano = time.strptime(form['date_to'],"%Y-%m-%d")[0] |
146 | 95 | ano = time.strptime(form['date_to'],"%Y-%m-%d")[0] | 94 | dia = time.strptime(form['date_to'],"%Y-%m-%d")[2] |
147 | 96 | dia = time.strptime(form['date_to'],"%Y-%m-%d")[2] | 95 | return 'Período del '+self.formatLang(form['date_from'], date=True)+' al '+self.formatLang(form['date_to'], date=True) |
148 | 97 | 96 | elif form['filter'] in ['byperiod', 'all']: | |
149 | 98 | if form['inf_type']=='edogp': | 97 | aux=[] |
150 | 99 | return 'DESDE: '+self.formatLang(form['date_from'], date=True)+' HASTA: '+self.formatLang(form['date_to'], date=True) | 98 | period_obj = self.pool.get('account.period') |
151 | 100 | else: | 99 | |
152 | 101 | return 'AL '+str(dia) + ' DE ' + mes.upper() + ' DE ' + str(ano) | 100 | for period in period_obj.browse(self.cr, self.uid, form['periods']): |
153 | 101 | aux.append(period.date_start) | ||
154 | 102 | aux.append(period.date_stop) | ||
155 | 103 | sorted(aux) | ||
156 | 104 | return 'Período del '+self.formatLang(aux[0], date=True)+' al '+self.formatLang(aux[-1], date=True) | ||
157 | 102 | 105 | ||
158 | 103 | def get_periods_and_date_text(self, form): | 106 | def get_periods_and_date_text(self, form): |
159 | 104 | """ | 107 | """ |
160 | @@ -108,14 +111,13 @@ | |||
161 | 108 | periods_str = None | 111 | periods_str = None |
162 | 109 | fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) | 112 | fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
163 | 110 | period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) | 113 | period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
165 | 111 | if form['state'] in ['byperiod', 'all']: | 114 | if form['filter'] in ['byperiod', 'all']: |
166 | 112 | period_ids = form['periods'] | 115 | period_ids = form['periods'] |
167 | 113 | periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) | 116 | periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
168 | 114 | 117 | ||
169 | 115 | dates_str = None | 118 | dates_str = None |
171 | 116 | if form['state'] in ['bydate', 'all']: | 119 | if form['filter'] in ['bydate', 'all']: |
172 | 117 | dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' | 120 | dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
173 | 118 | |||
174 | 119 | return {'periods':periods_str, 'date':dates_str} | 121 | return {'periods':periods_str, 'date':dates_str} |
175 | 120 | 122 | ||
176 | 121 | 123 | ||
177 | @@ -125,14 +127,17 @@ | |||
178 | 125 | (account info plus debit/credit/balance in the selected period | 127 | (account info plus debit/credit/balance in the selected period |
179 | 126 | and the full year) | 128 | and the full year) |
180 | 127 | """ | 129 | """ |
181 | 130 | tot_bin = 0.0 | ||
182 | 128 | tot_deb = 0.0 | 131 | tot_deb = 0.0 |
183 | 129 | tot_crd = 0.0 | 132 | tot_crd = 0.0 |
184 | 133 | tot_eje = 0.0 | ||
185 | 130 | if not ids: | 134 | if not ids: |
186 | 131 | ids = self.ids | 135 | ids = self.ids |
187 | 132 | if not ids: | 136 | if not ids: |
188 | 133 | return [] | 137 | return [] |
189 | 134 | if not done: | 138 | if not done: |
190 | 135 | done = {} | 139 | done = {} |
191 | 140 | |||
192 | 136 | if form.has_key('account_list') and form['account_list']: | 141 | if form.has_key('account_list') and form['account_list']: |
193 | 137 | account_ids = form['account_list'] | 142 | account_ids = form['account_list'] |
194 | 138 | del form['account_list'] | 143 | del form['account_list'] |
195 | @@ -143,7 +148,6 @@ | |||
196 | 143 | period_obj = self.pool.get('account.period') | 148 | period_obj = self.pool.get('account.period') |
197 | 144 | fiscalyear_obj = self.pool.get('account.fiscalyear') | 149 | fiscalyear_obj = self.pool.get('account.fiscalyear') |
198 | 145 | 150 | ||
199 | 146 | # Get the fiscal year | ||
200 | 147 | fiscalyear = None | 151 | fiscalyear = None |
201 | 148 | if form.get('fiscalyear'): | 152 | if form.get('fiscalyear'): |
202 | 149 | fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) | 153 | fiscalyear = fiscalyear_obj.browse(self.cr, self.uid, form['fiscalyear']) |
203 | @@ -153,6 +157,7 @@ | |||
204 | 153 | # | 157 | # |
205 | 154 | # Get the accounts | 158 | # Get the accounts |
206 | 155 | # | 159 | # |
207 | 160 | |||
208 | 156 | def _get_children_and_consol(cr, uid, ids, level, context={}): | 161 | def _get_children_and_consol(cr, uid, ids, level, context={}): |
209 | 157 | aa_obj = self.pool.get('account.account') | 162 | aa_obj = self.pool.get('account.account') |
210 | 158 | ids2=[] | 163 | ids2=[] |
211 | @@ -173,38 +178,42 @@ | |||
212 | 173 | child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) | 178 | child_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form['display_account_level'] and form['display_account_level'] or 100,self.context) |
213 | 174 | if child_ids: | 179 | if child_ids: |
214 | 175 | account_ids = child_ids | 180 | account_ids = child_ids |
215 | 181 | |||
216 | 182 | account_obj = self.pool.get('account.account') | ||
217 | 183 | period_obj = self.pool.get('account.period') | ||
218 | 184 | fiscalyear_obj = self.pool.get('account.fiscalyear') | ||
219 | 176 | 185 | ||
224 | 177 | # | 186 | ############################################################################# |
225 | 178 | # Calculate the period Debit/Credit | 187 | # Calculate the period Debit/Credit # |
226 | 179 | # (from the selected period or all the non special periods in the fy) | 188 | # (from the selected period or all the non special periods in the fy) # |
227 | 180 | # | 189 | ############################################################################# |
228 | 181 | 190 | ||
229 | 182 | ctx = self.context.copy() | 191 | ctx = self.context.copy() |
231 | 183 | ctx['state'] = form.get('state','all') | 192 | ctx['filter'] = form.get('filter','all') |
232 | 184 | ctx['fiscalyear'] = fiscalyear.id | 193 | ctx['fiscalyear'] = fiscalyear.id |
238 | 185 | ctx['periods'] = form.get('periods') | 194 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) |
239 | 186 | if form['state'] in ['byperiod', 'all']: | 195 | if form['filter'] in ['byperiod', 'all']: |
240 | 187 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) | 196 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) |
241 | 188 | ctx['periods'] = ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) | 197 | if form['filter'] in ['bydate', 'all']: |
237 | 189 | if form['state'] in ['bydate', 'all']: | ||
242 | 190 | ctx['date_from'] = form['date_from'] | 198 | ctx['date_from'] = form['date_from'] |
243 | 191 | ctx['date_to'] = form['date_to'] | 199 | ctx['date_to'] = form['date_to'] |
244 | 192 | 200 | ||
245 | 193 | accounts=[] | 201 | accounts=[] |
246 | 202 | |||
247 | 194 | val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) | 203 | val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) |
248 | 195 | c = 0 | 204 | c = 0 |
249 | 196 | for aa_id in account_ids: | 205 | for aa_id in account_ids: |
250 | 197 | new_acc = { | 206 | new_acc = { |
261 | 198 | 'id' :val[c].id, | 207 | 'id' :val[c].id, |
262 | 199 | 'type' :val[c].type, | 208 | 'type' :val[c].type, |
263 | 200 | 'code' :val[c].code, | 209 | 'code' :val[c].code, |
264 | 201 | 'name' :val[c].name, | 210 | 'name' :val[c].name, |
265 | 202 | 'debit' :val[c].debit, | 211 | 'debit' :val[c].debit, |
266 | 203 | 'credit' :val[c].credit, | 212 | 'credit' :val[c].credit, |
267 | 204 | 'parent_id' :val[c].parent_id and val[c].parent_id.id, | 213 | 'parent_id' :val[c].parent_id and val[c].parent_id.id, |
268 | 205 | 'level' :val[c].level, | 214 | 'level' :val[c].level, |
269 | 206 | 'label' :aa_id[1], | 215 | 'label' :aa_id[1], |
270 | 207 | 'total' :aa_id[2], | 216 | 'total' :aa_id[2], |
271 | 208 | } | 217 | } |
272 | 209 | c += 1 | 218 | c += 1 |
273 | 210 | accounts.append(new_acc) | 219 | accounts.append(new_acc) |
274 | @@ -214,11 +223,38 @@ | |||
275 | 214 | fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] | 223 | fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or [] |
276 | 215 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) | 224 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',ctx['fiscalyear']),('date_stop','<',fiscalyear.date_start)]) |
277 | 216 | 225 | ||
278 | 226 | ############################################################################# | ||
279 | 227 | # Calculate the period initial Balance # | ||
280 | 228 | # (fy balance minus the balance from the start of the selected period # | ||
281 | 229 | # to the end of the year) # | ||
282 | 230 | ############################################################################# | ||
283 | 231 | |||
284 | 232 | ctx = self.context.copy() | ||
285 | 233 | ctx['filter'] = form.get('filter','all') | ||
286 | 234 | ctx['fiscalyear'] = fiscalyear.id | ||
287 | 235 | |||
288 | 236 | if form['filter'] in ['byperiod', 'all']: | ||
289 | 237 | ctx['periods'] = form['periods'] | ||
290 | 238 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) | ||
291 | 239 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) | ||
292 | 240 | if not ctx['periods']: | ||
293 | 241 | missing_period() | ||
294 | 242 | elif form['filter'] in ['bydate']: | ||
295 | 243 | ctx['date_from'] = fiscalyear.date_start | ||
296 | 244 | ctx['date_to'] = form['date_from'] | ||
297 | 245 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) | ||
298 | 246 | elif form['filter'] == 'none': | ||
299 | 247 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) | ||
300 | 248 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) | ||
301 | 249 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) | ||
302 | 250 | |||
303 | 251 | period_balanceinit = {} | ||
304 | 252 | for acc in account_obj.browse(self.cr, self.uid, [x[0] for x in account_ids], ctx): | ||
305 | 253 | period_balanceinit[acc['id']] = acc.balance | ||
306 | 217 | 254 | ||
307 | 218 | # | 255 | # |
308 | 219 | # Generate the report lines (checking each account) | 256 | # Generate the report lines (checking each account) |
309 | 220 | # | 257 | # |
310 | 221 | |||
311 | 222 | tot = {} | 258 | tot = {} |
312 | 223 | for account in accounts: | 259 | for account in accounts: |
313 | 224 | account_id = account['id'] | 260 | account_id = account['id'] |
314 | @@ -233,26 +269,31 @@ | |||
315 | 233 | # | 269 | # |
316 | 234 | # Check if we need to include this level | 270 | # Check if we need to include this level |
317 | 235 | # | 271 | # |
318 | 236 | |||
319 | 237 | if not form['display_account_level'] or account['level'] <= form['display_account_level']: | 272 | if not form['display_account_level'] or account['level'] <= form['display_account_level']: |
320 | 238 | |||
321 | 239 | # | 273 | # |
322 | 240 | # Copy the account values | 274 | # Copy the account values |
323 | 241 | # | 275 | # |
324 | 242 | |||
325 | 243 | res = { | 276 | res = { |
326 | 244 | 'id' : account_id, | 277 | 'id' : account_id, |
327 | 245 | 'type' : account['type'], | 278 | 'type' : account['type'], |
328 | 246 | 'code': account['code'], | 279 | 'code': account['code'], |
329 | 247 | 'name': (account['total'] and not account['label']) and 'TOTAL %s'%(account['name'].upper()) or account['name'], | 280 | 'name': (account['total'] and not account['label']) and 'TOTAL %s'%(account['name'].upper()) or account['name'], |
330 | 248 | 'level': account['level'], | 281 | 'level': account['level'], |
331 | 282 | 'balanceinit': period_balanceinit[account_id], | ||
332 | 249 | 'debit': account['debit'], | 283 | 'debit': account['debit'], |
333 | 250 | 'credit': account['credit'], | 284 | 'credit': account['credit'], |
334 | 285 | 'balance': period_balanceinit[account_id]+account['debit']-account['credit'], | ||
335 | 251 | 'parent_id': account['parent_id'], | 286 | 'parent_id': account['parent_id'], |
336 | 252 | 'bal_type': '', | 287 | 'bal_type': '', |
337 | 253 | 'label': account['label'], | 288 | 'label': account['label'], |
338 | 254 | 'total': account['total'], | 289 | 'total': account['total'], |
339 | 255 | } | 290 | } |
340 | 291 | # | ||
341 | 292 | # Round the values to zero if needed (-0.000001 ~= 0) | ||
342 | 293 | # | ||
343 | 294 | |||
344 | 295 | if abs(res['balance']) < 0.5 * 10**-4: | ||
345 | 296 | res['balance'] = 0.0 | ||
346 | 256 | 297 | ||
347 | 257 | # | 298 | # |
348 | 258 | # Check whether we must include this line in the report or not | 299 | # Check whether we must include this line in the report or not |
349 | @@ -260,30 +301,31 @@ | |||
350 | 260 | 301 | ||
351 | 261 | if form['display_account'] == 'bal_mouvement' and account['parent_id']: | 302 | if form['display_account'] == 'bal_mouvement' and account['parent_id']: |
352 | 262 | # Include accounts with movements | 303 | # Include accounts with movements |
365 | 263 | if abs(res['credit']-res['debit']) >= 0.5 * 10**-int(2) \ | 304 | if abs(res['balance']) >= 0.5 * 10**-int(2): |
366 | 264 | or abs(res['credit']) >= 0.5 * 10**-int(2) \ | 305 | result_acc.append(res) |
367 | 265 | or abs(res['debit']) >= 0.5 * 10**-int(2): | 306 | elif form['display_account'] == 'bal_solde' and account['parent_id']: |
368 | 266 | result_acc.append(res) | 307 | # Include accounts with balance |
369 | 267 | elif form['display_account'] == 'bal_solde' and account['parent_id']: | 308 | if abs(res['balance']) >= 0.5 * 10**-4: |
370 | 268 | # Include accounts with balance | 309 | result_acc.append(res) |
371 | 269 | if abs(res['credit']-res['debit']) >= 0.5 * 10**-int(2): | 310 | else: |
372 | 270 | result_acc.append(res) | 311 | # Include all accounts |
373 | 271 | else: | 312 | result_acc.append(res) |
362 | 272 | # Include all account | ||
363 | 273 | result_acc.append(res) | ||
364 | 274 | |||
374 | 275 | if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): | 313 | if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): |
375 | 276 | tot[res['id']] = True | 314 | tot[res['id']] = True |
376 | 315 | tot_bin += res['balanceinit'] | ||
377 | 277 | tot_deb += res['debit'] | 316 | tot_deb += res['debit'] |
378 | 278 | tot_crd += res['credit'] | 317 | tot_crd += res['credit'] |
379 | 318 | tot_eje += res['balance'] | ||
380 | 279 | 319 | ||
381 | 280 | if form['tot_check']: | 320 | if form['tot_check']: |
382 | 281 | str_label = form['lab_str'] | 321 | str_label = form['lab_str'] |
383 | 282 | res2 = { | 322 | res2 = { |
384 | 283 | 'type' : 'view', | 323 | 'type' : 'view', |
385 | 284 | 'name': 'TOTAL %s'%(str_label), | 324 | 'name': 'TOTAL %s'%(str_label), |
386 | 325 | 'balanceinit': tot_bin, | ||
387 | 285 | 'debit': tot_deb, | 326 | 'debit': tot_deb, |
388 | 286 | 'credit': tot_crd, | 327 | 'credit': tot_crd, |
389 | 328 | 'balance': tot_eje, | ||
390 | 287 | 'label': False, | 329 | 'label': False, |
391 | 288 | 'total': True, | 330 | 'total': True, |
392 | 289 | } | 331 | } |
393 | 290 | 332 | ||
394 | === modified file 'account_financial_report/report/account_balance_4_cols.py' | |||
395 | --- account_financial_report/report/account_balance_4_cols.py 2012-01-02 22:27:49 +0000 | |||
396 | +++ account_financial_report/report/account_balance_4_cols.py 2012-01-20 23:38:23 +0000 | |||
397 | @@ -53,8 +53,8 @@ | |||
398 | 53 | 'lines': self.lines, | 53 | 'lines': self.lines, |
399 | 54 | 'get_fiscalyear_text': self.get_fiscalyear_text, | 54 | 'get_fiscalyear_text': self.get_fiscalyear_text, |
400 | 55 | 'get_periods_and_date_text': self.get_periods_and_date_text, | 55 | 'get_periods_and_date_text': self.get_periods_and_date_text, |
403 | 56 | 'get_inf_text': self.get_informe_text, | 56 | 'get_informe_text': self.get_informe_text, |
404 | 57 | 'get_month':self._get_month, | 57 | 'get_month':self.get_month, |
405 | 58 | }) | 58 | }) |
406 | 59 | self.context = context | 59 | self.context = context |
407 | 60 | 60 | ||
408 | @@ -78,27 +78,30 @@ | |||
409 | 78 | """ | 78 | """ |
410 | 79 | inf_type = { | 79 | inf_type = { |
411 | 80 | 'bgen' : ' Balance General', | 80 | 'bgen' : ' Balance General', |
415 | 81 | 'bcom' : ' Balance de Comprobacion', | 81 | 'bcom' : ' Balance de Comprobacion', |
416 | 82 | 'edogp': 'Estado de Ganancias y Perdidas', | 82 | 'edogp': 'Estado de Ganancias y Perdidas' |
414 | 83 | 'bml': 'Libro Mayor Legal', | ||
417 | 84 | } | 83 | } |
418 | 85 | return inf_type[form['inf_type']] | 84 | return inf_type[form['inf_type']] |
419 | 86 | 85 | ||
421 | 87 | def _get_month(self, form): | 86 | def get_month(self, form): |
422 | 88 | ''' | 87 | ''' |
423 | 89 | return day, year and month | 88 | return day, year and month |
424 | 90 | ''' | 89 | ''' |
436 | 91 | 90 | if form['filter'] in ['bydate', 'all']: | |
437 | 92 | months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"] | 91 | months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"] |
438 | 93 | 92 | mes = months[time.strptime(form['date_to'],"%Y-%m-%d")[1]-1] | |
439 | 94 | mes = months[time.strptime(form['date_to'],"%Y-%m-%d")[1]-1] | 93 | ano = time.strptime(form['date_to'],"%Y-%m-%d")[0] |
440 | 95 | ano = time.strptime(form['date_to'],"%Y-%m-%d")[0] | 94 | dia = time.strptime(form['date_to'],"%Y-%m-%d")[2] |
441 | 96 | dia = time.strptime(form['date_to'],"%Y-%m-%d")[2] | 95 | return 'Período del '+self.formatLang(form['date_from'], date=True)+' al '+self.formatLang(form['date_to'], date=True) |
442 | 97 | 96 | elif form['filter'] in ['byperiod', 'all']: | |
443 | 98 | if form['inf_type']=='edogp': | 97 | aux=[] |
444 | 99 | return 'DESDE: '+self.formatLang(form['date_from'], date=True)+' HASTA: '+self.formatLang(form['date_to'], date=True) | 98 | period_obj = self.pool.get('account.period') |
445 | 100 | else: | 99 | |
446 | 101 | return 'AL '+str(dia) + ' DE ' + mes.upper() + ' DE ' + str(ano) | 100 | for period in period_obj.browse(self.cr, self.uid, form['periods']): |
447 | 101 | aux.append(period.date_start) | ||
448 | 102 | aux.append(period.date_stop) | ||
449 | 103 | sorted(aux) | ||
450 | 104 | return 'Período del '+self.formatLang(aux[0], date=True)+' al '+self.formatLang(aux[-1], date=True) | ||
451 | 102 | 105 | ||
452 | 103 | def get_periods_and_date_text(self, form): | 106 | def get_periods_and_date_text(self, form): |
453 | 104 | """ | 107 | """ |
454 | @@ -108,12 +111,12 @@ | |||
455 | 108 | periods_str = None | 111 | periods_str = None |
456 | 109 | fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) | 112 | fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) |
457 | 110 | period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) | 113 | period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) |
459 | 111 | if form['state'] in ['byperiod', 'all']: | 114 | if form['filter'] in ['byperiod', 'all']: |
460 | 112 | period_ids = form['periods'] | 115 | period_ids = form['periods'] |
461 | 113 | periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) | 116 | periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) |
462 | 114 | 117 | ||
463 | 115 | dates_str = None | 118 | dates_str = None |
465 | 116 | if form['state'] in ['bydate', 'all']: | 119 | if form['filter'] in ['bydate', 'all']: |
466 | 117 | dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' | 120 | dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' |
467 | 118 | return {'periods':periods_str, 'date':dates_str} | 121 | return {'periods':periods_str, 'date':dates_str} |
468 | 119 | 122 | ||
469 | @@ -186,12 +189,12 @@ | |||
470 | 186 | ############################################################################# | 189 | ############################################################################# |
471 | 187 | 190 | ||
472 | 188 | ctx = self.context.copy() | 191 | ctx = self.context.copy() |
474 | 189 | ctx['state'] = form.get('state','all') | 192 | ctx['filter'] = form.get('filter','all') |
475 | 190 | ctx['fiscalyear'] = fiscalyear.id | 193 | ctx['fiscalyear'] = fiscalyear.id |
476 | 191 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) | 194 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) |
478 | 192 | if form['state'] in ['byperiod', 'all']: | 195 | if form['filter'] in ['byperiod', 'all']: |
479 | 193 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) | 196 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) |
481 | 194 | if form['state'] in ['bydate', 'all']: | 197 | if form['filter'] in ['bydate', 'all']: |
482 | 195 | ctx['date_from'] = form['date_from'] | 198 | ctx['date_from'] = form['date_from'] |
483 | 196 | ctx['date_to'] = form['date_to'] | 199 | ctx['date_to'] = form['date_to'] |
484 | 197 | 200 | ||
485 | @@ -227,20 +230,20 @@ | |||
486 | 227 | ############################################################################# | 230 | ############################################################################# |
487 | 228 | 231 | ||
488 | 229 | ctx = self.context.copy() | 232 | ctx = self.context.copy() |
490 | 230 | ctx['state'] = form.get('state','all') | 233 | ctx['filter'] = form.get('filter','all') |
491 | 231 | ctx['fiscalyear'] = fiscalyear.id | 234 | ctx['fiscalyear'] = fiscalyear.id |
492 | 232 | 235 | ||
494 | 233 | if form['state'] in ['byperiod', 'all']: | 236 | if form['filter'] in ['byperiod', 'all']: |
495 | 234 | ctx['periods'] = form['periods'] | 237 | ctx['periods'] = form['periods'] |
496 | 235 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) | 238 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
497 | 236 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) | 239 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) |
498 | 237 | if not ctx['periods']: | 240 | if not ctx['periods']: |
499 | 238 | missing_period() | 241 | missing_period() |
501 | 239 | elif form['state'] in ['bydate']: | 242 | elif form['filter'] in ['bydate']: |
502 | 240 | ctx['date_from'] = fiscalyear.date_start | 243 | ctx['date_from'] = fiscalyear.date_start |
503 | 241 | ctx['date_to'] = form['date_from'] | 244 | ctx['date_to'] = form['date_from'] |
504 | 242 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) | 245 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) |
506 | 243 | elif form['state'] == 'none': | 246 | elif form['filter'] == 'none': |
507 | 244 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) | 247 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) |
508 | 245 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) | 248 | date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) |
509 | 246 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) | 249 | ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) |
510 | 247 | 250 | ||
511 | === modified file 'account_financial_report/report/balance_full.rml' | |||
512 | --- account_financial_report/report/balance_full.rml 2012-01-02 22:27:49 +0000 | |||
513 | +++ account_financial_report/report/balance_full.rml 2012-01-20 23:38:23 +0000 | |||
514 | @@ -5,37 +5,26 @@ | |||
515 | 5 | <frame id="first" x1="1cm" y1="1.0cm" width="19.0cm" height="23cm"/> | 5 | <frame id="first" x1="1cm" y1="1.0cm" width="19.0cm" height="23cm"/> |
516 | 6 | <pageGraphics> | 6 | <pageGraphics> |
517 | 7 | <setFont name="Helvetica" size="9"/> | 7 | <setFont name="Helvetica" size="9"/> |
518 | 8 | |||
519 | 9 | <!-- | ||
520 | 10 | <image x="1.0cm" y="25.0cm" height="2.5cm" width="9.6cm">[[company.logo and company.logo or removeParentNode('image')]]</image> | ||
521 | 11 | <drawString x="1.0cm" y="24.5cm">[[company.logo and removeParentNode('para') or company.name]]</drawString> | ||
522 | 12 | --> | ||
523 | 13 | |||
524 | 14 | <place x="-3.5cm" y="22.50cm" width="19cm" height="5.0cm"> | 8 | <place x="-3.5cm" y="22.50cm" width="19cm" height="5.0cm"> |
525 | 15 | <blockTable colWidths="9.6cm,9.4cm" style="TITLE"> | 9 | <blockTable colWidths="9.6cm,9.4cm" style="TITLE"> |
526 | 16 | <tr> | 10 | <tr> |
527 | 17 | <td><para style="TOP_TITLE"></para></td> | 11 | <td><para style="TOP_TITLE"></para></td> |
537 | 18 | <td><para style="TITLE_CENTER_NAME">[[ company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE' ]]</para></td> | 12 | <td><para style="TITLE_CENTER_NAME"> |
538 | 19 | </tr> | 13 | <font>[[ (company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE')]]</font> |
539 | 20 | <tr> | 14 | <font>[[ company.partner_id.vat and ('- %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or '' ]]</font> |
540 | 21 | <td><para style="TOP_TITLE"></para></td> | 15 | </para></td> |
541 | 22 | <td><para style="TITLE_CENTER">[[ (company.partner_id.vat and ('RIF: %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or removeParentNode('para')) ]]</para></td> | 16 | </tr> |
542 | 23 | </tr> | 17 | <tr> |
543 | 24 | <tr> | 18 | <td><para style="TOP_TITLE"></para></td> |
544 | 25 | <td><para style="TOP_TITLE"></para></td> | 19 | <td><para style="TITLE_CENTER">[[ get_informe_text(data['form']) ]][[data['form'] and (' (Expresado en %s)'%( company.currency_id.name)) or '']]</para></td> |
536 | 26 | <td><para style="TITLE_CENTER">[[ get_inf_text(data['form']) ]]</para></td> | ||
545 | 27 | </tr> | 20 | </tr> |
546 | 28 | <tr> | 21 | <tr> |
547 | 29 | <td><para style="TOP_TITLE"></para></td> | 22 | <td><para style="TOP_TITLE"></para></td> |
548 | 30 | <td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td> | 23 | <td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td> |
549 | 31 | </tr> | 24 | </tr> |
550 | 32 | <tr> | ||
551 | 33 | <td><para style="TOP_TITLE"></para></td> | ||
552 | 34 | <td><para style="TITLE_CENTER">[[data['form'] and ('(Expresado en %s)'%(company.currency_id.symbol)) or '']]</para></td> | ||
553 | 35 | </tr> | ||
554 | 36 | </blockTable> | 25 | </blockTable> |
555 | 37 | </place> | 26 | </place> |
557 | 38 | <drawRightString x="192mm" y="5mm">[[ get_inf_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> | 27 | <drawRightString x="192mm" y="5mm">[[ get_informe_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> |
558 | 39 | </pageGraphics> | 28 | </pageGraphics> |
559 | 40 | 29 | ||
560 | 41 | </pageTemplate> | 30 | </pageTemplate> |
561 | @@ -108,7 +97,7 @@ | |||
562 | 108 | <para style="TITLES">Cuenta</para> | 97 | <para style="TITLES">Cuenta</para> |
563 | 109 | </td> | 98 | </td> |
564 | 110 | <td> | 99 | <td> |
566 | 111 | <para style="TITLE_LEFT_ALIGN"></para> | 100 | <para style="TITLE_LEFT_ALIGN">Balance</para> |
567 | 112 | </td> | 101 | </td> |
568 | 113 | </tr> | 102 | </tr> |
569 | 114 | <tr> | 103 | <tr> |
570 | @@ -127,7 +116,7 @@ | |||
571 | 127 | <td> | 116 | <td> |
572 | 128 | <para style="TITLE_LEFT_ALIGN"> | 117 | <para style="TITLE_LEFT_ALIGN"> |
573 | 129 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> | 118 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
575 | 130 | <font>[[ (a['total']==True) and formatLang(a['balance']) or '']]</font> | 119 | <font>[[(a['total']==True) and formatLang(a['balance']) or '']]</font> |
576 | 131 | </para> | 120 | </para> |
577 | 132 | </td> | 121 | </td> |
578 | 133 | </tr> | 122 | </tr> |
579 | 134 | 123 | ||
580 | === modified file 'account_financial_report/report/balance_full_2_cols.rml' | |||
581 | --- account_financial_report/report/balance_full_2_cols.rml 2012-01-02 22:27:49 +0000 | |||
582 | +++ account_financial_report/report/balance_full_2_cols.rml 2012-01-20 23:38:23 +0000 | |||
583 | @@ -5,37 +5,26 @@ | |||
584 | 5 | <frame id="first" x1="1cm" y1="1.0cm" width="19.0cm" height="23cm"/> | 5 | <frame id="first" x1="1cm" y1="1.0cm" width="19.0cm" height="23cm"/> |
585 | 6 | <pageGraphics> | 6 | <pageGraphics> |
586 | 7 | <setFont name="Helvetica" size="9"/> | 7 | <setFont name="Helvetica" size="9"/> |
587 | 8 | |||
588 | 9 | <!-- | ||
589 | 10 | <image x="1.0cm" y="25.0cm" height="2.5cm" width="9.6cm">[[company.logo and company.logo or removeParentNode('image')]]</image> | ||
590 | 11 | <drawString x="1.0cm" y="24.5cm">[[company.logo and removeParentNode('para') or company.name]]</drawString> | ||
591 | 12 | --> | ||
592 | 13 | |||
593 | 14 | <place x="-3.5cm" y="22.50cm" width="19cm" height="5.0cm"> | 8 | <place x="-3.5cm" y="22.50cm" width="19cm" height="5.0cm"> |
594 | 15 | <blockTable colWidths="9.6cm,9.4cm" style="TITLE"> | 9 | <blockTable colWidths="9.6cm,9.4cm" style="TITLE"> |
595 | 16 | <tr> | 10 | <tr> |
596 | 17 | <td><para style="TOP_TITLE"></para></td> | 11 | <td><para style="TOP_TITLE"></para></td> |
606 | 18 | <td><para style="TITLE_CENTER_NAME">[[ company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE' ]]</para></td> | 12 | <td><para style="TITLE_CENTER_NAME"> |
607 | 19 | </tr> | 13 | <font>[[ (company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE')]]</font> |
608 | 20 | <tr> | 14 | <font>[[ company.partner_id.vat and ('- %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or '' ]]</font> |
609 | 21 | <td><para style="TOP_TITLE"></para></td> | 15 | </para></td> |
610 | 22 | <td><para style="TITLE_CENTER">[[ (company.partner_id.vat and ('RIF: %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or removeParentNode('para')) ]]</para></td> | 16 | </tr> |
611 | 23 | </tr> | 17 | <tr> |
612 | 24 | <tr> | 18 | <td><para style="TOP_TITLE"></para></td> |
613 | 25 | <td><para style="TOP_TITLE"></para></td> | 19 | <td><para style="TITLE_CENTER">[[ get_informe_text(data['form']) ]][[data['form'] and (' (Expresado en %s)'%( company.currency_id.name)) or '']]</para></td> |
605 | 26 | <td><para style="TITLE_CENTER">[[ get_inf_text(data['form']) ]]</para></td> | ||
614 | 27 | </tr> | 20 | </tr> |
615 | 28 | <tr> | 21 | <tr> |
616 | 29 | <td><para style="TOP_TITLE"></para></td> | 22 | <td><para style="TOP_TITLE"></para></td> |
617 | 30 | <td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td> | 23 | <td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td> |
618 | 31 | </tr> | 24 | </tr> |
619 | 32 | <tr> | ||
620 | 33 | <td><para style="TOP_TITLE"></para></td> | ||
621 | 34 | <td><para style="TITLE_CENTER">[[data['form'] and ('(Expresado en %s)'%(company.currency_id.symbol)) or '']]</para></td> | ||
622 | 35 | </tr> | ||
623 | 36 | </blockTable> | 25 | </blockTable> |
624 | 37 | </place> | 26 | </place> |
626 | 38 | <drawRightString x="192mm" y="5mm">[[ get_inf_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> | 27 | <drawRightString x="192mm" y="5mm">[[ get_informe_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> |
627 | 39 | </pageGraphics> | 28 | </pageGraphics> |
628 | 40 | 29 | ||
629 | 41 | </pageTemplate> | 30 | </pageTemplate> |
630 | @@ -43,7 +32,7 @@ | |||
631 | 43 | <stylesheet> | 32 | <stylesheet> |
632 | 44 | <blockTableStyle id="TITLE"> | 33 | <blockTableStyle id="TITLE"> |
633 | 45 | <blockValign value="TOP"/> | 34 | <blockValign value="TOP"/> |
635 | 46 | </blockTableStyle> | 35 | </blockTableStyle> |
636 | 47 | <blockTableStyle id="BODY"> | 36 | <blockTableStyle id="BODY"> |
637 | 48 | <blockValign value="TOP"/> | 37 | <blockValign value="TOP"/> |
638 | 49 | <blockAlignment value="RIGHT"/> | 38 | <blockAlignment value="RIGHT"/> |
639 | @@ -75,32 +64,20 @@ | |||
640 | 75 | alignment="RIGHT" | 64 | alignment="RIGHT" |
641 | 76 | spaceBefore="0.0" | 65 | spaceBefore="0.0" |
642 | 77 | spaceAfter="0.0"/> | 66 | spaceAfter="0.0"/> |
656 | 78 | <paraStyle | 67 | <paraStyle name="TOP_TITLE" fontName="Helvetica-Bold" fontSize="9" leftIndent="0.0" alignment="LEFT"/> |
657 | 79 | name="TOP_TITLE" | 68 | <paraStyle name="TITLES" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
645 | 80 | fontName="Helvetica-Bold" | ||
646 | 81 | fontSize="9" | ||
647 | 82 | leftIndent="0.0" | ||
648 | 83 | alignment="LEFT"/> | ||
649 | 84 | <paraStyle name="TITLES" | ||
650 | 85 | fontName="Helvetica-Bold" | ||
651 | 86 | fontSize="8.0" | ||
652 | 87 | leading="10" | ||
653 | 88 | alignment="LEFT" | ||
654 | 89 | spaceBefore="0.0" | ||
655 | 90 | spaceAfter="0.0"/> | ||
658 | 91 | <paraStyle name="TITLE_CENTER" fontName="Helvetica-Bold" fontSize="9" leading="10" leftIndent="0.0" alignment="CENTER"/> | 69 | <paraStyle name="TITLE_CENTER" fontName="Helvetica-Bold" fontSize="9" leading="10" leftIndent="0.0" alignment="CENTER"/> |
659 | 92 | <paraStyle name="TITLE_CENTER_NAME" fontName="Helvetica-Bold" fontSize="12" leading="13" leftIndent="0.0" alignment="CENTER"/> | 70 | <paraStyle name="TITLE_CENTER_NAME" fontName="Helvetica-Bold" fontSize="12" leading="13" leftIndent="0.0" alignment="CENTER"/> |
660 | 93 | <paraStyle name="TITLE" alignment="CENTER" fontName="Helvetica" fontSize="18.0" leading="20" spaceBefore="-3.0" textColor="black"/> | 71 | <paraStyle name="TITLE" alignment="CENTER" fontName="Helvetica" fontSize="18.0" leading="20" spaceBefore="-3.0" textColor="black"/> |
661 | 94 | |||
662 | 95 | </stylesheet> | 72 | </stylesheet> |
663 | 96 | <images/> | 73 | <images/> |
664 | 97 | <story> | 74 | <story> |
665 | 98 | <para>[[setLang(user.context_lang)]]</para> | 75 | <para>[[setLang(user.context_lang)]]</para> |
667 | 99 | <blockTable colWidths="2.5cm,11.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1"> | 76 | <blockTable colWidths="2.5cm,9.5cm,3.5cm,3.5cm" style="BODY" repeatRows="1"> |
668 | 100 | <tr noRowsplits="1"> | 77 | <tr noRowsplits="1"> |
669 | 101 | <td> | 78 | <td> |
670 | 102 | <para style="TITLE_LEFT_ALIGN"> | 79 | <para style="TITLE_LEFT_ALIGN"> |
672 | 103 | <font>Código</font> | 80 | <font>Código</font> |
673 | 104 | </para> | 81 | </para> |
674 | 105 | </td> | 82 | </td> |
675 | 106 | <td> | 83 | <td> |
676 | @@ -119,7 +96,6 @@ | |||
677 | 119 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> | 96 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
678 | 120 | <i>[[a['label']==True and a['code'] or '' ]]</i> | 97 | <i>[[a['label']==True and a['code'] or '' ]]</i> |
679 | 121 | </para> | 98 | </para> |
680 | 122 | |||
681 | 123 | </td> | 99 | </td> |
682 | 124 | <td> | 100 | <td> |
683 | 125 | <para style="TITLES"> | 101 | <para style="TITLES"> |
684 | 126 | 102 | ||
685 | === modified file 'account_financial_report/report/balance_full_4_cols.rml' | |||
686 | --- account_financial_report/report/balance_full_4_cols.rml 2012-01-02 22:27:49 +0000 | |||
687 | +++ account_financial_report/report/balance_full_4_cols.rml 2012-01-20 23:38:23 +0000 | |||
688 | @@ -2,7 +2,7 @@ | |||
689 | 2 | <document filename="test.pdf"> | 2 | <document filename="test.pdf"> |
690 | 3 | <template pageSize="(21.59cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> | 3 | <template pageSize="(21.59cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0"> |
691 | 4 | <pageTemplate id="first"> | 4 | <pageTemplate id="first"> |
693 | 5 | <frame id="first" x1="1cm" y1="1.0cm" width="19.0cm" height="23cm"/> | 5 | <frame id="first" x1="0.5cm" y1="1.0cm" width="20.5cm" height="23cm"/> |
694 | 6 | <pageGraphics> | 6 | <pageGraphics> |
695 | 7 | <setFont name="Helvetica" size="9"/> | 7 | <setFont name="Helvetica" size="9"/> |
696 | 8 | 8 | ||
697 | @@ -15,27 +15,22 @@ | |||
698 | 15 | <blockTable colWidths="9.6cm,9.4cm" style="TITLE"> | 15 | <blockTable colWidths="9.6cm,9.4cm" style="TITLE"> |
699 | 16 | <tr> | 16 | <tr> |
700 | 17 | <td><para style="TOP_TITLE"></para></td> | 17 | <td><para style="TOP_TITLE"></para></td> |
710 | 18 | <td><para style="TITLE_CENTER_NAME">[[ company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE' ]]</para></td> | 18 | <td><para style="TITLE_CENTER_NAME"> |
711 | 19 | </tr> | 19 | <font>[[ (company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE')]]</font> |
712 | 20 | <tr> | 20 | <font>[[ company.partner_id.vat and ('- %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or '' ]]</font> |
713 | 21 | <td><para style="TOP_TITLE"></para></td> | 21 | </para></td> |
714 | 22 | <td><para style="TITLE_CENTER">[[ (company.partner_id.vat and ('RIF: %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or removeParentNode('para')) ]]</para></td> | 22 | </tr> |
715 | 23 | </tr> | 23 | <tr> |
716 | 24 | <tr> | 24 | <td><para style="TOP_TITLE"></para></td> |
717 | 25 | <td><para style="TOP_TITLE"></para></td> | 25 | <td><para style="TITLE_CENTER">[[ get_informe_text(data['form']) ]][[data['form'] and (' (Expresado en %s)'%( company.currency_id.name)) or '']]</para></td> |
709 | 26 | <td><para style="TITLE_CENTER">[[ get_inf_text(data['form']) ]]</para></td> | ||
718 | 27 | </tr> | 26 | </tr> |
719 | 28 | <tr> | 27 | <tr> |
720 | 29 | <td><para style="TOP_TITLE"></para></td> | 28 | <td><para style="TOP_TITLE"></para></td> |
721 | 30 | <td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td> | 29 | <td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td> |
722 | 31 | </tr> | 30 | </tr> |
723 | 32 | <tr> | ||
724 | 33 | <td><para style="TOP_TITLE"></para></td> | ||
725 | 34 | <td><para style="TITLE_CENTER">[[data['form'] and ('(Expresado en %s)'%(company.currency_id.symbol)) or '']]</para></td> | ||
726 | 35 | </tr> | ||
727 | 36 | </blockTable> | 31 | </blockTable> |
728 | 37 | </place> | 32 | </place> |
730 | 38 | <drawRightString x="192mm" y="5mm">[[ get_inf_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> | 33 | <drawRightString x="192mm" y="5mm">[[ get_informe_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> |
731 | 39 | </pageGraphics> | 34 | </pageGraphics> |
732 | 40 | 35 | ||
733 | 41 | </pageTemplate> | 36 | </pageTemplate> |
734 | @@ -84,7 +79,7 @@ | |||
735 | 84 | <images/> | 79 | <images/> |
736 | 85 | <story> | 80 | <story> |
737 | 86 | <para>[[setLang(user.context_lang)]]</para> | 81 | <para>[[setLang(user.context_lang)]]</para> |
739 | 87 | <blockTable colWidths="2.5cm,6.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1"> | 82 | <blockTable colWidths="2.5cm,6.5cm,2.5cm,3.5cm,3.5cm,2.5cm" style="BODY" repeatRows="1"> |
740 | 88 | <tr noRowsplits="1"> | 83 | <tr noRowsplits="1"> |
741 | 89 | <td> | 84 | <td> |
742 | 90 | <para style="TITLE_LEFT_ALIGN"> | 85 | <para style="TITLE_LEFT_ALIGN"> |
743 | 91 | 86 | ||
744 | === modified file 'account_financial_report/wizard/account_report_wizard.xml' | |||
745 | --- account_financial_report/wizard/account_report_wizard.xml 2012-01-02 21:37:32 +0000 | |||
746 | +++ account_financial_report/wizard/account_report_wizard.xml 2012-01-20 23:38:23 +0000 | |||
747 | @@ -22,16 +22,16 @@ | |||
748 | 22 | <separator string="Period" colspan="4"/> | 22 | <separator string="Period" colspan="4"/> |
749 | 23 | <field name="fiscalyear"/> | 23 | <field name="fiscalyear"/> |
750 | 24 | <newline/> | 24 | <newline/> |
752 | 25 | <field name="state" required="True"/> | 25 | <field name="filter" required="True"/> |
753 | 26 | <newline/> | 26 | <newline/> |
754 | 27 | 27 | ||
757 | 28 | <group attrs="{'invisible':[('state','=','none')]}" colspan="4"> | 28 | <group attrs="{'invisible':[('filter','=','none')]}" colspan="4"> |
758 | 29 | <group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4"> | 29 | <group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4"> |
759 | 30 | <separator string="Date Filter" colspan="4"/> | 30 | <separator string="Date Filter" colspan="4"/> |
760 | 31 | <field name="date_from"/> | 31 | <field name="date_from"/> |
761 | 32 | <field name="date_to"/> | 32 | <field name="date_to"/> |
762 | 33 | </group> | 33 | </group> |
764 | 34 | <group attrs="{'invisible':[('state','=','bydate')]}" colspan="4"> | 34 | <group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4"> |
765 | 35 | <separator string="Filter on Periods" colspan="4"/> | 35 | <separator string="Filter on Periods" colspan="4"/> |
766 | 36 | <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> | 36 | <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
767 | 37 | </group> | 37 | </group> |
768 | @@ -87,15 +87,15 @@ | |||
769 | 87 | <separator string="Period" colspan="4"/> | 87 | <separator string="Period" colspan="4"/> |
770 | 88 | <field name="fiscalyear"/> | 88 | <field name="fiscalyear"/> |
771 | 89 | <newline/> | 89 | <newline/> |
773 | 90 | <field name="state" required="True"/> | 90 | <field name="filter" required="True"/> |
774 | 91 | <newline/> | 91 | <newline/> |
777 | 92 | <group attrs="{'invisible':[('state','=','none')]}" colspan="4"> | 92 | <group attrs="{'invisible':[('filter','=','none')]}" colspan="4"> |
778 | 93 | <group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4"> | 93 | <group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4"> |
779 | 94 | <separator string="Date Filter" colspan="4"/> | 94 | <separator string="Date Filter" colspan="4"/> |
780 | 95 | <field name="date_from"/> | 95 | <field name="date_from"/> |
781 | 96 | <field name="date_to"/> | 96 | <field name="date_to"/> |
782 | 97 | </group> | 97 | </group> |
784 | 98 | <group attrs="{'invisible':[('state','=','bydate')]}" colspan="4"> | 98 | <group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4"> |
785 | 99 | <separator string="Filter on Periods" colspan="4"/> | 99 | <separator string="Filter on Periods" colspan="4"/> |
786 | 100 | <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> | 100 | <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
787 | 101 | </group> | 101 | </group> |
788 | @@ -149,15 +149,15 @@ | |||
789 | 149 | <separator string="Period" colspan="4"/> | 149 | <separator string="Period" colspan="4"/> |
790 | 150 | <field name="fiscalyear"/> | 150 | <field name="fiscalyear"/> |
791 | 151 | <newline/> | 151 | <newline/> |
793 | 152 | <field name="state" required="True"/> | 152 | <field name="filter" required="True"/> |
794 | 153 | <newline/> | 153 | <newline/> |
797 | 154 | <group attrs="{'invisible':[('state','=','none')]}" colspan="4"> | 154 | <group attrs="{'invisible':[('filter','=','none')]}" colspan="4"> |
798 | 155 | <group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4"> | 155 | <group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4"> |
799 | 156 | <separator string="Date Filter" colspan="4"/> | 156 | <separator string="Date Filter" colspan="4"/> |
800 | 157 | <field name="date_from"/> | 157 | <field name="date_from"/> |
801 | 158 | <field name="date_to"/> | 158 | <field name="date_to"/> |
802 | 159 | </group> | 159 | </group> |
804 | 160 | <group attrs="{'invisible':[('state','=','bydate')]}" colspan="4"> | 160 | <group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4"> |
805 | 161 | <separator string="Filter on Periods" colspan="4"/> | 161 | <separator string="Filter on Periods" colspan="4"/> |
806 | 162 | <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> | 162 | <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> |
807 | 163 | </group> | 163 | </group> |
808 | 164 | 164 | ||
809 | === modified file 'account_financial_report/wizard/wizard_account_balance_2_report.py' | |||
810 | --- account_financial_report/wizard/wizard_account_balance_2_report.py 2012-01-02 22:27:49 +0000 | |||
811 | +++ account_financial_report/wizard/wizard_account_balance_2_report.py 2012-01-20 23:38:23 +0000 | |||
812 | @@ -29,36 +29,47 @@ | |||
813 | 29 | from osv import osv,fields | 29 | from osv import osv,fields |
814 | 30 | import pooler | 30 | import pooler |
815 | 31 | import time | 31 | import time |
816 | 32 | |||
817 | 32 | class wizard_account_balance_gene_2(osv.osv_memory): | 33 | class wizard_account_balance_gene_2(osv.osv_memory): |
818 | 33 | _name = "wizard.report.account.balance.gene.2" | 34 | _name = "wizard.report.account.balance.gene.2" |
819 | 34 | 35 | ||
820 | 35 | _columns = { | 36 | _columns = { |
821 | 36 | 'company_id': fields.many2one('res.company','Company',required=True), | 37 | 'company_id': fields.many2one('res.company','Company',required=True), |
822 | 37 | 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), | 38 | 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), |
824 | 38 | 'state': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), | 39 | 'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), |
825 | 39 | 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), | 40 | 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), |
826 | 40 | 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), | 41 | 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), |
828 | 41 | 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'), | 42 | 'display_account': fields.selection([('all','All'),('con_balance', 'With balance'),('con_movimiento','With movements')],'Display accounts'), |
829 | 42 | 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), | 43 | 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), |
832 | 43 | 'date_from': fields.date('Start date',required=True), | 44 | 'date_from': fields.date('Start date'), |
833 | 44 | 'date_to': fields.date('End date',required=True), | 45 | 'date_to': fields.date('End date'), |
834 | 45 | 'tot_check': fields.boolean('Show Total'), | 46 | 'tot_check': fields.boolean('Show Total'), |
835 | 46 | 'lab_str': fields.char('Description', size= 128), | 47 | 'lab_str': fields.char('Description', size= 128), |
837 | 47 | 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas'),('bdl','Libro Diario Legal')],'Tipo Informe',required=True), | 48 | 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True), |
838 | 49 | #~ 'type_report': fields.selection([('un_col','Una Columna'),('dos_col','Dos Columnas'),('cuatro_col','Cuatro Columnas')],'Tipo Informe',required=True), | ||
839 | 48 | } | 50 | } |
840 | 49 | 51 | ||
841 | 50 | _defaults = { | 52 | _defaults = { |
842 | 51 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), | 53 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), |
843 | 52 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), | 54 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), |
845 | 53 | 'state': lambda *a:'byperiod', | 55 | 'filter': lambda *a:'byperiod', |
846 | 54 | 'display_account_level': lambda *a: 0, | 56 | 'display_account_level': lambda *a: 0, |
847 | 55 | 'inf_type': lambda *a:'bcom', | 57 | 'inf_type': lambda *a:'bcom', |
848 | 56 | 'company_id': lambda *a: 1, | 58 | 'company_id': lambda *a: 1, |
852 | 57 | 'fiscalyear': lambda *a: 1, | 59 | 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid), |
853 | 58 | 'display_account': lambda *a:'bal_mouvement', | 60 | 'display_account': lambda *a:'con_movimiento', |
851 | 59 | |||
854 | 60 | } | 61 | } |
856 | 61 | 62 | ||
857 | 63 | def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None): | ||
858 | 64 | if context is None: | ||
859 | 65 | context = {} | ||
860 | 66 | res = {} | ||
861 | 67 | if filters in ("bydate","all"): | ||
862 | 68 | fisy = self.pool.get("account.fiscalyear") | ||
863 | 69 | fis_actual = fisy.browse(cr,uid,fiscalyear,context=context) | ||
864 | 70 | res = {'value':{'date_from': fis_actual.date_start, 'date_to': fis_actual.date_stop}} | ||
865 | 71 | return res | ||
866 | 72 | |||
867 | 62 | def _get_defaults(self, cr, uid, data, context=None): | 73 | def _get_defaults(self, cr, uid, data, context=None): |
868 | 63 | if context is None: | 74 | if context is None: |
869 | 64 | context = {} | 75 | context = {} |
870 | @@ -73,40 +84,65 @@ | |||
871 | 73 | data['form']['context'] = context | 84 | data['form']['context'] = context |
872 | 74 | return data['form'] | 85 | return data['form'] |
873 | 75 | 86 | ||
874 | 76 | |||
875 | 77 | def _check_state(self, cr, uid, data, context=None): | 87 | def _check_state(self, cr, uid, data, context=None): |
876 | 78 | if context is None: | 88 | if context is None: |
877 | 79 | context = {} | 89 | context = {} |
879 | 80 | if data['form']['state'] == 'bydate': | 90 | if data['form']['filter'] == 'bydate': |
880 | 81 | self._check_date(cr, uid, data, context) | 91 | self._check_date(cr, uid, data, context) |
881 | 82 | return data['form'] | 92 | return data['form'] |
882 | 83 | 93 | ||
883 | 84 | |||
884 | 85 | def _check_date(self, cr, uid, data, context=None): | 94 | def _check_date(self, cr, uid, data, context=None): |
885 | 86 | if context is None: | 95 | if context is None: |
886 | 87 | context = {} | 96 | context = {} |
887 | 97 | |||
888 | 98 | if data['form']['date_from'] > data['form']['date_to']: | ||
889 | 99 | raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial')) | ||
890 | 100 | |||
891 | 88 | sql = """SELECT f.id, f.date_start, f.date_stop | 101 | sql = """SELECT f.id, f.date_start, f.date_stop |
892 | 89 | FROM account_fiscalyear f | 102 | FROM account_fiscalyear f |
894 | 90 | WHERE '%s' between f.date_start and f.date_stop """%(data['form']['date_from']) | 103 | WHERE '%s' = f.id """%(data['form']['fiscalyear']) |
895 | 91 | cr.execute(sql) | 104 | cr.execute(sql) |
896 | 92 | res = cr.dictfetchall() | 105 | res = cr.dictfetchall() |
897 | 106 | |||
898 | 93 | if res: | 107 | if res: |
901 | 94 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']): | 108 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']): |
902 | 95 | raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop'])) | 109 | raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop'])) |
903 | 96 | else: | 110 | else: |
904 | 97 | return 'report' | 111 | return 'report' |
905 | 98 | else: | 112 | else: |
907 | 99 | raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) | 113 | raise osv.except_osv(_('UserError'),'No existe periodo fiscal') |
908 | 100 | 114 | ||
909 | 101 | def print_report(self, cr, uid, ids,data, context=None): | 115 | def print_report(self, cr, uid, ids,data, context=None): |
910 | 102 | if context is None: | 116 | if context is None: |
911 | 103 | context = {} | 117 | context = {} |
912 | 118 | |||
913 | 104 | data = {} | 119 | data = {} |
914 | 105 | data['ids'] = context.get('active_ids', []) | 120 | data['ids'] = context.get('active_ids', []) |
915 | 106 | data['model'] = context.get('active_model', 'ir.ui.menu') | 121 | data['model'] = context.get('active_model', 'ir.ui.menu') |
916 | 107 | data['form'] = self.read(cr, uid, ids[0]) | 122 | data['form'] = self.read(cr, uid, ids[0]) |
917 | 123 | |||
918 | 124 | if data['form']['filter'] == 'byperiod': | ||
919 | 125 | del data['form']['date_from'] | ||
920 | 126 | del data['form']['date_to'] | ||
921 | 127 | elif data['form']['filter'] == 'bydate': | ||
922 | 128 | self._check_date(cr, uid, data) | ||
923 | 129 | del data['form']['periods'] | ||
924 | 130 | elif data['form']['filter'] == 'none': | ||
925 | 131 | del data['form']['date_from'] | ||
926 | 132 | del data['form']['date_to'] | ||
927 | 133 | del data['form']['periods'] | ||
928 | 134 | else: | ||
929 | 135 | self._check_date(cr, uid, data) | ||
930 | 136 | lis2 = str(data['form']['periods']).replace("[","(").replace("]",")") | ||
931 | 137 | sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin | ||
932 | 138 | from account_period p | ||
933 | 139 | where p.id in %s"""%lis2 | ||
934 | 140 | cr.execute(sqlmm) | ||
935 | 141 | minmax = cr.dictfetchall() | ||
936 | 142 | if minmax: | ||
937 | 143 | if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']): | ||
938 | 144 | raise osv.except_osv(_('Error !'),('La intersepcion entre el periodo y fecha es vacio')) | ||
939 | 145 | |||
940 | 108 | return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene.2', 'datas': data} | 146 | return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene.2', 'datas': data} |
941 | 109 | 147 | ||
942 | 110 | wizard_account_balance_gene_2() | 148 | wizard_account_balance_gene_2() |
943 | 111 | |||
944 | 112 | |||
945 | 113 | 149 | ||
946 | === modified file 'account_financial_report/wizard/wizard_account_balance_4_report.py' | |||
947 | --- account_financial_report/wizard/wizard_account_balance_4_report.py 2012-01-02 22:27:49 +0000 | |||
948 | +++ account_financial_report/wizard/wizard_account_balance_4_report.py 2012-01-20 23:38:23 +0000 | |||
949 | @@ -1,37 +1,75 @@ | |||
950 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
951 | 2 | ########################################################################### | ||
952 | 3 | # Module Writen to OpenERP, Open Source Management Solution | ||
953 | 4 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | ||
954 | 5 | # All Rights Reserved | ||
955 | 6 | ###############Credits###################################################### | ||
956 | 7 | # Coded by: Humberto Arocha humberto@openerp.com.ve | ||
957 | 8 | # Angelica Barrios angelicaisabelb@gmail.com | ||
958 | 9 | # Jordi Esteve <jesteve@zikzakmedia.com> | ||
959 | 10 | # Javier Duran <javieredm@gmail.com> | ||
960 | 11 | # Planified by: Humberto Arocha | ||
961 | 12 | # Finance by: LUBCAN COL S.A.S http://www.lubcancol.com | ||
962 | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve | ||
963 | 14 | ############################################################################# | ||
964 | 15 | # This program is free software: you can redistribute it and/or modify | ||
965 | 16 | # it under the terms of the GNU General Public License as published by | ||
966 | 17 | # the Free Software Foundation, either version 3 of the License, or | ||
967 | 18 | # (at your option) any later version. | ||
968 | 19 | # | ||
969 | 20 | # This program is distributed in the hope that it will be useful, | ||
970 | 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
971 | 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
972 | 23 | # GNU General Public License for more details. | ||
973 | 24 | # | ||
974 | 25 | # You should have received a copy of the GNU General Public License | ||
975 | 26 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
976 | 27 | ############################################################################## | ||
977 | 28 | |||
978 | 2 | from osv import osv,fields | 29 | from osv import osv,fields |
979 | 3 | import pooler | 30 | import pooler |
980 | 4 | import time | 31 | import time |
981 | 32 | |||
982 | 5 | class wizard_report(osv.osv_memory): | 33 | class wizard_report(osv.osv_memory): |
983 | 6 | _name = "wizard.report" | 34 | _name = "wizard.report" |
984 | 7 | 35 | ||
985 | 8 | _columns = { | 36 | _columns = { |
986 | 9 | 'company_id': fields.many2one('res.company','Company',required=True), | 37 | 'company_id': fields.many2one('res.company','Company',required=True), |
987 | 10 | 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), | 38 | 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), |
989 | 11 | 'state': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), | 39 | 'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), |
990 | 12 | 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), | 40 | 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), |
991 | 13 | 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), | 41 | 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), |
993 | 14 | 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'), | 42 | 'display_account': fields.selection([('all','All'),('con_balance', 'With balance'),('con_movimiento','With movements')],'Display accounts'), |
994 | 15 | 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), | 43 | 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), |
997 | 16 | 'date_from': fields.date('Start date',required=True), | 44 | 'date_from': fields.date('Start date'), |
998 | 17 | 'date_to': fields.date('End date',required=True), | 45 | 'date_to': fields.date('End date'), |
999 | 18 | 'tot_check': fields.boolean('Show Total'), | 46 | 'tot_check': fields.boolean('Show Total'), |
1000 | 19 | 'lab_str': fields.char('Description', size= 128), | 47 | 'lab_str': fields.char('Description', size= 128), |
1002 | 20 | 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas'),('bml','Libro Mayor Legal')],'Tipo Informe',required=True), | 48 | 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True), |
1003 | 49 | #~ 'type_report': fields.selection([('un_col','Una Columna'),('dos_col','Dos Columnas'),('cuatro_col','Cuatro Columnas')],'Tipo Informe',required=True), | ||
1004 | 21 | } | 50 | } |
1005 | 22 | 51 | ||
1006 | 23 | _defaults = { | 52 | _defaults = { |
1007 | 24 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), | 53 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), |
1008 | 25 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), | 54 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), |
1010 | 26 | 'state': lambda *a:'byperiod', | 55 | 'filter': lambda *a:'byperiod', |
1011 | 27 | 'display_account_level': lambda *a: 0, | 56 | 'display_account_level': lambda *a: 0, |
1012 | 28 | 'inf_type': lambda *a:'bcom', | 57 | 'inf_type': lambda *a:'bcom', |
1013 | 29 | 'company_id': lambda *a: 1, | 58 | 'company_id': lambda *a: 1, |
1017 | 30 | 'fiscalyear': lambda *a: 1, | 59 | 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid), |
1018 | 31 | 'display_account': lambda *a:'bal_mouvement', | 60 | 'display_account': lambda *a:'con_movimiento', |
1016 | 32 | |||
1019 | 33 | } | 61 | } |
1021 | 34 | 62 | ||
1022 | 63 | def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None): | ||
1023 | 64 | if context is None: | ||
1024 | 65 | context = {} | ||
1025 | 66 | res = {} | ||
1026 | 67 | if filters in ("bydate","all"): | ||
1027 | 68 | fisy = self.pool.get("account.fiscalyear") | ||
1028 | 69 | fis_actual = fisy.browse(cr,uid,fiscalyear,context=context) | ||
1029 | 70 | res = {'value':{'date_from': fis_actual.date_start, 'date_to': fis_actual.date_stop}} | ||
1030 | 71 | return res | ||
1031 | 72 | |||
1032 | 35 | def _get_defaults(self, cr, uid, data, context=None): | 73 | def _get_defaults(self, cr, uid, data, context=None): |
1033 | 36 | if context is None: | 74 | if context is None: |
1034 | 37 | context = {} | 75 | context = {} |
1035 | @@ -46,38 +84,65 @@ | |||
1036 | 46 | data['form']['context'] = context | 84 | data['form']['context'] = context |
1037 | 47 | return data['form'] | 85 | return data['form'] |
1038 | 48 | 86 | ||
1039 | 49 | |||
1040 | 50 | def _check_state(self, cr, uid, data, context=None): | 87 | def _check_state(self, cr, uid, data, context=None): |
1041 | 51 | if context is None: | 88 | if context is None: |
1042 | 52 | context = {} | 89 | context = {} |
1044 | 53 | if data['form']['state'] == 'bydate': | 90 | if data['form']['filter'] == 'bydate': |
1045 | 54 | self._check_date(cr, uid, data, context) | 91 | self._check_date(cr, uid, data, context) |
1046 | 55 | return data['form'] | 92 | return data['form'] |
1047 | 56 | 93 | ||
1048 | 57 | |||
1049 | 58 | def _check_date(self, cr, uid, data, context=None): | 94 | def _check_date(self, cr, uid, data, context=None): |
1050 | 59 | if context is None: | 95 | if context is None: |
1051 | 60 | context = {} | 96 | context = {} |
1052 | 97 | |||
1053 | 98 | if data['form']['date_from'] > data['form']['date_to']: | ||
1054 | 99 | raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial')) | ||
1055 | 100 | |||
1056 | 61 | sql = """SELECT f.id, f.date_start, f.date_stop | 101 | sql = """SELECT f.id, f.date_start, f.date_stop |
1057 | 62 | FROM account_fiscalyear f | 102 | FROM account_fiscalyear f |
1059 | 63 | WHERE '%s' between f.date_start and f.date_stop """%(data['form']['date_from']) | 103 | WHERE '%s' = f.id """%(data['form']['fiscalyear']) |
1060 | 64 | cr.execute(sql) | 104 | cr.execute(sql) |
1061 | 65 | res = cr.dictfetchall() | 105 | res = cr.dictfetchall() |
1062 | 106 | |||
1063 | 66 | if res: | 107 | if res: |
1066 | 67 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']): | 108 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']): |
1067 | 68 | raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop'])) | 109 | raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop'])) |
1068 | 69 | else: | 110 | else: |
1069 | 70 | return 'report' | 111 | return 'report' |
1070 | 71 | else: | 112 | else: |
1072 | 72 | raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) | 113 | raise osv.except_osv(_('UserError'),'No existe periodo fiscal') |
1073 | 73 | 114 | ||
1074 | 74 | def print_report(self, cr, uid, ids,data, context=None): | 115 | def print_report(self, cr, uid, ids,data, context=None): |
1075 | 75 | if context is None: | 116 | if context is None: |
1076 | 76 | context = {} | 117 | context = {} |
1077 | 118 | |||
1078 | 77 | data = {} | 119 | data = {} |
1079 | 78 | data['ids'] = context.get('active_ids', []) | 120 | data['ids'] = context.get('active_ids', []) |
1080 | 79 | data['model'] = context.get('active_model', 'ir.ui.menu') | 121 | data['model'] = context.get('active_model', 'ir.ui.menu') |
1081 | 80 | data['form'] = self.read(cr, uid, ids[0]) | 122 | data['form'] = self.read(cr, uid, ids[0]) |
1082 | 123 | |||
1083 | 124 | if data['form']['filter'] == 'byperiod': | ||
1084 | 125 | del data['form']['date_from'] | ||
1085 | 126 | del data['form']['date_to'] | ||
1086 | 127 | elif data['form']['filter'] == 'bydate': | ||
1087 | 128 | self._check_date(cr, uid, data) | ||
1088 | 129 | del data['form']['periods'] | ||
1089 | 130 | elif data['form']['filter'] == 'none': | ||
1090 | 131 | del data['form']['date_from'] | ||
1091 | 132 | del data['form']['date_to'] | ||
1092 | 133 | del data['form']['periods'] | ||
1093 | 134 | else: | ||
1094 | 135 | self._check_date(cr, uid, data) | ||
1095 | 136 | lis2 = str(data['form']['periods']).replace("[","(").replace("]",")") | ||
1096 | 137 | sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin | ||
1097 | 138 | from account_period p | ||
1098 | 139 | where p.id in %s"""%lis2 | ||
1099 | 140 | cr.execute(sqlmm) | ||
1100 | 141 | minmax = cr.dictfetchall() | ||
1101 | 142 | if minmax: | ||
1102 | 143 | if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']): | ||
1103 | 144 | raise osv.except_osv(_('Error !'),('La intersepcion entre el periodo y fecha es vacio')) | ||
1104 | 145 | |||
1105 | 81 | return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.report.reporte', 'datas': data} | 146 | return {'type': 'ir.actions.report.xml', 'report_name': 'wizard.report.reporte', 'datas': data} |
1107 | 82 | 147 | ||
1108 | 83 | wizard_report() | 148 | wizard_report() |
1109 | 84 | 149 | ||
1110 | === modified file 'account_financial_report/wizard/wizard_account_balance_report.py' | |||
1111 | --- account_financial_report/wizard/wizard_account_balance_report.py 2012-01-02 21:37:32 +0000 | |||
1112 | +++ account_financial_report/wizard/wizard_account_balance_report.py 2012-01-20 23:38:23 +0000 | |||
1113 | @@ -26,40 +26,50 @@ | |||
1114 | 26 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 26 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1115 | 27 | ############################################################################## | 27 | ############################################################################## |
1116 | 28 | 28 | ||
1117 | 29 | |||
1118 | 30 | from osv import osv,fields | 29 | from osv import osv,fields |
1119 | 31 | import pooler | 30 | import pooler |
1120 | 32 | import time | 31 | import time |
1121 | 32 | |||
1122 | 33 | class wizard_account_balance_gene(osv.osv_memory): | 33 | class wizard_account_balance_gene(osv.osv_memory): |
1123 | 34 | _name = "wizard.report.account.balance.gene" | 34 | _name = "wizard.report.account.balance.gene" |
1124 | 35 | 35 | ||
1125 | 36 | _columns = { | 36 | _columns = { |
1126 | 37 | 'company_id': fields.many2one('res.company','Company',required=True), | 37 | 'company_id': fields.many2one('res.company','Company',required=True), |
1127 | 38 | 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), | 38 | 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), |
1129 | 39 | 'state': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), | 39 | 'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), |
1130 | 40 | 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), | 40 | 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), |
1131 | 41 | 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), | 41 | 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), |
1133 | 42 | 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'), | 42 | 'display_account': fields.selection([('all','All'),('con_balance', 'With balance'),('con_movimiento','With movements')],'Display accounts'), |
1134 | 43 | 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), | 43 | 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), |
1137 | 44 | 'date_from': fields.date('Start date',required=True), | 44 | 'date_from': fields.date('Start date'), |
1138 | 45 | 'date_to': fields.date('End date',required=True), | 45 | 'date_to': fields.date('End date'), |
1139 | 46 | 'tot_check': fields.boolean('Show Total'), | 46 | 'tot_check': fields.boolean('Show Total'), |
1140 | 47 | 'lab_str': fields.char('Description', size= 128), | 47 | 'lab_str': fields.char('Description', size= 128), |
1141 | 48 | 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True), | 48 | 'inf_type': fields.selection([('bgen','Balance General'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas')],'Tipo Informe',required=True), |
1142 | 49 | #~ 'type_report': fields.selection([('un_col','Una Columna'),('dos_col','Dos Columnas'),('cuatro_col','Cuatro Columnas')],'Tipo Informe',required=True), | ||
1143 | 49 | } | 50 | } |
1144 | 50 | 51 | ||
1145 | 51 | _defaults = { | 52 | _defaults = { |
1146 | 52 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), | 53 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), |
1147 | 53 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), | 54 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), |
1149 | 54 | 'state': lambda *a:'byperiod', | 55 | 'filter': lambda *a:'byperiod', |
1150 | 55 | 'display_account_level': lambda *a: 0, | 56 | 'display_account_level': lambda *a: 0, |
1151 | 56 | 'inf_type': lambda *a:'bcom', | 57 | 'inf_type': lambda *a:'bcom', |
1152 | 57 | 'company_id': lambda *a: 1, | 58 | 'company_id': lambda *a: 1, |
1156 | 58 | 'fiscalyear': lambda *a: 1, | 59 | 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid), |
1157 | 59 | 'display_account': lambda *a:'bal_mouvement', | 60 | 'display_account': lambda *a:'con_movimiento', |
1155 | 60 | |||
1158 | 61 | } | 61 | } |
1160 | 62 | 62 | ||
1161 | 63 | def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None): | ||
1162 | 64 | if context is None: | ||
1163 | 65 | context = {} | ||
1164 | 66 | res = {} | ||
1165 | 67 | if filters in ("bydate","all"): | ||
1166 | 68 | fisy = self.pool.get("account.fiscalyear") | ||
1167 | 69 | fis_actual = fisy.browse(cr,uid,fiscalyear,context=context) | ||
1168 | 70 | res = {'value':{'date_from': fis_actual.date_start, 'date_to': fis_actual.date_stop}} | ||
1169 | 71 | return res | ||
1170 | 72 | |||
1171 | 63 | def _get_defaults(self, cr, uid, data, context=None): | 73 | def _get_defaults(self, cr, uid, data, context=None): |
1172 | 64 | if context is None: | 74 | if context is None: |
1173 | 65 | context = {} | 75 | context = {} |
1174 | @@ -74,39 +84,65 @@ | |||
1175 | 74 | data['form']['context'] = context | 84 | data['form']['context'] = context |
1176 | 75 | return data['form'] | 85 | return data['form'] |
1177 | 76 | 86 | ||
1178 | 77 | |||
1179 | 78 | def _check_state(self, cr, uid, data, context=None): | 87 | def _check_state(self, cr, uid, data, context=None): |
1180 | 79 | if context is None: | 88 | if context is None: |
1181 | 80 | context = {} | 89 | context = {} |
1183 | 81 | if data['form']['state'] == 'bydate': | 90 | if data['form']['filter'] == 'bydate': |
1184 | 82 | self._check_date(cr, uid, data, context) | 91 | self._check_date(cr, uid, data, context) |
1185 | 83 | return data['form'] | 92 | return data['form'] |
1186 | 84 | 93 | ||
1187 | 85 | |||
1188 | 86 | def _check_date(self, cr, uid, data, context=None): | 94 | def _check_date(self, cr, uid, data, context=None): |
1189 | 87 | if context is None: | 95 | if context is None: |
1190 | 88 | context = {} | 96 | context = {} |
1191 | 97 | |||
1192 | 98 | if data['form']['date_from'] > data['form']['date_to']: | ||
1193 | 99 | raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial')) | ||
1194 | 100 | |||
1195 | 89 | sql = """SELECT f.id, f.date_start, f.date_stop | 101 | sql = """SELECT f.id, f.date_start, f.date_stop |
1196 | 90 | FROM account_fiscalyear f | 102 | FROM account_fiscalyear f |
1198 | 91 | WHERE '%s' between f.date_start and f.date_stop """%(data['form']['date_from']) | 103 | WHERE '%s' = f.id """%(data['form']['fiscalyear']) |
1199 | 92 | cr.execute(sql) | 104 | cr.execute(sql) |
1200 | 93 | res = cr.dictfetchall() | 105 | res = cr.dictfetchall() |
1201 | 106 | |||
1202 | 94 | if res: | 107 | if res: |
1205 | 95 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']): | 108 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']): |
1206 | 96 | raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop'])) | 109 | raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop'])) |
1207 | 97 | else: | 110 | else: |
1208 | 98 | return 'report' | 111 | return 'report' |
1209 | 99 | else: | 112 | else: |
1211 | 100 | raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year')) | 113 | raise osv.except_osv(_('UserError'),'No existe periodo fiscal') |
1212 | 101 | 114 | ||
1213 | 102 | def print_report(self, cr, uid, ids,data, context=None): | 115 | def print_report(self, cr, uid, ids,data, context=None): |
1214 | 103 | if context is None: | 116 | if context is None: |
1215 | 104 | context = {} | 117 | context = {} |
1216 | 118 | |||
1217 | 105 | data = {} | 119 | data = {} |
1218 | 106 | data['ids'] = context.get('active_ids', []) | 120 | data['ids'] = context.get('active_ids', []) |
1219 | 107 | data['model'] = context.get('active_model', 'ir.ui.menu') | 121 | data['model'] = context.get('active_model', 'ir.ui.menu') |
1220 | 108 | data['form'] = self.read(cr, uid, ids[0]) | 122 | data['form'] = self.read(cr, uid, ids[0]) |
1221 | 123 | |||
1222 | 124 | if data['form']['filter'] == 'byperiod': | ||
1223 | 125 | del data['form']['date_from'] | ||
1224 | 126 | del data['form']['date_to'] | ||
1225 | 127 | elif data['form']['filter'] == 'bydate': | ||
1226 | 128 | self._check_date(cr, uid, data) | ||
1227 | 129 | del data['form']['periods'] | ||
1228 | 130 | elif data['form']['filter'] == 'none': | ||
1229 | 131 | del data['form']['date_from'] | ||
1230 | 132 | del data['form']['date_to'] | ||
1231 | 133 | del data['form']['periods'] | ||
1232 | 134 | else: | ||
1233 | 135 | self._check_date(cr, uid, data) | ||
1234 | 136 | lis2 = str(data['form']['periods']).replace("[","(").replace("]",")") | ||
1235 | 137 | sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin | ||
1236 | 138 | from account_period p | ||
1237 | 139 | where p.id in %s"""%lis2 | ||
1238 | 140 | cr.execute(sqlmm) | ||
1239 | 141 | minmax = cr.dictfetchall() | ||
1240 | 142 | if minmax: | ||
1241 | 143 | if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']): | ||
1242 | 144 | raise osv.except_osv(_('Error !'),('La intersepcion entre el periodo y fecha es vacio')) | ||
1243 | 145 | |||
1244 | 109 | return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene', 'datas': data} | 146 | return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene', 'datas': data} |
1245 | 110 | 147 | ||
1246 | 111 | wizard_account_balance_gene() | 148 | wizard_account_balance_gene() |
1247 | 112 |