Merge lp:~savoirfairelinux-openerp/openerp-canada/7.0-bug-1178696-l10n_ca_account_check_writing into lp:openerp-canada

Proposed by Joao Alfredo Gama Batista
Status: Merged
Approved by: Joao Alfredo Gama Batista
Approved revision: 12
Merged at revision: 11
Proposed branch: lp:~savoirfairelinux-openerp/openerp-canada/7.0-bug-1178696-l10n_ca_account_check_writing
Merge into: lp:openerp-canada
Diff against target: 52 lines (+25/-3)
2 files modified
l10n_ca_account_check_writing/account_voucher.py (+23/-1)
l10n_ca_account_check_writing/report/l10n_ca_check_print.py (+2/-2)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-canada/7.0-bug-1178696-l10n_ca_account_check_writing
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+163328@code.launchpad.net

Description of the change

Force 'Canadian Dollars' as default currency for the canadian checks.

To post a comment you must log in.
12. By Joao Alfredo Gama Batista

[FIX] Don't remove 'Dollars' when printing

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

Maybe an automated test would help?

review: Approve (code review, no test)
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) wrote :

> LGTM
>
> Maybe an automated test would help?

It definitely would! ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_ca_account_check_writing/account_voucher.py'
--- l10n_ca_account_check_writing/account_voucher.py 2013-04-25 21:23:42 +0000
+++ l10n_ca_account_check_writing/account_voucher.py 2013-05-10 16:04:25 +0000
@@ -20,11 +20,33 @@
20##############################################################################20##############################################################################
2121
22from openerp.osv import orm, fields22from openerp.osv import orm, fields
2323from openerp.tools.amount_to_text_en import amount_to_text
2424
25class account_voucher(orm.Model):25class account_voucher(orm.Model):
26 _inherit = 'account.voucher'26 _inherit = 'account.voucher'
2727
28 def onchange_amount(self, cr, uid, ids, amount, rate, partner_id,
29 journal_id, currency_id, ttype, date,
30 payment_rate_currency_id, company_id, context=None):
31 """ Inherited - add amount_in_word and allow_check_writting in returned value dictionary """
32 if not context:
33 context = {}
34 default = super(account_voucher, self).onchange_amount(
35 cr, uid, ids, amount, rate, partner_id, journal_id, currency_id,
36 ttype, date, payment_rate_currency_id, company_id, context=context)
37 if 'value' in default:
38 amount = 'amount' in default['value'] and default['value']['amount'] or amount
39
40 #TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
41 #amount_in_word = amount_to_text(amount, context=context)
42 amount_in_word = amount_to_text(amount, currency='Canadian Dollars')
43 default['value'].update({'amount_in_word':amount_in_word})
44 if journal_id:
45 allow_check_writing = self.pool.get('account.journal').browse(
46 cr, uid, journal_id, context=context).allow_check_writing
47 default['value'].update({'allow_check': allow_check_writing})
48 return default
49
28 def print_check(self, cr, uid, ids, context=None):50 def print_check(self, cr, uid, ids, context=None):
29 if not ids:51 if not ids:
30 return {}52 return {}
3153
=== modified file 'l10n_ca_account_check_writing/report/l10n_ca_check_print.py'
--- l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-04-25 21:23:42 +0000
+++ l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-05-10 16:04:25 +0000
@@ -35,8 +35,8 @@
35 'fill_stars' : self.fill_stars,35 'fill_stars' : self.fill_stars,
36 })36 })
37 def fill_stars(self, amount):37 def fill_stars(self, amount):
38 amount = amount.replace('Dollars','')38 #amount = amount.replace('Dollars','')
39 if len(amount) < 100:39 if len(amount) < 90:
40 stars = 100 - len(amount)40 stars = 100 - len(amount)
41 return ' '.join([amount,'*'*stars])41 return ' '.join([amount,'*'*stars])
4242

Subscribers

People subscribed via source and target branches