Merge lp:~camptocamp/openerp-swiss-localization/add_l10n_ch_rouding into lp:~camptocamp/openerp-swiss-localization/7.0-add-l10n_ch_add_invoice_rounding
- add_l10n_ch_rouding
- Merge into 7.0-add-l10n_ch_add_invoic...
Proposed by
Vincent Renaville@camptocamp
Status: | Merged |
---|---|
Merged at revision: | 183 |
Proposed branch: | lp:~camptocamp/openerp-swiss-localization/add_l10n_ch_rouding |
Merge into: | lp:~camptocamp/openerp-swiss-localization/7.0-add-l10n_ch_add_invoice_rounding |
Diff against target: |
1059 lines (+360/-188) 18 files modified
ChangeLog (+36/-10) l10n_ch/__openerp__.py (+1/-1) l10n_ch_bank/__openerp__.py (+1/-1) l10n_ch_base_bank/__openerp__.py (+3/-3) l10n_ch_base_bank/bank.py (+143/-41) l10n_ch_base_bank/bank_view.xml (+63/-0) l10n_ch_dta/__openerp__.py (+1/-2) l10n_ch_dta/bank_view.xml (+2/-2) l10n_ch_dta/payent_view.xml (+0/-16) l10n_ch_dta/wizard/create_dta.py (+50/-53) l10n_ch_invoice_rounding/account.py (+9/-9) l10n_ch_payment_slip/bank_view.xml (+2/-2) l10n_ch_payment_slip/company_view.xml (+2/-2) l10n_ch_payment_slip/invoice.py (+18/-20) l10n_ch_payment_slip/report/bvr.mako (+24/-21) l10n_ch_payment_slip/report/report_webkit_html.py (+1/-1) l10n_ch_sepa/base_sepa/base_template/pain.001.001.03.xml.mako (+2/-2) l10n_ch_sepa/base_sepa/pain_001.py (+2/-2) |
To merge this branch: | bzr merge lp:~camptocamp/openerp-swiss-localization/add_l10n_ch_rouding |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Yannick Vaucher @ Camptocamp | Approve | ||
Camptocamp | Pending | ||
Review via email:
|
Commit message
Description of the change
Limit to customer invoice
To post a comment you must log in.
- 179. By Vincent Renaville@camptocamp
-
[ADD] documentation
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' |
2 | --- ChangeLog 2013-02-15 14:55:06 +0000 |
3 | +++ ChangeLog 2013-07-15 15:22:25 +0000 |
4 | @@ -1,34 +1,60 @@ |
5 | +Change with release 7.1 |
6 | + |
7 | + *) Add ccp account on res_bank but keep retro compatibility with old model. |
8 | + If no ccp is set on bank old behavior is kept. |
9 | + Be aware if you have customizde bvr.mako you have to replace acc_number by get_account_number(). |
10 | + This change allows to avoid duplication of res.partner.bank |
11 | + |
12 | + *) Fix res.bank view |
13 | + |
14 | + *) Improve res.bank name search by adding intelligent search |
15 | + |
16 | + *) Add city to res.bank name_get |
17 | + |
18 | + *) Add constraint to avoid wrong entries on res.partner.bank |
19 | + |
20 | + *) Disable invoice reference overwrite when validating an invoice |
21 | + |
22 | + *) Better res.bank views in list mode |
23 | + |
24 | + *) Fix BVR options in res.partner.bank views |
25 | + |
26 | + *) Remove attachments from payment order view as document addon is fixed |
27 | + |
28 | + *) Various fixes of DTA wizard |
29 | + |
30 | Changes with release 7.0 |
31 | |
32 | *) This release will introduce major changes to l10n_ch. |
33 | - Due to important refactoring needs and the Switzerland adoption of new international payment standard during 2013-2014. |
34 | + Due to important refactoring needs and the Switzerland adoption of new international payment standard during 2013-2014. |
35 | We have reorganised the swiss localization addons this way: |
36 | |
37 | *) l10n_ch: Multilang swiss STERCHI account chart and taxes (official addon) |
38 | - Removing all code not related to account chart |
39 | - Added de_DE, it_IT tranlsation files |
40 | - |
41 | + |
42 | *) l10n_ch_base_bank: Technical module that introduces a new and simplified version of bank type management |
43 | - Type are simplified we add only BV and BVR, bank view is also simplified. |
44 | - |
45 | + |
46 | *) l10n_ch_bank: List of swiss banks |
47 | - No changes, just code ceanup |
48 | - |
49 | + |
50 | *) l10n_ch_zip: List of swiss postal zip |
51 | - - Updated with 2012 data, |
52 | + - Updated with 2012 data, |
53 | - Removing duplicated entries and military NPA (Caserne etc.) |
54 | - |
55 | + |
56 | *) l10n_ch_dta: Support of dta payment protocol (will be deprecated end 2014) |
57 | - Refactoring and clean-up done + adaptation to the new bank type |
58 | - |
59 | + |
60 | *) l10n_ch_payment_slip: Support of ESR/BVR payment slip report and reconciliation. Report refactored with easy element positioning. |
61 | - - Refactoring of Mako CSS. |
62 | + - Refactoring of Mako CSS. |
63 | - Remove of custom parser |
64 | - Cleaning dead code |
65 | + - Switch to commercial_entity for address display |
66 | - TODO a wizard that contatenate the invoice PDF + the payment slip |
67 | - |
68 | + |
69 | *) l10n_ch_sepa: Alpha implementation of PostFinance SEPA/PAIN support will be completed during 2013/2014 |
70 | - -Not ported yet |
71 | + - Not ported yet |
72 | |
73 | Changes with release 6.1 |
74 | |
75 | |
76 | === modified file 'l10n_ch/__openerp__.py' |
77 | --- l10n_ch/__openerp__.py 2013-04-15 09:53:12 +0000 |
78 | +++ l10n_ch/__openerp__.py 2013-07-15 15:22:25 +0000 |
79 | @@ -47,7 +47,7 @@ |
80 | The modules will be soon available on OpenERP swiss localization on launchpad: |
81 | https://launchpad.net/openerp-swiss-localization |
82 | """, |
83 | - 'version': '7.0', |
84 | + 'version': '7.1', |
85 | 'author': 'Camptocamp', |
86 | 'category': 'Localization/Account Charts', |
87 | 'website': 'http://www.camptocamp.com', |
88 | |
89 | === modified file 'l10n_ch_bank/__openerp__.py' |
90 | --- l10n_ch_bank/__openerp__.py 2013-02-15 13:28:41 +0000 |
91 | +++ l10n_ch_bank/__openerp__.py 2013-07-15 15:22:25 +0000 |
92 | @@ -40,4 +40,4 @@ |
93 | "update_xml": [], |
94 | "active": False, |
95 | "installable": True, |
96 | -} |
97 | + } |
98 | |
99 | === modified file 'l10n_ch_base_bank/__openerp__.py' |
100 | --- l10n_ch_base_bank/__openerp__.py 2013-02-15 13:28:41 +0000 |
101 | +++ l10n_ch_base_bank/__openerp__.py 2013-07-15 15:22:25 +0000 |
102 | @@ -19,13 +19,13 @@ |
103 | ############################################################################## |
104 | |
105 | {'name': 'Switzerland - Bank type', |
106 | - 'description': """ |
107 | + 'description': """ |
108 | Swiss localization Bank type. Add new bank types |
109 | ================================================ |
110 | This addons will add different bank type required by |
111 | DTA, and ESR system in order to manage duality of Post and bank systems |
112 | """, |
113 | - 'version': '1.0', |
114 | + 'version': '1.1', |
115 | 'author': 'Camptocamp', |
116 | 'category': 'Localization', |
117 | 'website': 'http://www.camptocamp.com', |
118 | @@ -36,5 +36,5 @@ |
119 | 'auto_install': False, |
120 | 'installable': True, |
121 | 'images': [] |
122 | -} |
123 | + } |
124 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
125 | |
126 | === modified file 'l10n_ch_base_bank/bank.py' |
127 | --- l10n_ch_base_bank/bank.py 2013-02-15 13:24:31 +0000 |
128 | +++ l10n_ch_base_bank/bank.py 2013-07-15 15:22:25 +0000 |
129 | @@ -20,37 +20,11 @@ |
130 | # |
131 | ############################################################################## |
132 | import re |
133 | -from openerp.osv.orm import Model, fields |
134 | +from openerp.osv import orm, fields |
135 | from tools import mod10r |
136 | |
137 | |
138 | -class Bank(Model): |
139 | - """Inherit res.bank class in order to add swiss specific field""" |
140 | - _inherit = 'res.bank' |
141 | - _columns = { |
142 | - ### Internal reference |
143 | - 'code': fields.char('Code', size=64), |
144 | - ###Swiss unik bank identifier also use in IBAN number |
145 | - 'clearing': fields.char('Clearing number', size=64), |
146 | - ### city of the bank |
147 | - 'city': fields.char('City', size=128, select=1), |
148 | - } |
149 | - |
150 | - |
151 | -class ResPartnerBank(Model): |
152 | - """ |
153 | - Inherit res.partner.bank class in order to add swiss specific fields and state controls |
154 | - """ |
155 | - _inherit = "res.partner.bank" |
156 | - |
157 | - _columns = { |
158 | - 'name': fields.char('Description', size=128, required=True), |
159 | - 'bvr_adherent_num': fields.char('Bank BVR adherent number', size=11, |
160 | - help=("Your Bank adherent number to be printed in references of your BVR." |
161 | - "This is not a postal account number.")), |
162 | - 'acc_number': fields.char('Account/IBAN Number', size=64, required=True), |
163 | - } |
164 | - |
165 | +class BankCommon(object): |
166 | |
167 | def _check_9_pos_postal_num(self, number): |
168 | """ |
169 | @@ -63,12 +37,11 @@ |
170 | return False |
171 | nums = number.split('-') |
172 | prefix = nums[0] |
173 | - num = nums[1].rjust(6,'0') |
174 | + num = nums[1].rjust(6, '0') |
175 | checksum = nums[2] |
176 | expected_checksum = mod10r(prefix + num)[-1] |
177 | return expected_checksum == checksum |
178 | |
179 | - |
180 | def _check_5_pos_postal_num(self, number): |
181 | """ |
182 | check if a postal number on 5 positions is correct |
183 | @@ -78,23 +51,152 @@ |
184 | return False |
185 | return True |
186 | |
187 | + |
188 | +class Bank(orm.Model, BankCommon): |
189 | + """Inherit res.bank class in order to add swiss specific field""" |
190 | + _inherit = 'res.bank' |
191 | + _columns = { |
192 | + ### Internal reference |
193 | + 'code': fields.char('Code', size=64, select=True), |
194 | + ###Swiss unik bank identifier also use in IBAN number |
195 | + 'clearing': fields.char('Clearing number', size=64), |
196 | + ### city of the bank |
197 | + 'city': fields.char('City', size=128, select=1), |
198 | + ### ccp of the bank |
199 | + 'ccp': fields.char('CCP', size=64, select=1) |
200 | + } |
201 | + |
202 | + def _check_ccp_duplication(self, cursor, uid, ids): |
203 | + p_acc_obj = self.pool['res.partner.bank'] |
204 | + for bank in self.browse(cursor, uid, ids): |
205 | + p_acc_ids = p_acc_obj.search(cursor, uid, [('bank', '=', bank.id)]) |
206 | + if p_acc_ids: |
207 | + check = p_acc_obj._check_ccp_duplication(cursor, uid, p_acc_ids) |
208 | + if not check: |
209 | + return False |
210 | + return True |
211 | + |
212 | def _check_postal_num(self, cursor, uid, ids): |
213 | """ |
214 | validate postal number format |
215 | """ |
216 | banks = self.browse(cursor, uid, ids) |
217 | - for b in banks: |
218 | - if not b.state in ('bv', 'bvr'): |
219 | - return True |
220 | - return self._check_9_pos_postal_num(b.acc_number) or \ |
221 | - self._check_5_pos_postal_num(b.acc_number) |
222 | - |
223 | - |
224 | - _constraints = [(_check_postal_num, |
225 | - 'Please enter a correct postal number. (01-23456-1 or 12345)', |
226 | - ['acc_number'])] |
227 | + for bank in banks: |
228 | + if not bank.ccp: |
229 | + continue |
230 | + if not (self._check_9_pos_postal_num(bank.ccp) or |
231 | + self._check_5_pos_postal_num(bank.ccp)): |
232 | + return False |
233 | + return True |
234 | + |
235 | + def name_get(self, cursor, uid, ids, context=None): |
236 | + res = [] |
237 | + cols = ('bic', 'name', 'street', 'city') |
238 | + for bank in self.browse(cursor, uid, ids, context): |
239 | + vals = (bank[x] for x in cols if bank[x]) |
240 | + res.append((bank.id, ' - '.join(vals))) |
241 | + return res |
242 | + |
243 | + def name_search(self, cursor, uid, name, args=None, operator='ilike', context=None, limit=80): |
244 | + if args is None: |
245 | + args = [] |
246 | + if context is None: |
247 | + context = {} |
248 | + ids = [] |
249 | + cols = ('code', 'bic', 'name', 'street', 'city') |
250 | + if name: |
251 | + for val in name.split(' '): |
252 | + for col in cols: |
253 | + tmp_ids = self.search(cursor, uid, [(col, 'ilike', val)] + args, limit=limit) |
254 | + if tmp_ids: |
255 | + ids += tmp_ids |
256 | + break |
257 | + # we sort by occurence |
258 | + to_ret_ids = list(set(ids)) |
259 | + to_ret_ids = sorted(to_ret_ids, key=lambda x: ids.count(x), reverse=True) |
260 | + |
261 | + return self.name_get(cursor, uid, to_ret_ids, context=context) |
262 | + |
263 | + _constraints = [(_check_postal_num, |
264 | + 'Please enter a correct postal number. (01-23456-1 or 12345)', |
265 | + ['ccp']), |
266 | + |
267 | + (_check_ccp_duplication, |
268 | + 'You can not enter a ccp both on the bank and on an account' |
269 | + ' of type BV, BVR', |
270 | + ['acc_number', 'bank'])] |
271 | + |
272 | + |
273 | +class ResPartnerBank(orm.Model, BankCommon): |
274 | + """ |
275 | + Inherit res.partner.bank class in order to add swiss specific fields and state controls |
276 | + """ |
277 | + _inherit = 'res.partner.bank' |
278 | + |
279 | + _columns = { |
280 | + 'name': fields.char('Description', size=128, required=True), |
281 | + 'bvr_adherent_num': fields.char('Bank BVR adherent number', size=11, |
282 | + help=("Your Bank adherent number to be printed in references of your BVR." |
283 | + "This is not a postal account number.")), |
284 | + 'acc_number': fields.char('Account/IBAN Number', size=64, required=True), |
285 | + 'ccp': fields.related('bank', 'ccp', type='char', string='CCP', |
286 | + readonly=True), |
287 | + } |
288 | + |
289 | + def get_account_number(self, cursor, uid, bid, context=None): |
290 | + if isinstance(bid, list): |
291 | + bid = bid[0] |
292 | + current = self.browse(cursor, uid, bid, context=context) |
293 | + if current.state not in ('bv', 'bvr'): |
294 | + return current.acc_number |
295 | + if current.bank and current.bank.ccp: |
296 | + return current.bank.ccp |
297 | + else: |
298 | + return current.acc_number |
299 | + |
300 | + def _check_postal_num(self, cursor, uid, ids): |
301 | + """ |
302 | + validate postal number format |
303 | + """ |
304 | + p_banks = self.browse(cursor, uid, ids) |
305 | + for p_bank in p_banks: |
306 | + if not p_bank.state in ('bv', 'bvr'): |
307 | + continue |
308 | + if not (self._check_9_pos_postal_num(p_bank.get_account_number()) or |
309 | + self._check_5_pos_postal_num(p_bank.get_account_number())): |
310 | + return False |
311 | + return True |
312 | + |
313 | + def _check_ccp_duplication(self, cursor, uid, ids): |
314 | + """ |
315 | + Ensure that there is not a ccp in bank and res partner bank |
316 | + at same time |
317 | + """ |
318 | + p_banks = self.browse(cursor, uid, ids) |
319 | + for p_bank in p_banks: |
320 | + if not p_bank.state in ('bv', 'bvr'): |
321 | + continue |
322 | + bank_ccp = p_bank.bank.ccp if p_bank.bank else False |
323 | + if not bank_ccp: |
324 | + continue |
325 | + part_bank_check = (self._check_5_pos_postal_num(p_bank.acc_number) or |
326 | + self._check_9_pos_postal_num(p_bank.acc_number)) |
327 | + bank_check = (self._check_5_pos_postal_num(p_bank.bank.ccp) or |
328 | + self._check_9_pos_postal_num(p_bank.bank.ccp)) |
329 | + if part_bank_check and bank_check: |
330 | + return False |
331 | + return True |
332 | + |
333 | + _constraints = [(_check_postal_num, |
334 | + 'Please enter a correct postal number. (01-23456-1 or 12345)', |
335 | + ['acc_number']), |
336 | + |
337 | + (_check_ccp_duplication, |
338 | + 'You can not enter a ccp both on the bank and on an account' |
339 | + ' of type BV, BVR', |
340 | + ['acc_number', 'bank'])] |
341 | |
342 | _sql_constraints = [('bvr_adherent_uniq', 'unique (bvr_adherent_num)', |
343 | - 'The BVR adherent number must be unique !')] |
344 | + 'The BVR adherent number must be unique !')] |
345 | |
346 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
347 | |
348 | === modified file 'l10n_ch_base_bank/bank_view.xml' |
349 | --- l10n_ch_base_bank/bank_view.xml 2013-02-08 11:19:29 +0000 |
350 | +++ l10n_ch_base_bank/bank_view.xml 2013-07-15 15:22:25 +0000 |
351 | @@ -42,5 +42,68 @@ |
352 | </field> |
353 | </field> |
354 | </record> |
355 | + |
356 | + <record id="view__bank_search" model="ir.ui.view"> |
357 | + <field name="name">res.bank.search</field> |
358 | + <field name="model">res.bank</field> |
359 | + <field name="arch" type="xml"> |
360 | + <search string="Banks"> |
361 | + <filter name="Postfinance" |
362 | + icon="terp-check" string="PostFinance" |
363 | + domain="[('bic', '=', 'POFICHBEXXX')]" |
364 | + help="PostFinance"/> |
365 | + <field name="name"/> |
366 | + <field name="code"/> |
367 | + <field name="street"/> |
368 | + <field name="city"/> |
369 | + |
370 | + </search> |
371 | + </field> |
372 | + </record> |
373 | + |
374 | + <!-- 'POFICHBEXXX' corresponds to Postfinance bic --> |
375 | + |
376 | + <record model="ir.ui.view" id="add_custom_fields_on_bank"> |
377 | + <field name="name">add custom fields on bank</field> |
378 | + <field name="model">res.bank</field> |
379 | + <field name="type">form</field> |
380 | + <field name="inherit_id" ref="base.view_res_bank_form"/> |
381 | + <field name="arch" type="xml"> |
382 | + <field name="bic" position="after"> |
383 | + <field name="code"/> |
384 | + <field name="clearing"/> |
385 | + <field name="ccp" attrs="{'invisible': [('bic', '=', 'POFICHBEXXX')]}"/> |
386 | + </field> |
387 | + </field> |
388 | + </record> |
389 | + |
390 | + <record model="ir.ui.view" id="add_custom_fields_on_bank_list"> |
391 | + <field name="name">add custom fields on bank list</field> |
392 | + <field name="model">res.bank</field> |
393 | + <field name="type">form</field> |
394 | + <field name="inherit_id" ref="base.view_res_bank_tree"/> |
395 | + <field name="arch" type="xml"> |
396 | + <field name="bic" position="after"> |
397 | + <field name="code"/> |
398 | + <field name="clearing"/> |
399 | + <field name="ccp"/> |
400 | + <field name="street"/> |
401 | + <field name="city"/> |
402 | + </field> |
403 | + </field> |
404 | + </record> |
405 | + |
406 | + <record model="ir.ui.view" id="add_ccp_on_res_partner_bank"> |
407 | + <field name="name">Add ccp on res partner bank</field> |
408 | + <field name="model">res.partner.bank</field> |
409 | + <field name="type">form</field> |
410 | + <field name="inherit_id" ref="base.view_partner_bank_form"/> |
411 | + <field name="arch" type="xml"> |
412 | + <field name="bank_bic" position="after"> |
413 | + <field name="ccp" attrs="{'invisible': [('bank_bic', '=', 'POFICHBEXXX')]}"/> |
414 | + </field> |
415 | + </field> |
416 | + </record> |
417 | + |
418 | </data> |
419 | </openerp> |
420 | |
421 | === modified file 'l10n_ch_dta/__openerp__.py' |
422 | --- l10n_ch_dta/__openerp__.py 2013-02-15 13:28:41 +0000 |
423 | +++ l10n_ch_dta/__openerp__.py 2013-07-15 15:22:25 +0000 |
424 | @@ -31,8 +31,7 @@ |
425 | 'website': 'http://www.camptocamp.com', |
426 | 'depends': ['base', 'account_payment', 'l10n_ch_base_bank'], |
427 | 'data': ["wizard/create_dta_view.xml", |
428 | - "bank_view.xml", |
429 | - "payent_view.xml"], |
430 | + "bank_view.xml"], |
431 | 'demo': ["demo/dta_demo.xml"], |
432 | 'test': [], # To be ported or migrate to unit tests or scenarios |
433 | 'auto_install': False, |
434 | |
435 | === modified file 'l10n_ch_dta/bank_view.xml' |
436 | --- l10n_ch_dta/bank_view.xml 2013-02-08 12:51:18 +0000 |
437 | +++ l10n_ch_dta/bank_view.xml 2013-07-15 15:22:25 +0000 |
438 | @@ -7,11 +7,11 @@ |
439 | <field name="inherit_id" ref="base.view_partner_bank_form"/> |
440 | <field name="arch" type="xml"> |
441 | <group name="bank" position="after"> |
442 | - <group string="DTA options" attrs="{'invisible': ['|', ('company_id', '=', False), ('state','in',['bv','bvr'])]}"> |
443 | + <group string="DTA options" attrs="{'invisible': [('company_id', '=', False)]}"> |
444 | <field name="dta_code"/> |
445 | </group> |
446 | </group> |
447 | </field> |
448 | </record> |
449 | </data> |
450 | -</openerp> |
451 | \ No newline at end of file |
452 | +</openerp> |
453 | |
454 | === removed file 'l10n_ch_dta/payent_view.xml' |
455 | --- l10n_ch_dta/payent_view.xml 2013-02-07 10:35:27 +0000 |
456 | +++ l10n_ch_dta/payent_view.xml 1970-01-01 00:00:00 +0000 |
457 | @@ -1,16 +0,0 @@ |
458 | -<openerp> |
459 | - <data> |
460 | - <record id="add_dta_files" model="ir.ui.view"> |
461 | - <field name="name">Add DTA files</field> |
462 | - <field name="model">payment.order</field> |
463 | - <field name="inherit_id" ref="account_payment.view_payment_order_form" /> |
464 | - <field name="type">form</field> |
465 | - <field name="arch" type="xml"> |
466 | - <field name="line_ids" position="before"> |
467 | - <label string="DTA"/> |
468 | - <field name="dta_ids" colspan="4"/> |
469 | - </field> |
470 | - </field> |
471 | - </record> |
472 | - </data> |
473 | -</openerp> |
474 | |
475 | === modified file 'l10n_ch_dta/wizard/create_dta.py' |
476 | --- l10n_ch_dta/wizard/create_dta.py 2013-02-15 13:28:41 +0000 |
477 | +++ l10n_ch_dta/wizard/create_dta.py 2013-07-15 15:22:25 +0000 |
478 | @@ -26,7 +26,7 @@ |
479 | import unicode2ascii |
480 | |
481 | from openerp.osv.osv import except_osv |
482 | -from openerp.osv.orm import TransientModel, fields |
483 | +from openerp.osv.orm import TransientModel |
484 | from openerp.tools.translate import _ |
485 | from tools import mod10r |
486 | |
487 | @@ -37,13 +37,13 @@ |
488 | (u'î', 'i'), |
489 | (u'ï', 'i'), |
490 | (u'â', 'a'), |
491 | - (u'ä', 'a'), |
492 | - ] |
493 | + (u'ä', 'a')] |
494 | |
495 | |
496 | def _u2a(text): |
497 | """Tries to convert unicode charactere to asci equivalence""" |
498 | - if not text: return "" |
499 | + if not text: |
500 | + return "" |
501 | txt = "" |
502 | for c in text: |
503 | if ord(c) < 128: |
504 | @@ -56,7 +56,8 @@ |
505 | txt += unicode2ascii.EXTRA_CHARACTERS[c] |
506 | elif c in unicode2ascii.FG_HACKS: |
507 | txt += unicode2ascii.FG_HACKS[c] |
508 | - else: txt += "_" |
509 | + else: |
510 | + txt += "_" |
511 | return txt |
512 | |
513 | |
514 | @@ -80,8 +81,7 @@ |
515 | self.pool = pool |
516 | self.pline = pline |
517 | for i in global_context_dict: |
518 | - global_context_dict[i] = global_context_dict[i] \ |
519 | - and tr(global_context_dict[i]) |
520 | + global_context_dict[i] = global_context_dict[i] and tr(global_context_dict[i]) |
521 | self.fields = [] |
522 | self.global_values = global_context_dict |
523 | self.validate_global_context_dict() |
524 | @@ -216,14 +216,15 @@ |
525 | super(record_gt826, self).validate_global_context_dict() |
526 | if not self.global_values['reference']: |
527 | raise except_osv(_('Error'), |
528 | - _('You must provide a BVR reference number \n for the line: %s') % self.pline.name) |
529 | + _('You must provide a BVR reference' |
530 | + 'number \n for the line: %s') % self.pline.name) |
531 | |
532 | self.global_values['reference'] = self.global_values['reference'].replace(' ', '') |
533 | if self.is_9_pos_adherent: |
534 | if len(self.global_values['reference']) > 27: |
535 | raise except_osv(_('Error'), |
536 | - _('BVR reference number is not valid \n for the line: %s. \n' |
537 | - 'Reference is too long.') % self.pline.name) |
538 | + _('BVR reference number is not valid \n for the line: %s. \n' |
539 | + 'Reference is too long.') % self.pline.name) |
540 | # do a mod10 check |
541 | if mod10r(self.global_values['reference'][:-1]) != self.global_values['reference']: |
542 | raise except_osv(_('Error'), |
543 | @@ -247,7 +248,7 @@ |
544 | raise except_osv(_('Error'), |
545 | _('You must provide a BVR number\n' |
546 | 'for the bank account: %s' |
547 | - 'on line: %s') % (self.pline.bank_id.acc_number, self.pline.name)) |
548 | + 'on line: %s') % (self.pline.bank_id.get_account_number(), self.pline.name)) |
549 | |
550 | |
551 | class record_gt827(postal_record): |
552 | @@ -260,19 +261,13 @@ |
553 | raise except_osv(_('Error'), |
554 | _('You must provide a bank number \n' |
555 | 'for the partner bank: %s\n on line: %s') % |
556 | - (self.pline.bank_id.acc_number, self.pline.name)) |
557 | - if not self.global_values['partner_bank_clearing']: |
558 | + (self.pline.bank_id.get_account_number(), self.pline.name)) |
559 | + if not self.global_values['partner_bank_clearing']: |
560 | raise except_osv(_('Error'), |
561 | _('You must provide a Clearing Number\n' |
562 | 'for the partner bank: %s\n on line %s') % |
563 | - (self.pline.bank_id.acc_number, self.pline.name)) |
564 | + (self.pline.bank_id.get_account_number(), self.pline.name)) |
565 | self.global_values['partner_bank_number'] = '/C/' + self.global_values['partner_bank_number'] |
566 | - if not self.global_values['partner_post_number']: |
567 | - raise except_osv(_('Error'), |
568 | - _('You must provide a post number \n for the partner bank: %s\n' |
569 | - 'on line: %s') % (self.pline.bank_id.acc_number, self.pline.name)) |
570 | - self.global_values['partner_bank_clearing'] = '' |
571 | - self.global_values['partner_bank_number'] = '/C/' + self.global_values['partner_post_number'] |
572 | |
573 | def init_local_context(self): |
574 | self.fields = [ |
575 | @@ -341,19 +336,20 @@ |
576 | |
577 | def validate_global_context_dict(self): |
578 | part = self.pline.partner_id |
579 | - self.global_values['partner_country']= part.country_id and part.country_id.code + '-' or '' |
580 | + self.global_values['partner_country'] = part.country_id and part.country_id.code + '-' or '' |
581 | co_addr = self.pline.order_id.company_id |
582 | self.global_values['comp_country'] = co_addr.country_id and co_addr.country_id.code + '-' or '' |
583 | if not self.global_values['partner_bank_iban']: |
584 | raise except_osv(_('Error'), |
585 | _('No IBAN defined \n for the bank account: %s\n' |
586 | - 'on line: %s') % (self.pline.bank_id.acc_number, self.pline.name)) |
587 | - if self.global_values['partner_bank_code']: # bank code is swift (BIC address) |
588 | - self.global_values['option_id_bank']= 'A' |
589 | - self.global_values['partner_bank_ident']= self.global_values['partner_bank_code'] |
590 | + 'on line: %s') % (self.pline.bank_id.get_account_number(), |
591 | + self.pline.name)) |
592 | + if self.global_values['partner_bank_code']: # Bank code is swift (BIC address) |
593 | + self.global_values['option_id_bank'] = 'A' |
594 | + self.global_values['partner_bank_ident'] = self.global_values['partner_bank_code'] |
595 | elif self.global_values['partner_bank_city']: |
596 | self.global_values['option_id_bank'] = 'D' |
597 | - self.global_values['partner_bank_ident']= self.global_values['partner_bank_name'] \ |
598 | + self.global_values['partner_bank_ident'] = self.global_values['partner_bank_name'] \ |
599 | + ' ' + self.global_values['partner_bank_street'] \ |
600 | + ' ' + self.global_values['partner_bank_zip'] \ |
601 | + ' ' + self.global_values['partner_bank_city'] \ |
602 | @@ -361,8 +357,8 @@ |
603 | else: |
604 | raise except_osv(_('Error'), |
605 | _('You must provide the bank city ' |
606 | - 'or the bic code for the partner bank: \n %s\n on line: %s') % (self.pline.bank_id.acc_number, self.pline.name)) |
607 | - |
608 | + 'or the bic code for the partner bank: \n %s\n on line: %s') % |
609 | + (self.pline.bank_id.get_account_number(), self.pline.name)) |
610 | |
611 | def init_local_context(self): |
612 | self.fields = [ |
613 | @@ -453,17 +449,19 @@ |
614 | ('padding', 59) |
615 | ] |
616 | self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '', |
617 | - 'company_bank_clearing': '', 'genre_trans': '890'}) |
618 | + 'company_bank_clearing': '', 'genre_trans': '890'}) |
619 | + |
620 | def validate_global_context_dict(self): |
621 | return |
622 | |
623 | + |
624 | def c_ljust(s, size): |
625 | """ |
626 | check before calling ljust |
627 | """ |
628 | - s= s or '' |
629 | + s = s or '' |
630 | if len(s) > size: |
631 | - s= s[:size] |
632 | + s = s[:size] |
633 | s = s.decode('utf-8').encode('latin1', 'replace').ljust(size) |
634 | return s |
635 | |
636 | @@ -517,8 +515,8 @@ |
637 | elec_context['partner_bank_city'] = pline.bank_id.bank.city or False |
638 | elec_context['partner_bank_street'] = pline.bank_id.bank.street or '' |
639 | elec_context['partner_bank_zip'] = pline.bank_id.bank.zip or '' |
640 | - elec_context['partner_bank_country'] = pline.bank_id.bank.country and \ |
641 | - pline.bank_id.bank.country.name or '' |
642 | + elec_context['partner_bank_country'] = (pline.bank_id.bank.country and |
643 | + pline.bank_id.bank.country.name or '') |
644 | |
645 | elec_context['partner_bank_code'] = pline.bank_id.bank_bic |
646 | elec_context['reference'] = pline.move_line_id.ref |
647 | @@ -531,7 +529,7 @@ |
648 | elec_context['partner_zip'] = part.zip |
649 | |
650 | # If iban => country=country code for space reason |
651 | - elec_context['partner_country']= part.country_id and part.country_id.name or '' |
652 | + elec_context['partner_country'] = part.country_id and part.country_id.name or '' |
653 | else: |
654 | raise except_osv(_('Error'), |
655 | _('No address defined \n for the partner: %s on line') % |
656 | @@ -545,9 +543,10 @@ |
657 | raise except_osv(_('Error'), |
658 | _('No bank defined for the bank account: %s\n' |
659 | 'on the partner: %s\n on line: %s') % (pline.bank_id.state, |
660 | - pline.partner_id.name, pline.name)) |
661 | + pline.partner_id.name, |
662 | + pline.name)) |
663 | elec_context['sequence'] = str(seq).rjust(5).replace(' ', '0') |
664 | - elec_context['amount_to_pay']= str(pline.amount_currency).replace('.', ',') |
665 | + elec_context['amount_to_pay'] = str(pline.amount_currency).replace('.', ',') |
666 | elec_context['number'] = pline.name |
667 | elec_context['currency'] = pline.currency.name |
668 | elec_context['partner_bank_name'] = pline.bank_id.bank_name or False |
669 | @@ -556,13 +555,14 @@ |
670 | raise except_osv(_('Error'), |
671 | _('No bank name defined\n for the bank account: %s\n' |
672 | 'on the partner: %s\n on line: %s') % (pline.bank_id.state, |
673 | - pline.partner_id.name, pline.name)) |
674 | - elec_context['partner_bank_iban'] = pline.bank_id.acc_number or False |
675 | - number = pline.bank_id.acc_number or '' |
676 | + pline.partner_id.name, |
677 | + pline.name)) |
678 | + elec_context['partner_bank_iban'] = (pline.bank_id.get_account_number() or False) |
679 | + number = pline.bank_id.get_account_number() or '' |
680 | elec_context['partner_bank_number'] = number.replace('.', '').replace('-', '') or False |
681 | elec_context['partner_bvr'] = '' |
682 | if pline.bank_id.state in ('bv', 'bvr'): |
683 | - elec_context['partner_bvr'] = pline.bank_id.acc_number or '' |
684 | + elec_context['partner_bvr'] = pline.bank_id.get_account_number() or '' |
685 | self._set_bank_data(cr, uid, data, pline, elec_context, seq, context=context) |
686 | if pline.order_id.date_scheduled: |
687 | date_value = datetime.strptime(pline.order_id.date_scheduled, '%Y-%m-%d') |
688 | @@ -573,8 +573,6 @@ |
689 | elec_context['date_value'] = date_value.strftime("%y%m%d") |
690 | return elec_context |
691 | |
692 | - |
693 | - |
694 | def _create_dta(self, cr, uid, data, context=None): |
695 | if context is None: |
696 | context = {} |
697 | @@ -589,14 +587,18 @@ |
698 | amount_currency_tot = 0 |
699 | |
700 | for pline in payment.line_ids: |
701 | - elec_context = self._process_payment_lines(cr, uid, data, pline, elec_context, seq, context=context) |
702 | + elec_context = self._process_payment_lines(cr, uid, data, pline, |
703 | + elec_context, seq, context=context) |
704 | # si compte iban -> iban (836) |
705 | # si payment structure -> bvr (826) |
706 | # si non -> (827) |
707 | elec_pay = pline.bank_id.state # Bank type |
708 | + country_code = pline.partner_id.country_id.code if pline.partner_id.country_id else False |
709 | if elec_pay in ['iban', 'bank']: |
710 | # If iban => country=country code for space reason |
711 | record_type = record_gt836 |
712 | + elif country_code and country_code != 'CH': |
713 | + record_type = record_gt836 |
714 | elif elec_pay == 'bvr': |
715 | record_type = record_gt826 |
716 | elif elec_pay == 'bv': |
717 | @@ -621,22 +623,17 @@ |
718 | dta_data = _u2a(dta) |
719 | dta_data = base64.encodestring(dta) |
720 | payment_obj.set_done(cr, uid, [data['id']], context) |
721 | - dta_dict = {'name': 'DTA%s'%time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), |
722 | - 'datas': dta_data, |
723 | - 'datas_fname': 'DTA%s.txt'%time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), |
724 | - 'res_model': 'payment.order', |
725 | - 'res_id': data['id']} |
726 | + dta_dict = {'name': 'DTA%s' % time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), |
727 | + 'datas': dta_data, |
728 | + 'datas_fname': 'DTA%s.txt' % time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), |
729 | + 'res_model': 'payment.order', |
730 | + 'res_id': data['id']} |
731 | dta_id = attachment_obj.create(cr, uid, dta_dict, context=context) |
732 | return dta_data |
733 | |
734 | def create_dta(self, cr, uid, ids, context=None): |
735 | if not context: |
736 | context = {} |
737 | - if isinstance(ids, list): |
738 | - req_id = ids[0] |
739 | - else: |
740 | - req_id = ids |
741 | - current = self.browse(cr, uid, req_id, context) |
742 | data = {} |
743 | active_ids = context.get('active_ids', []) |
744 | active_id = context.get('active_id', []) |
745 | |
746 | === modified file 'l10n_ch_invoice_rounding/account.py' |
747 | --- l10n_ch_invoice_rounding/account.py 2013-06-28 09:28:27 +0000 |
748 | +++ l10n_ch_invoice_rounding/account.py 2013-07-15 15:22:25 +0000 |
749 | @@ -142,16 +142,16 @@ |
750 | Add l10n computing and make sure invoice line for rounding is not computed in totals |
751 | """ |
752 | res = super(AccountInvoice, self)._amount_all(cr, uid, ids, name, args, context=context) |
753 | - |
754 | for invoice in self.browse(cr, uid, ids, context=context): |
755 | - if invoice.global_round_line_id: |
756 | - res[invoice.id]['amount_untaxed'] -= invoice.global_round_line_id.price_subtotal |
757 | - |
758 | - amount_total = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed'] |
759 | - res[invoice.id]['amount_total'] = amount_total |
760 | - |
761 | - l10n_rounding = self._compute_l10n_rounding(cr, uid, invoice, res[invoice.id], context=context) |
762 | - res[invoice.id].update(l10n_rounding) |
763 | + if invoice.type in ('out_invoice','out_refund'): |
764 | + if invoice.global_round_line_id: |
765 | + res[invoice.id]['amount_untaxed'] -= invoice.global_round_line_id.price_subtotal |
766 | + |
767 | + amount_total = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed'] |
768 | + res[invoice.id]['amount_total'] = amount_total |
769 | + |
770 | + l10n_rounding = self._compute_l10n_rounding(cr, uid, invoice, res[invoice.id], context=context) |
771 | + res[invoice.id].update(l10n_rounding) |
772 | return res |
773 | |
774 | |
775 | |
776 | === added directory 'l10n_ch_invoice_rounding/documentation' |
777 | === added file 'l10n_ch_invoice_rounding/documentation/DOC_l10n_ch_5cts_roundings.ods' |
778 | Binary files l10n_ch_invoice_rounding/documentation/DOC_l10n_ch_5cts_roundings.ods 1970-01-01 00:00:00 +0000 and l10n_ch_invoice_rounding/documentation/DOC_l10n_ch_5cts_roundings.ods 2013-07-15 15:22:25 +0000 differ |
779 | === modified file 'l10n_ch_payment_slip/bank_view.xml' |
780 | --- l10n_ch_payment_slip/bank_view.xml 2013-02-22 10:52:59 +0000 |
781 | +++ l10n_ch_payment_slip/bank_view.xml 2013-07-15 15:22:25 +0000 |
782 | @@ -7,7 +7,7 @@ |
783 | <field name="inherit_id" ref="base.view_partner_bank_form"/> |
784 | <field name="arch" type="xml"> |
785 | <group name="bank" position="after"> |
786 | - <group string="BVR options" attrs="{'invisible': [('state','not in',['bvr','bv'])]}" > |
787 | + <group string="BVR options" attrs="{'invisible': ['|', ('state','not in',['bvr', 'bv']), ('company_id' ,'=', False)]}" > |
788 | <field name="bvr_adherent_num" attrs="{'invisible': [('state','!=','bvr')]}"/> |
789 | <field name="print_bank"/> |
790 | <field name="print_account"/> |
791 | @@ -17,4 +17,4 @@ |
792 | </field> |
793 | </record> |
794 | </data> |
795 | -</openerp> |
796 | \ No newline at end of file |
797 | +</openerp> |
798 | |
799 | === modified file 'l10n_ch_payment_slip/company_view.xml' |
800 | --- l10n_ch_payment_slip/company_view.xml 2013-01-14 15:32:44 +0000 |
801 | +++ l10n_ch_payment_slip/company_view.xml 2013-07-15 15:22:25 +0000 |
802 | @@ -11,12 +11,12 @@ |
803 | <group colspan="4"> |
804 | <field name="bvr_delta_horz"/> |
805 | <field name="bvr_delta_vert"/> |
806 | + <field name="bvr_scan_line_horz"/> |
807 | <field name="bvr_scan_line_vert"/> |
808 | - <field name="bvr_scan_line_horz"/> |
809 | <field name="bvr_scan_line_font_size"/> |
810 | <field name="bvr_scan_line_letter_spacing"/> |
811 | + <field name="bvr_add_horz"/> |
812 | <field name="bvr_add_vert"/> |
813 | - <field name="bvr_add_horz"/> |
814 | <field name="bvr_background"/> |
815 | </group> |
816 | </page> |
817 | |
818 | === modified file 'l10n_ch_payment_slip/invoice.py' |
819 | --- l10n_ch_payment_slip/invoice.py 2013-04-05 06:44:43 +0000 |
820 | +++ l10n_ch_payment_slip/invoice.py 2013-07-15 15:22:25 +0000 |
821 | @@ -30,7 +30,6 @@ |
822 | |
823 | _compile_get_ref = re.compile('[^0-9]') |
824 | |
825 | - |
826 | def _get_reference_type(self, cursor, user, context=None): |
827 | """Function use by the function field reference_type in order to initalise available |
828 | BVR Reference Types""" |
829 | @@ -39,7 +38,6 @@ |
830 | res.append(('bvr', 'BVR')) |
831 | return res |
832 | |
833 | - |
834 | def _compute_full_bvr_name(self, cursor, uid, ids, field_names, arg, context=None): |
835 | res = {} |
836 | for inv in self.browse(cursor, uid, ids, context=context): |
837 | @@ -63,12 +61,16 @@ |
838 | if isinstance(inv_id, list): |
839 | inv_id = inv_id[0] |
840 | inv = self.browse(cursor, uid, inv_id, context=context) |
841 | + ## We check if the type is bvr, if not we return false |
842 | + if inv.partner_bank_id.state != 'bvr': |
843 | + return '' |
844 | + ## |
845 | if inv.partner_bank_id.bvr_adherent_num: |
846 | res = inv.partner_bank_id.bvr_adherent_num |
847 | invoice_number = '' |
848 | if inv.number: |
849 | invoice_number = self._compile_get_ref.sub('', inv.number) |
850 | - return mod10r(res + invoice_number.rjust(26-len(res), '0')) |
851 | + return mod10r(res + invoice_number.rjust(26 - len(res), '0')) |
852 | |
853 | def _space(self, nbr, nbrspc=5): |
854 | """Spaces * 5. |
855 | @@ -79,37 +81,33 @@ |
856 | """ |
857 | return ''.join([' '[(i - 2) % nbrspc:] + c for i, c in enumerate(nbr)]) |
858 | |
859 | - |
860 | def action_number(self, cursor, uid, ids, context=None): |
861 | res = super(AccountInvoice, self).action_number(cursor, uid, ids, context=context) |
862 | for inv in self.browse(cursor, uid, ids, context=context): |
863 | - if inv.type != 'out_invoice': |
864 | + if inv.type != 'out_invoice' or inv.partner_bank_id.state != 'bvr': |
865 | continue |
866 | ref = inv.get_bvr_ref() |
867 | - inv.write({'reference': ref}) |
868 | move_id = inv.move_id |
869 | if move_id: |
870 | - cursor.execute('UPDATE account_move SET ref=%s ' \ |
871 | - 'WHERE id=%s', |
872 | - (ref, move_id.id)) |
873 | - cursor.execute('UPDATE account_move_line SET ref=%s ' \ |
874 | - 'WHERE move_id=%s', |
875 | - (ref, move_id.id)) |
876 | - cursor.execute('UPDATE account_analytic_line SET ref=%s ' \ |
877 | - 'FROM account_move_line ' \ |
878 | - 'WHERE account_move_line.move_id = %s ' \ |
879 | - 'AND account_analytic_line.move_id = account_move_line.id', |
880 | - (ref, move_id.id)) |
881 | + cursor.execute('UPDATE account_move SET ref=%s' |
882 | + ' WHERE id=%s', |
883 | + (ref, move_id.id)) |
884 | + cursor.execute('UPDATE account_move_line SET ref=%s' |
885 | + ' WHERE move_id=%s', |
886 | + (ref, move_id.id)) |
887 | + cursor.execute('UPDATE account_analytic_line SET ref=%s' |
888 | + ' FROM account_move_line ' |
889 | + ' WHERE account_move_line.move_id = %s ' |
890 | + ' AND account_analytic_line.move_id = account_move_line.id', |
891 | + (ref, move_id.id)) |
892 | return res |
893 | |
894 | def copy(self, cursor, uid, inv_id, default=None, context=None): |
895 | default = default or {} |
896 | - default.update({'reference' : False}) |
897 | + default.update({'reference': False}) |
898 | return super(AccountInvoice, self).copy(cursor, uid, inv_id, default, context) |
899 | |
900 | |
901 | - |
902 | - |
903 | class AccountTaxCode(Model): |
904 | """Inherit account tax code in order |
905 | to add a Case code""" |
906 | |
907 | === modified file 'l10n_ch_payment_slip/report/bvr.mako' |
908 | --- l10n_ch_payment_slip/report/bvr.mako 2013-04-10 09:37:53 +0000 |
909 | +++ l10n_ch_payment_slip/report/bvr.mako 2013-07-15 15:22:25 +0000 |
910 | @@ -179,12 +179,12 @@ |
911 | <!--adresses + info block --> |
912 | <table class="dest_address_bvr" style="position:absolute;width:230px;word-wrap:break-word"> |
913 | |
914 | - %if inv.partner_id.title: |
915 | - <tr><td>${inv.partner_id.title.name}</tr></td> |
916 | - %endif |
917 | - %if inv.partner_id.name: |
918 | - <tr><td>${inv.partner_id.name}</td></tr> |
919 | - %endif |
920 | + %if inv.partner_id.id != inv.commercial_partner_id.id: |
921 | + <tr><td>${inv.commercial_partner_id.name or ''}</td></tr> |
922 | + <tr><td>${inv.partner_id.title and inv.partner_id.title.name or ''} ${inv.partner_id.name }</td></tr> |
923 | + %else: |
924 | + <tr><td>${inv.partner_id.title and inv.partner_id.title.name or ''} ${inv.partner_id.name }</td></tr> |
925 | + %endif |
926 | <tr><td>${inv.partner_id.street or ''|entity}</td></tr> |
927 | <tr><td>${inv.partner_id.street2 or ''|entity}</td></tr> |
928 | <tr><td>${inv.partner_id.zip or ''|entity} ${inv.partner_id.city or ''|entity}</td></tr> |
929 | @@ -209,10 +209,11 @@ |
930 | <table class="slip_add"> |
931 | <tr><td>${_space(_get_ref(inv))}</td></tr> |
932 | <tr><td> |
933 | - %if title: |
934 | - ${inv.partner_id.title.name or ''|entity} |
935 | - %endif |
936 | - ${inv.partner_id.name |entity}</td></tr> |
937 | + %if inv.partner_id.id != inv.commercial_partner_id.id: |
938 | + ${inv.commercial_partner_id.name or ''|entity}</td></tr> |
939 | + %else: |
940 | + ${inv.partner_id.name |entity}</td></tr> |
941 | + %endif |
942 | <tr><td>${inv.partner_id.street or ''|entity}</td></tr> |
943 | <tr><td>${inv.partner_id.street2 or ''|entity}</td></tr> |
944 | <tr><td>${inv.partner_id.zip or ''|entity} ${inv.partner_id.city or ''|entity}</td></tr> |
945 | @@ -226,7 +227,7 @@ |
946 | %endif |
947 | |
948 | |
949 | - <div id="slip_bank_acc" class="slip_bank_acc">${inv.partner_bank_id.print_account and inv.partner_bank_id.acc_number or ''}</div> |
950 | + <div id="slip_bank_acc" class="slip_bank_acc">${inv.partner_bank_id.print_account and inv.partner_bank_id.get_account_number() or ''}</div> |
951 | |
952 | <div id="slip_amount" class="slip_amount"><span >${" ".join(_space(('%.2f' % inv.amount_total)[:-3], 1))}</span> <span style="padding-left:6mm">${" ".join(_space(('%.2f' % inv.amount_total)[-2:], 1))}</span></div> |
953 | |
954 | @@ -247,10 +248,11 @@ |
955 | <div id="slip2_address_b" class="slip2_address_b"> |
956 | <table class="slip_add"> |
957 | <tr><td> |
958 | - %if title: |
959 | - ${inv.partner_id.title.name or ''|entity} |
960 | - %endif |
961 | - ${inv.partner_id.name |entity}</td></tr> |
962 | + %if inv.partner_id.id != inv.commercial_partner_id.id: |
963 | + ${inv.commercial_partner_id.name or ''|entity}</td></tr> |
964 | + %else: |
965 | + ${inv.partner_id.name |entity}</td></tr> |
966 | + %endif |
967 | <tr><td>${inv.partner_id.street or ''|entity}</td></tr> |
968 | <tr><td>${inv.partner_id.street2 or ''|entity}</td></tr> |
969 | <tr><td>${inv.partner_id.zip or ''|entity} ${inv.partner_id.city or ''|entity}</td></tr> |
970 | @@ -260,10 +262,11 @@ |
971 | %if inv.partner_bank_id.print_partner: |
972 | <div id="slip2_comp" class="slip2_comp"> |
973 | <table class="slip_add"> |
974 | - <tr><td>${user.company_id.partner_id.name}</td></tr> |
975 | - <tr><td>${user.company_id.partner_id.street}</td></tr> |
976 | - <tr><td></td></tr> |
977 | - <tr><td>${user.company_id.partner_id.city} ${user.company_id.partner_id.zip}</td></tr> |
978 | + <tr><td> |
979 | + <tr><td>${user.company_id.partner_id.name}</td></tr> |
980 | + <tr><td>${user.company_id.partner_id.street}</td></tr> |
981 | + <tr><td></td></tr> |
982 | + <tr><td>${user.company_id.partner_id.city} ${user.company_id.partner_id.zip}</td></tr> |
983 | </table> |
984 | </div> |
985 | %endif |
986 | @@ -275,7 +278,7 @@ |
987 | </div> |
988 | %endif |
989 | |
990 | - <div id="slip2_bank_acc" class="slip2_bank_acc">${inv.partner_bank_id.print_account and inv.partner_bank_id.acc_number or ''}</div> |
991 | + <div id="slip2_bank_acc" class="slip2_bank_acc">${inv.partner_bank_id.print_account and inv.partner_bank_id.get_account_number() or ''}</div> |
992 | <!--- scaner code bar --> |
993 | <div id="ocrbb"> |
994 | <% |
995 | @@ -286,7 +289,7 @@ |
996 | tt += [v for v in _get_ref(inv)] |
997 | tt.append('+') |
998 | tt.append(' ') |
999 | - tt += [v for v in inv.partner_bank_id.acc_number.split('-')[0]+(str(inv.partner_bank_id.acc_number.split('-')[1])).rjust(6,'0')+inv.partner_bank_id.acc_number.split\ |
1000 | + tt += [v for v in inv.partner_bank_id.get_account_number().split('-')[0]+(str(inv.partner_bank_id.get_account_number().split('-')[1])).rjust(6,'0')+inv.partner_bank_id.get_account_number().split\ |
1001 | ('-')[2]] |
1002 | tt.append('>') |
1003 | %> |
1004 | |
1005 | === modified file 'l10n_ch_payment_slip/report/report_webkit_html.py' |
1006 | --- l10n_ch_payment_slip/report/report_webkit_html.py 2013-02-15 13:28:41 +0000 |
1007 | +++ l10n_ch_payment_slip/report/report_webkit_html.py 2013-07-15 15:22:25 +0000 |
1008 | @@ -112,7 +112,7 @@ |
1009 | raise except_osv(_('UserError'), |
1010 | _('No bank specified on invoice:\n%s' % (invoice_name))) |
1011 | if not self._compile_check_bvr.match( |
1012 | - invoice.partner_bank_id.acc_number or ''): |
1013 | + invoice.partner_bank_id.get_account_number() or ''): |
1014 | raise except_osv(_('UserError'), |
1015 | _(('Your bank BVR number should be of the form 0X-XXX-X! ' |
1016 | 'Please check your company ' |
1017 | |
1018 | === modified file 'l10n_ch_sepa/base_sepa/base_template/pain.001.001.03.xml.mako' |
1019 | --- l10n_ch_sepa/base_sepa/base_template/pain.001.001.03.xml.mako 2011-11-04 10:40:59 +0000 |
1020 | +++ l10n_ch_sepa/base_sepa/base_template/pain.001.001.03.xml.mako 2013-07-15 15:22:25 +0000 |
1021 | @@ -18,7 +18,7 @@ |
1022 | </GrpHdr>\ |
1023 | <%doc>\ |
1024 | for each payment in the payment order |
1025 | - line is saved in sepa_context in order to be available |
1026 | + line is saved in sepa_context in order to be available |
1027 | in sub blocks and inheritages. Because, for now, only unamed |
1028 | blocks and def in mako can use a local for loop variable. |
1029 | </%doc>\ |
1030 | @@ -91,7 +91,7 @@ |
1031 | <IBAN>${bank_acc.iban}</IBAN> |
1032 | % else: |
1033 | <Othr> |
1034 | - <Id>${bank_acc.acc_number}</Id> |
1035 | + <Id>${bank_acc.get_account_number()}</Id> |
1036 | </Othr> |
1037 | % endif |
1038 | </Id> |
1039 | |
1040 | === modified file 'l10n_ch_sepa/base_sepa/pain_001.py' |
1041 | --- l10n_ch_sepa/base_sepa/pain_001.py 2011-11-04 10:40:59 +0000 |
1042 | +++ l10n_ch_sepa/base_sepa/pain_001.py 2013-07-15 15:22:25 +0000 |
1043 | @@ -88,7 +88,7 @@ |
1044 | raise osv.except_osv(_('ErrorCompanyBankBIC'), |
1045 | _('The selected company bank has no BIC number')) |
1046 | if not cp_bank_acc.iban and \ |
1047 | - not cp_bank_acc.acc_number: |
1048 | + not cp_bank_acc.get_account_number(): |
1049 | raise osv.except_osv(_('ErrorCompanyBankAccNumber'), |
1050 | _('The selected company bank has no IBAN and no Account number')) |
1051 | |
1052 | @@ -102,7 +102,7 @@ |
1053 | raise osv.except_osv(_('ErrorCreditorBankBIC'), |
1054 | _('Creditor bank has no BIC number for invoice %s') %(line.name,)) |
1055 | if not crd_bank_acc.iban and \ |
1056 | - not crd_bank_acc.acc_number: |
1057 | + not crd_bank_acc.get_account_number(): |
1058 | raise osv.except_osv(_('ErrorCompanyBankAccNumber'), |
1059 | _('The selected company bank has no IBAN and no Account number')) |
1060 |
Merged revno 178 and 179 as base branch is not the same.