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

Proposed by Joao Alfredo Gama Batista
Status: Merged
Approved by: Joao Alfredo Gama Batista
Approved revision: 12
Merged at revision: 10
Proposed branch: lp:~savoirfairelinux-openerp/openerp-canada/6.1-bug-1178696-l10n_ca_account_check_writing
Merge into: lp:openerp-canada/6.1
Diff against target: 51 lines (+24/-2)
2 files modified
l10n_ca_account_check_writing/account_voucher.py (+23/-1)
l10n_ca_account_check_writing/report/l10n_ca_check_print.py (+1/-1)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-canada/6.1-bug-1178696-l10n_ca_account_check_writing
Reviewer Review Type Date Requested Status
Joao Alfredo Gama Batista Approve
Review via email: mp+163353@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.
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) wrote :

It is basicaly the same code that was commited for the 7.0

review: Approve

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:02:28 +0000
+++ l10n_ca_account_check_writing/account_voucher.py 2013-05-10 18:32:28 +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 22:22:38 +0000
+++ l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-05-10 18:32:28 +0000
@@ -36,7 +36,7 @@
36 'fill_stars' : self.fill_stars,36 'fill_stars' : self.fill_stars,
37 })37 })
38 def fill_stars(self, amount):38 def fill_stars(self, amount):
39 amount = amount.replace('Dollars','')39 #amount = amount.replace('Dollars','')
40 if len(amount) < 90:40 if len(amount) < 90:
41 stars = 90 - len(amount)41 stars = 90 - len(amount)
42 return ' '.join([amount,'*'*stars])42 return ' '.join([amount,'*'*stars])

Subscribers

People subscribed via source and target branches