Merge lp:~savoirfairelinux-openerp/openerp-canada/7.0-l10n_ca_account_check_writing-print-lang into lp:openerp-canada

Proposed by Virgil Dupras
Status: Merged
Merged at revision: 14
Proposed branch: lp:~savoirfairelinux-openerp/openerp-canada/7.0-l10n_ca_account_check_writing-print-lang
Merge into: lp:openerp-canada
Diff against target: 891 lines (+657/-42)
13 files modified
l10n_ca_account_check_writing/__openerp__.py (+4/-1)
l10n_ca_account_check_writing/account_voucher.py (+72/-6)
l10n_ca_account_check_writing/i18n/fr.po (+94/-0)
l10n_ca_account_check_writing/i18n/l10n_ca_account_check_writing.pot (+53/-16)
l10n_ca_account_check_writing/report/l10n_ca_check_print.py (+13/-13)
l10n_ca_account_check_writing/report/l10n_ca_check_print_middle.rml (+3/-2)
l10n_ca_account_check_writing/report/l10n_ca_check_print_top.rml (+3/-4)
res_currency_print_on_check/__init__.py (+22/-0)
res_currency_print_on_check/__openerp__.py (+47/-0)
res_currency_print_on_check/currency.py (+28/-0)
res_currency_print_on_check/currency_data.xml (+274/-0)
res_currency_print_on_check/currency_view.xml (+17/-0)
res_currency_print_on_check/i18n/res_currency_print_on_check.pot (+27/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-canada/7.0-l10n_ca_account_check_writing-print-lang
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) Approve
Review via email: mp+165672@code.launchpad.net
To post a comment you must log in.
13. By Maxime Chambreuil (http://www.savoirfairelinux.com)

[IMP] Bump version and update translation file

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

The amount in letter is not translated.

review: Needs Fixing (test)
14. By Virgil Dupras

[MRG] Print supplier invoice reference on the cheque

15. By Joao Alfredo Gama Batista

[MRG] Currency

16. By Virgil Dupras

[ENH] Use num2words for number conversion in check printing.

OpenERP's built-in functionnality to do that doesn't work well at all in French.

Revision history for this message
Virgil Dupras (hsoft) wrote :

OpenERP's built-in function for num --> words translation are not very good, so I searched for a library that would do that in multiple languages. It's num2words at https://pypi.python.org/pypi/num2words

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

For check in the middle, amount in letter is well translated -> Good!

but cents are not present (should be there in digits).

and I have thoses errors in the log :

2013-05-28 23:37:11,410 21950 WARNING Check openerp.osv.orm.browse_record.account.voucher: Field 'chk_seq' does not exist in object 'browse_record(account.voucher, 1)'
2013-05-28 23:37:11,410 21950 ERROR Check openerp.tools.safe_eval: Cannot eval "voucher.journal_id.use_preprint_check and voucher.chk_seq or ''"
Traceback (most recent call last):
  File "/home/max/openerp/server/7.0/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'chk_seq' does not exist in object 'browse_record(account.voucher, 1)'"
2013-05-28 23:37:11,423 21950 WARNING Check openerp.osv.orm.browse_record.account.voucher: Field 'chk_seq' does not exist in object 'browse_record(account.voucher, 1)'
2013-05-28 23:37:11,423 21950 ERROR Check openerp.tools.safe_eval: Cannot eval "voucher.journal_id.use_preprint_check and voucher.chk_seq or ''"
Traceback (most recent call last):
  File "/home/max/openerp/server/7.0/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'chk_seq' does not exist in object 'browse_record(account.voucher, 1)'"
2013-05-28 23:37:11,425 21950 WARNING Check openerp.report.render.rml2pdf.trml2pdf: Warning: style not found, P26 - setting default!

2013-05-28 23:37:11,428 21950 WARNING Check openerp.osv.orm.browse_record.account.voucher: Field 'chk_seq' does not exist in object 'browse_record(account.voucher, 1)'
2013-05-28 23:37:11,428 21950 ERROR Check openerp.tools.safe_eval: Cannot eval "voucher.journal_id.use_preprint_check and voucher.chk_seq or ''"
Traceback (most recent call last):
  File "/home/max/openerp/server/7.0/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'chk_seq' does not exist in object 'browse_record(account.voucher, 1)'"

For check on top, the amount in letters is not translated and I have the same error in the log.

review: Needs Fixing
Revision history for this message
Virgil Dupras (hsoft) wrote :

For the cents issue, the problem is I lack specifications. Where am I supposed to put them? I should replace the last 6 stars with something like "42/100"?

As for the errors, they were there before, but they don't seem to prevent the checks from being generated. I'd say it's a separate issue.

And for the top check, I was also getting language discrepancy until I tried to update the module in my OpenERP installation. The problems went away. Maybe it's the same case on your local install.

17. By Virgil Dupras

[ENH] Add numerical cents values on the worded amount when printing checks.

18. By Virgil Dupras

[MRG] num2words mention

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Cent issue: Replace the first stars:

One hundred dollars and 42/100 ***************

Error message: Let's take this MP as an opportunity to fix them

Language discrepancy: I will test later today or this week-end.

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Cent issue: Sorry I was wrong, it should be:

One hundred and 42/100 canadian dollars ********
cent dollars canadiens et 42/100 ***************

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :
Download full text (3.7 KiB)

I updated my branches to the latest revisions.

Check is not printed with the currency of the account voucher.

When I print the check in the middle, I have the address of the supplier on the check and an error message for a missing style :

2013-06-04 02:16:32,224 14069 WARNING Check openerp.report.render.rml2pdf.trml2pdf: Warning: style not found, P26 - setting default!

When I print the check on top, I don't have the address as I get this error message and I am missing the style too:

2013-06-04 02:14:20,648 14069 WARNING Check openerp.report.render.rml2pdf.trml2pdf: Warning: style not found, P26 - setting default!

2013-06-04 02:14:20,857 14069 INFO Check werkzeug: 127.0.0.1 - - [04/Jun/2013 02:14:20] "POST /web/report HTTP/1.1" 200 -
2013-06-04 02:14:21,629 14069 INFO Check werkzeug: 127.0.0.1 - - [04/Jun/2013 02:14:21] "POST /web/dataset/search_read HTTP/1.1" 200 -
2013-06-04 02:14:38,574 14069 INFO Check werkzeug: 127.0.0.1 - - [04/Jun/2013 02:14:38] "POST /web/action/load HTTP/1.1" 200 -
2013-06-04 02:14:38,654 14069 WARNING Check openerp.osv.orm.browse_record.res.partner: Field 'address' does not exist in object 'browse_record(res.partner, 5)'
2013-06-04 02:14:38,654 14069 ERROR Check openerp.tools.safe_eval: Cannot eval " voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street2 or removeParentNode('para') "
Traceback (most recent call last):
  File "/home/max/openerp/server/7.0/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'address' does not exist in object 'browse_record(res.partner, 5)'"
2013-06-04 02:14:38,654 14069 WARNING Check openerp.report.render.rml2pdf.utils: rml_except: " voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street2 or removeParentNode('para') "
Traceback (most recent call last):
  File "/home/max/openerp/server/7.0/openerp/report/render/rml2pdf/utils.py", line 76, in _child_get
    eval(n.get('rml_except'), {}, self.localcontext)
  File "/home/max/openerp/server/7.0/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/max/openerp/server/7.0/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'address' does not exist in object 'browse_record(res.partner, 5)'"
2013-06-04 02:14:38,654 14069 ERROR Check openerp.tools.safe_eval: Cannot eval 'get_zip_line(voucher.partner_id.address[0])'
Traceback (most recent call last):
  File "/home/max/openerp/server/7.0/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
NameError: name 'get_zip_line' is not defined
2013-06-04 02:14:38,654 14069 WARNING Check openerp.osv.orm.browse_record.res.partner: Field 'address' does not exist in object 'brows...

Read more...

review: Needs Fixing
19. By Maxime Chambreuil (http://www.savoirfairelinux.com)

[FIX] Style and address

20. By Maxime Chambreuil (http://www.savoirfairelinux.com)

[FIX] Use same style across reports

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Hard-coded currency in the last issue for this MP to be merged.

Don't give up ;)

21. By Virgil Dupras

[ADD] res_currency_display_name

22. By Virgil Dupras

[FIX] Renamed module name to be consistent with the supplied field's new name.

23. By Virgil Dupras

[IMP] Use res_currency_print_on_check to add the currency name on printed checks.

Revision history for this message
Virgil Dupras (hsoft) wrote :

There's one last, possibly very tricky) problem: pluralisation. Currently, currency names are displayed in their singular form.

Not all languages handle plurarisation the same way and not all currency names are pluralised the same way.

Should we change the display name constants from singular to plural?

Revision history for this message
Virgil Dupras (hsoft) wrote :

About the cents thing: so the logic is different in english and in french. How should the module handle languages that are neither french or english? Use the english cents order?

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Pluralisation : Use plural by default. User will be able to change the translation to have something like "canadian dollar(s)" if he wants.

Cents: use the english order by default.

Revision history for this message
Virgil Dupras (hsoft) wrote :

That's the thing: we don't have the plural form right now, only the singular one. Moreover, we dont't have a mechanism to easily switch from singular to plural (or the opposite). If we have plural, then that's all we have.

Should we change values from print_in_check's XML file to plural values?

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Yes

24. By Virgil Dupras

[IMP] Properly localize amount's currency and format depending on the supplier language

25. By Virgil Dupras

[FIX] Pluralized and de-capitalized currency names in res_currency_print_on_check.

In short, changed the names so that they match what should be printed on a check.

26. By Virgil Dupras

[FIX] Fixed a cents rounding bug in check writing.

27. By Maxime Chambreuil (http://www.savoirfairelinux.com)

[IMP] Module name

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ca_account_check_writing/__openerp__.py'
2--- l10n_ca_account_check_writing/__openerp__.py 2013-06-08 22:30:59 +0000
3+++ l10n_ca_account_check_writing/__openerp__.py 2013-06-11 13:35:38 +0000
4@@ -31,8 +31,11 @@
5 This module provides reports to print check using the canadian format from:
6 http://www.cdnpay.ca/imis15/pdf/pdfs_rules/standard_006_fr.pdf
7
8+To use this module, you will need to install num2words Python library:
9+https://pypi.python.org/pypi/num2words
10+
11 """,
12- 'depends': ['account_check_writing'],
13+ 'depends': ['account_check_writing', 'res_currency_print_on_check'],
14 'data': [
15 'l10n_ca_account_check_writing_report.xml',
16 ],
17
18=== modified file 'l10n_ca_account_check_writing/account_voucher.py'
19--- l10n_ca_account_check_writing/account_voucher.py 2013-05-10 14:57:50 +0000
20+++ l10n_ca_account_check_writing/account_voucher.py 2013-06-11 13:35:38 +0000
21@@ -20,7 +20,41 @@
22 ##############################################################################
23
24 from openerp.osv import orm, fields
25-from openerp.tools.amount_to_text_en import amount_to_text
26+from openerp.tools.translate import _
27+# OpenERP's built-in routines for converting numbers to words is pretty bad, especially in French
28+# This is why we use the library below. You can get it at:
29+# https://pypi.python.org/pypi/num2words
30+from num2words import num2words
31+
32+# For the words we use in custom_translation(), we have to put dummy _() calls here so that OpenERP
33+# picks them up during .pot generation
34+_("and")
35+
36+def custom_translation(s, lang):
37+ # OpenERP uses the current stack frame, yes, the *stack frame* to determine which language _()
38+ # should translate a string in. If we want to translate a string in another language, such as
39+ # a supplier's language, we have to resort to hacks such as this one. "context" is sought after
40+ # in the stackframe, so we have to set it.
41+ context = {'lang': lang}
42+ return _(s)
43+
44+def get_amount_line(amount, currency, lang):
45+ try:
46+ amount_in_word = num2words(int(amount), lang=lang[:2])
47+ except NotImplementedError:
48+ amount_in_word = num2words(int(amount))
49+ currency_name = currency.print_on_check
50+ cents = int(amount * 100) % 100
51+ total_length = len(amount_in_word) + len(currency_name)
52+ if total_length < 87:
53+ stars = '*' * (87 - total_length)
54+ else:
55+ stars = ''
56+ AND = custom_translation("and", lang)
57+ amount_line_fmt = '{amount_in_word} {AND} {cents}/100 {currency_name} {stars}'
58+ if lang.startswith('fr'):
59+ amount_line_fmt = '{amount_in_word} {currency_name} {AND} {cents}/100 {stars}'
60+ return amount_line_fmt.format(**vars())
61
62 class account_voucher(orm.Model):
63 _inherit = 'account.voucher'
64@@ -36,11 +70,18 @@
65 ttype, date, payment_rate_currency_id, company_id, context=context)
66 if 'value' in default:
67 amount = 'amount' in default['value'] and default['value']['amount'] or amount
68-
69- #TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
70- #amount_in_word = amount_to_text(amount, context=context)
71- amount_in_word = amount_to_text(amount, currency='Canadian Dollars')
72- default['value'].update({'amount_in_word':amount_in_word})
73+ if ids:
74+ supplier_lang = self.browse(cr, uid, ids[0], context=context).partner_id.lang
75+ else:
76+ # It's a new record and we don't have access to our supplier lang yet
77+ supplier_lang = 'en_US'
78+ supplier_context = context.copy()
79+ # for some calls, such as the currency browse() call, we want to separate our user's
80+ # language from our supplier's. That's why we need a separate context.
81+ supplier_context['lang'] = supplier_lang
82+ currency = self.pool.get('res.currency').browse(cr, uid, currency_id, context=supplier_context)
83+ amount_line = get_amount_line(amount, currency, supplier_lang)
84+ default['value'].update({'amount_in_word':amount_line})
85 if journal_id:
86 allow_check_writing = self.pool.get('account.journal').browse(
87 cr, uid, journal_id, context=context).allow_check_writing
88@@ -72,3 +113,28 @@
89 },
90 'nodestroy': True
91 }
92+
93+# By default, the supplier reference number is not so easily accessible from a voucher line because
94+# there's no direct link between the voucher and the invoice. Fortunately, there was this recently
95+# submitted patch from Lorenzo Battistini (Agile) BG at
96+# https://code.launchpad.net/~elbati/account-payment/adding_account_voucher_supplier_invoice_number_7/+merge/165622
97+# which solves this exact problem and I shamelessely copied that code, which works well.
98+
99+class voucher_line(orm.Model):
100+ _inherit = 'account.voucher.line'
101+
102+ def get_suppl_inv_num(self, cr, uid, move_line_id, context=None):
103+ move_line = self.pool.get('account.move.line').browse(cr, uid, move_line_id, context)
104+ return (move_line.invoice and move_line.invoice.supplier_invoice_number or '')
105+
106+ def _get_supplier_invoice_number(self, cr, uid, ids, name, args, context=None):
107+ res={}
108+ for line in self.browse(cr, uid, ids, context):
109+ res[line.id] = ''
110+ if line.move_line_id:
111+ res[line.id] = self.get_suppl_inv_num(cr, uid, line.move_line_id.id, context=context)
112+ return res
113+
114+ _columns = {
115+ 'supplier_invoice_number': fields.function(_get_supplier_invoice_number, type='char', size=64, string="Supplier Invoice Number"),
116+ }
117
118=== added file 'l10n_ca_account_check_writing/i18n/fr.po'
119--- l10n_ca_account_check_writing/i18n/fr.po 1970-01-01 00:00:00 +0000
120+++ l10n_ca_account_check_writing/i18n/fr.po 2013-06-11 13:35:38 +0000
121@@ -0,0 +1,94 @@
122+# Translation of OpenERP Server.
123+# This file contains the translation of the following modules:
124+# * l10n_ca_account_check_writing
125+#
126+msgid ""
127+msgstr ""
128+"Project-Id-Version: OpenERP Server 7.0\n"
129+"Report-Msgid-Bugs-To: \n"
130+"POT-Creation-Date: 2013-05-25 15:55+0000\n"
131+"PO-Revision-Date: 2013-05-25 15:55+0000\n"
132+"Last-Translator: <>\n"
133+"Language-Team: \n"
134+"MIME-Version: 1.0\n"
135+"Content-Type: text/plain; charset=UTF-8\n"
136+"Content-Transfer-Encoding: \n"
137+"Plural-Forms: \n"
138+
139+#. module: l10n_ca_account_check_writing
140+#: report:l10n.ca.account.print.check.middle:0
141+#: report:l10n.ca.account.print.check.top:0
142+msgid "Check Amount"
143+msgstr "Montant du chèque"
144+
145+#. module: l10n_ca_account_check_writing
146+#: code:addons/l10n_ca_account_check_writing/account_voucher.py:31
147+#, python-format
148+msgid "and"
149+msgstr "et"
150+
151+#. module: l10n_ca_account_check_writing
152+#: report:l10n.ca.account.print.check.top:0
153+msgid "Open Balance"
154+msgstr "Solde ouvert"
155+
156+#. module: l10n_ca_account_check_writing
157+#: report:l10n.ca.account.print.check.middle:0
158+#: report:l10n.ca.account.print.check.top:0
159+msgid "Description"
160+msgstr "Description"
161+
162+#. module: l10n_ca_account_check_writing
163+#: report:l10n.ca.account.print.check.middle:0
164+#: report:l10n.ca.account.print.check.top:0
165+msgid "Due Date"
166+msgstr "Date"
167+
168+#. module: l10n_ca_account_check_writing
169+#: model:ir.actions.report.xml,name:l10n_ca_account_check_writing.l10n_ca_account_print_check_middle
170+msgid "Print Check CA (Middle)"
171+msgstr "Imprimer chèque CA (Milieu)"
172+
173+#. module: l10n_ca_account_check_writing
174+#: model:ir.model,name:l10n_ca_account_check_writing.model_account_voucher
175+msgid "Accounting Voucher"
176+msgstr "Justificatif comptable"
177+
178+#. module: l10n_ca_account_check_writing
179+#: model:ir.model,name:l10n_ca_account_check_writing.model_res_company
180+msgid "Companies"
181+msgstr "Sociétés"
182+
183+#. module: l10n_ca_account_check_writing
184+#: report:l10n.ca.account.print.check.middle:0
185+#: report:l10n.ca.account.print.check.top:0
186+msgid "Discount"
187+msgstr "Remise"
188+
189+#. module: l10n_ca_account_check_writing
190+#: report:l10n.ca.account.print.check.middle:0
191+#: report:l10n.ca.account.print.check.top:0
192+msgid "Original Amount"
193+msgstr "Montant original"
194+
195+#. module: l10n_ca_account_check_writing
196+#: report:l10n.ca.account.print.check.middle:0
197+msgid "Date"
198+msgstr "Date"
199+
200+#. module: l10n_ca_account_check_writing
201+#: report:l10n.ca.account.print.check.middle:0
202+msgid "Balance Due"
203+msgstr "Solde dû"
204+
205+#. module: l10n_ca_account_check_writing
206+#: report:l10n.ca.account.print.check.middle:0
207+#: report:l10n.ca.account.print.check.top:0
208+msgid "Payment"
209+msgstr "Paiement"
210+
211+#. module: l10n_ca_account_check_writing
212+#: model:ir.actions.report.xml,name:l10n_ca_account_check_writing.l10n_ca_account_print_check_top
213+msgid "Print Check CA (Top)"
214+msgstr "Imprimer chèque CA (Haut)"
215+
216
217=== modified file 'l10n_ca_account_check_writing/i18n/l10n_ca_account_check_writing.pot'
218--- l10n_ca_account_check_writing/i18n/l10n_ca_account_check_writing.pot 2013-04-25 21:23:42 +0000
219+++ l10n_ca_account_check_writing/i18n/l10n_ca_account_check_writing.pot 2013-06-11 13:35:38 +0000
220@@ -4,10 +4,10 @@
221 #
222 msgid ""
223 msgstr ""
224-"Project-Id-Version: OpenERP Server 6.1\n"
225+"Project-Id-Version: OpenERP Server 7.0\n"
226 "Report-Msgid-Bugs-To: \n"
227-"POT-Creation-Date: 2013-04-23 20:44+0000\n"
228-"PO-Revision-Date: 2013-04-23 20:44+0000\n"
229+"POT-Creation-Date: 2013-06-10 18:26+0000\n"
230+"PO-Revision-Date: 2013-06-10 18:26+0000\n"
231 "Last-Translator: <>\n"
232 "Language-Team: \n"
233 "MIME-Version: 1.0\n"
234@@ -17,51 +17,88 @@
235
236 #. module: l10n_ca_account_check_writing
237 #: report:l10n.ca.account.print.check.middle:0
238+#: report:l10n.ca.account.print.check.top:0
239 msgid "Check Amount"
240-msgstr "Check Amount"
241+msgstr ""
242+
243+#. module: l10n_ca_account_check_writing
244+#: code:addons/l10n_ca_account_check_writing/account_voucher.py:31
245+#, python-format
246+msgid "and"
247+msgstr ""
248+
249+#. module: l10n_ca_account_check_writing
250+#: report:l10n.ca.account.print.check.top:0
251+msgid "Open Balance"
252+msgstr ""
253
254 #. module: l10n_ca_account_check_writing
255 #: report:l10n.ca.account.print.check.middle:0
256+#: report:l10n.ca.account.print.check.top:0
257 msgid "Description"
258-msgstr "Description"
259+msgstr ""
260
261 #. module: l10n_ca_account_check_writing
262 #: report:l10n.ca.account.print.check.middle:0
263+#: report:l10n.ca.account.print.check.top:0
264 msgid "Due Date"
265-msgstr "Due Date"
266+msgstr ""
267
268 #. module: l10n_ca_account_check_writing
269 #: model:ir.actions.report.xml,name:l10n_ca_account_check_writing.l10n_ca_account_print_check_middle
270-msgid "Print Check (CA)"
271-msgstr "Print Check (CA)"
272+msgid "Print Check CA (Middle)"
273+msgstr ""
274+
275+#. module: l10n_ca_account_check_writing
276+#: model:ir.model,name:l10n_ca_account_check_writing.model_account_voucher
277+msgid "Accounting Voucher"
278+msgstr ""
279+
280+#. module: l10n_ca_account_check_writing
281+#: model:ir.model,name:l10n_ca_account_check_writing.model_res_company
282+msgid "Companies"
283+msgstr ""
284+
285+#. module: l10n_ca_account_check_writing
286+#: model:ir.model,name:l10n_ca_account_check_writing.model_account_voucher_line
287+msgid "Voucher Lines"
288+msgstr ""
289
290 #. module: l10n_ca_account_check_writing
291 #: report:l10n.ca.account.print.check.middle:0
292+#: report:l10n.ca.account.print.check.top:0
293 msgid "Discount"
294-msgstr "Discount"
295+msgstr ""
296
297 #. module: l10n_ca_account_check_writing
298 #: report:l10n.ca.account.print.check.middle:0
299+#: report:l10n.ca.account.print.check.top:0
300 msgid "Original Amount"
301-msgstr "Original Amount"
302+msgstr ""
303
304 #. module: l10n_ca_account_check_writing
305 #: report:l10n.ca.account.print.check.middle:0
306 msgid "Date"
307-msgstr "Date"
308+msgstr ""
309
310 #. module: l10n_ca_account_check_writing
311 #: report:l10n.ca.account.print.check.middle:0
312 msgid "Balance Due"
313-msgstr "Balance Due"
314+msgstr ""
315+
316+#. module: l10n_ca_account_check_writing
317+#: field:account.voucher.line,supplier_invoice_number:0
318+msgid "Supplier Invoice Number"
319+msgstr ""
320
321 #. module: l10n_ca_account_check_writing
322 #: report:l10n.ca.account.print.check.middle:0
323+#: report:l10n.ca.account.print.check.top:0
324 msgid "Payment"
325-msgstr "Payment"
326+msgstr ""
327
328 #. module: l10n_ca_account_check_writing
329-#: report:l10n.ca.account.print.check.middle:0
330-msgid "$"
331-msgstr "$"
332+#: model:ir.actions.report.xml,name:l10n_ca_account_check_writing.l10n_ca_account_print_check_top
333+msgid "Print Check CA (Top)"
334+msgstr ""
335
336
337=== modified file 'l10n_ca_account_check_writing/report/l10n_ca_check_print.py'
338--- l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-05-10 16:02:52 +0000
339+++ l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-06-11 13:35:38 +0000
340@@ -32,27 +32,27 @@
341 self.localcontext.update({
342 'time': time,
343 'get_lines': self.get_lines,
344- 'fill_stars' : self.fill_stars,
345 })
346- def fill_stars(self, amount):
347- #amount = amount.replace('Dollars','')
348- if len(amount) < 90:
349- stars = 100 - len(amount)
350- return ' '.join([amount,'*'*stars])
351-
352- else: return amount
353
354 def get_lines(self, voucher_lines):
355 result = []
356 self.number_lines = len(voucher_lines)
357 for i in range(0, min(10,self.number_lines)):
358 if i < self.number_lines:
359+ voucher_line = voucher_lines[i]
360+ # In general, the supplier invoice reference number is a much better description
361+ # for writing checks than our own reference number, but if we don't have it, we
362+ # might as well use our internal number
363+ if voucher_line.supplier_invoice_number:
364+ name = voucher_line.supplier_invoice_number
365+ else:
366+ name = voucher_line.name
367 res = {
368- 'date_due' : voucher_lines[i].date_due,
369- 'name' : voucher_lines[i].name,
370- 'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False,
371- 'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False,
372- 'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False,
373+ 'date_due' : voucher_line.date_due,
374+ 'name' : name,
375+ 'amount_original' : voucher_line.amount_original and voucher_line.amount_original or False,
376+ 'amount_unreconciled' : voucher_line.amount_unreconciled and voucher_line.amount_unreconciled or False,
377+ 'amount' : voucher_line.amount and voucher_line.amount or False,
378 }
379 else :
380 res = {
381
382=== modified file 'l10n_ca_account_check_writing/report/l10n_ca_check_print.sxw'
383Binary files l10n_ca_account_check_writing/report/l10n_ca_check_print.sxw 2013-04-25 21:23:42 +0000 and l10n_ca_account_check_writing/report/l10n_ca_check_print.sxw 2013-06-11 13:35:38 +0000 differ
384=== modified file 'l10n_ca_account_check_writing/report/l10n_ca_check_print_middle.rml'
385--- l10n_ca_account_check_writing/report/l10n_ca_check_print_middle.rml 2013-04-25 21:23:42 +0000
386+++ l10n_ca_account_check_writing/report/l10n_ca_check_print_middle.rml 2013-06-11 13:35:38 +0000
387@@ -99,6 +99,7 @@
388 </stylesheet>
389 <story>
390 <para style="P1">[[repeatIn(objects,'voucher')]]</para>
391+ <para style="P1">[[ setLang(voucher.partner_id.lang) ]]</para>
392 <blockTable colWidths="568.0" style="Table2" rowHeights="280">
393 <tr>
394 <td>
395@@ -149,7 +150,7 @@
396 <para style="P19">[[ l['name'] ]]</para>
397 </td>
398 <td>
399- <para style="P19">[[formatLang( l['amount_original']) ]]</para>
400+ <para style="P19">[[ formatLang( l['amount_original']) ]]</para>
401 </td>
402 <td>
403 <para style="P19">[[ formatLang( l['amount_due']) ]]</para>
404@@ -209,7 +210,7 @@
405 <para style="P3"><font color="white"> </font></para>
406 </td>
407 <td>
408- <para style="P26">[[ str(fill_stars(voucher.amount_in_word)) ]]</para>
409+ <para style="P9">[[ voucher.amount_in_word ]]</para>
410 </td>
411 </tr>
412 </blockTable>
413
414=== modified file 'l10n_ca_account_check_writing/report/l10n_ca_check_print_top.rml'
415--- l10n_ca_account_check_writing/report/l10n_ca_check_print_top.rml 2013-04-25 21:23:42 +0000
416+++ l10n_ca_account_check_writing/report/l10n_ca_check_print_top.rml 2013-06-11 13:35:38 +0000
417@@ -97,6 +97,7 @@
418 </stylesheet>
419 <story>
420 <para style="P1">[[repeatIn(objects,'voucher')]]</para>
421+ <para style="P1">[[ setLang(voucher.partner_id.lang) ]]</para>
422 <blockTable colWidths="568.0" style="Table1">
423 <tr>
424 <td>
425@@ -142,7 +143,7 @@
426 <blockTable colWidths="550.0" rowHeights="18" style="Table5">
427 <tr>
428 <td>
429- <para style="P9">[[ fill_stars(voucher.amount_in_word) ]]</para>
430+ <para style="P9">[[ voucher.amount_in_word ]]</para>
431 </td>
432 </tr>
433 </blockTable>
434@@ -153,9 +154,7 @@
435 </td>
436 <td>
437 <para style="P9">[[ voucher.partner_id.name ]] </para>
438- <para style="P15">[[ voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street2 or removeParentNode('para') ]]</para>
439- <para style="P15">[[ get_zip_line(voucher.partner_id.address[0]) ]] </para>
440- <para style="P15">[[ voucher.partner_id.address[0].country_id.name]]</para>
441+ <para style="P15">[[ display_address(voucher.partner_id) or removeParentNode('para') ]]</para>
442 </td>
443 <td>
444 <para/>
445
446=== added directory 'res_currency_print_on_check'
447=== added file 'res_currency_print_on_check/__init__.py'
448--- res_currency_print_on_check/__init__.py 1970-01-01 00:00:00 +0000
449+++ res_currency_print_on_check/__init__.py 2013-06-11 13:35:38 +0000
450@@ -0,0 +1,22 @@
451+# -*- coding: utf-8 -*-
452+##############################################################################
453+#
454+# OpenERP, Open Source Management Solution
455+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
456+#
457+# This program is free software: you can redistribute it and/or modify
458+# it under the terms of the GNU Affero General Public License as
459+# published by the Free Software Foundation, either version 3 of the
460+# License, or (at your option) any later version.
461+#
462+# This program is distributed in the hope that it will be useful,
463+# but WITHOUT ANY WARRANTY; without even the implied warranty of
464+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
465+# GNU Affero General Public License for more details.
466+#
467+# You should have received a copy of the GNU Affero General Public License
468+# along with this program. If not, see <http://www.gnu.org/licenses/>.
469+#
470+##############################################################################
471+
472+import currency
473
474=== added file 'res_currency_print_on_check/__openerp__.py'
475--- res_currency_print_on_check/__openerp__.py 1970-01-01 00:00:00 +0000
476+++ res_currency_print_on_check/__openerp__.py 2013-06-11 13:35:38 +0000
477@@ -0,0 +1,47 @@
478+# -*- coding: utf-8 -*-
479+##############################################################################
480+#
481+# OpenERP, Open Source Management Solution
482+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
483+#
484+# This program is free software: you can redistribute it and/or modify
485+# it under the terms of the GNU Affero General Public License as
486+# published by the Free Software Foundation, either version 3 of the
487+# License, or (at your option) any later version.
488+#
489+# This program is distributed in the hope that it will be useful,
490+# but WITHOUT ANY WARRANTY; without even the implied warranty of
491+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
492+# GNU Affero General Public License for more details.
493+#
494+# You should have received a copy of the GNU Affero General Public License
495+# along with this program. If not, see <http://www.gnu.org/licenses/>.
496+#
497+##############################################################################
498+
499+# NOTE: The name of the supplied field was initially "display_name", but it seems that OpenERP,
500+# whenever it seems "name" in the field, returns the value for "name". Well...
501+
502+{
503+ 'name': 'Display name for currencies',
504+ 'version': '1.0',
505+ 'author': 'Savoir-faire Linux',
506+ 'website': 'http://www.savoirfairelinux.com',
507+ 'category': 'Generic Modules/Accounting',
508+ 'description': """
509+Supply res.currency.print_on_check
510+==================================
511+
512+This module improves res.currency by adding the "print_on_check" field, which stores the human
513+readable name of the currency (US Dollar, Euro, Canadian Dollar, etc.)
514+""",
515+ 'depends': ['base'],
516+ 'data': [
517+ 'currency_view.xml',
518+ 'currency_data.xml',
519+ ],
520+ 'demo': [],
521+ 'test': [],
522+ 'installable': True,
523+ 'active': False,
524+}
525
526=== added file 'res_currency_print_on_check/currency.py'
527--- res_currency_print_on_check/currency.py 1970-01-01 00:00:00 +0000
528+++ res_currency_print_on_check/currency.py 2013-06-11 13:35:38 +0000
529@@ -0,0 +1,28 @@
530+# -*- coding: utf-8 -*-
531+##############################################################################
532+#
533+# OpenERP, Open Source Management Solution
534+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
535+#
536+# This program is free software: you can redistribute it and/or modify
537+# it under the terms of the GNU Affero General Public License as
538+# published by the Free Software Foundation, either version 3 of the
539+# License, or (at your option) any later version.
540+#
541+# This program is distributed in the hope that it will be useful,
542+# but WITHOUT ANY WARRANTY; without even the implied warranty of
543+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
544+# GNU Affero General Public License for more details.
545+#
546+# You should have received a copy of the GNU Affero General Public License
547+# along with this program. If not, see <http://www.gnu.org/licenses/>.
548+#
549+##############################################################################
550+
551+from openerp.osv import orm, fields
552+
553+class res_currency(orm.Model):
554+ _inherit = 'res.currency'
555+ _columns = {
556+ 'print_on_check': fields.char('Display Name', size=64, translate=True),
557+ }
558
559=== added file 'res_currency_print_on_check/currency_data.xml'
560--- res_currency_print_on_check/currency_data.xml 1970-01-01 00:00:00 +0000
561+++ res_currency_print_on_check/currency_data.xml 2013-06-11 13:35:38 +0000
562@@ -0,0 +1,274 @@
563+<?xml version="1.0" encoding="utf-8"?>
564+<openerp>
565+ <data>
566+
567+ <record id="base.USD" model="res.currency">
568+ <field name="print_on_check">U.S. dollars</field>
569+ </record>
570+
571+ <record id="base.EUR" model="res.currency">
572+ <field name="print_on_check">euros</field>
573+ </record>
574+
575+ <record id="base.GBP" model="res.currency">
576+ <field name="print_on_check">U.K. pounds</field>
577+ </record>
578+
579+ <record id="base.CAD" model="res.currency">
580+ <field name="print_on_check">canadian dollars</field>
581+ </record>
582+
583+ <record id="base.AUD" model="res.currency">
584+ <field name="print_on_check">australian dollars</field>
585+ </record>
586+
587+ <record id="base.JPY" model="res.currency">
588+ <field name="print_on_check">japanese yens</field>
589+ </record>
590+
591+ <record id="base.INR" model="res.currency">
592+ <field name="print_on_check">indian rupees</field>
593+ </record>
594+
595+ <record id="base.NZD" model="res.currency">
596+ <field name="print_on_check">New Zealand dollars</field>
597+ </record>
598+
599+ <record id="base.CHF" model="res.currency">
600+ <field name="print_on_check">swiss francs</field>
601+ </record>
602+
603+ <record id="base.ZAR" model="res.currency">
604+ <field name="print_on_check">south african rands</field>
605+ </record>
606+
607+ <record id="base.AED" model="res.currency">
608+ <field name="print_on_check">U.A.E. dirhams</field>
609+ </record>
610+
611+ <record id="base.ANG" model="res.currency">
612+ <field name="print_on_check">Neth. Antilles florins</field>
613+ </record>
614+
615+ <record id="base.ARS" model="res.currency">
616+ <field name="print_on_check">argentine pesos</field>
617+ </record>
618+
619+ <record id="base.BBD" model="res.currency">
620+ <field name="print_on_check">barbadian dollars</field>
621+ </record>
622+
623+ <record id="base.BHD" model="res.currency">
624+ <field name="print_on_check">bahraini dinars</field>
625+ </record>
626+
627+ <record id="base.BRL" model="res.currency">
628+ <field name="print_on_check">brazilian reals</field>
629+ </record>
630+
631+ <record id="base.BSD" model="res.currency">
632+ <field name="print_on_check">bahamian dollars</field>
633+ </record>
634+
635+ <record id="base.CLP" model="res.currency">
636+ <field name="print_on_check">chilean pesos</field>
637+ </record>
638+
639+ <record id="base.CNY" model="res.currency">
640+ <field name="print_on_check">chinese renminbis</field>
641+ </record>
642+
643+ <record id="base.COP" model="res.currency">
644+ <field name="print_on_check">colombian pesos</field>
645+ </record>
646+
647+ <record id="base.CZK" model="res.currency">
648+ <field name="print_on_check">Czech Republic korunas</field>
649+ </record>
650+
651+ <record id="base.DKK" model="res.currency">
652+ <field name="print_on_check">danish krones</field>
653+ </record>
654+
655+ <record id="base.EGP" model="res.currency">
656+ <field name="print_on_check">egyptian pounds</field>
657+ </record>
658+
659+ <record id="base.FJD" model="res.currency">
660+ <field name="print_on_check">Fiji dollars</field>
661+ </record>
662+
663+ <record id="base.GHS" model="res.currency">
664+ <field name="print_on_check">ghanaian cedis</field>
665+ </record>
666+
667+ <record id="base.HKD" model="res.currency">
668+ <field name="print_on_check">Hong Kong dollars</field>
669+ </record>
670+
671+ <record id="base.HNL" model="res.currency">
672+ <field name="print_on_check">honduran lempiras</field>
673+ </record>
674+
675+ <record id="base.HRK" model="res.currency">
676+ <field name="print_on_check">croatian kunas</field>
677+ </record>
678+
679+ <record id="base.HUF" model="res.currency">
680+ <field name="print_on_check">hungarian forints</field>
681+ </record>
682+
683+ <record id="base.IDR" model="res.currency">
684+ <field name="print_on_check">indonesian rupiahs</field>
685+ </record>
686+
687+ <record id="base.ILS" model="res.currency">
688+ <field name="print_on_check">israeli new shekels</field>
689+ </record>
690+
691+ <record id="base.ISK" model="res.currency">
692+ <field name="print_on_check">icelandic kronas</field>
693+ </record>
694+
695+ <record id="base.JMD" model="res.currency">
696+ <field name="print_on_check">jamaican dollars</field>
697+ </record>
698+
699+ <record id="base.KRW" model="res.currency">
700+ <field name="print_on_check">south korean wons</field>
701+ </record>
702+
703+ <record id="base.LKR" model="res.currency">
704+ <field name="print_on_check">Sri Lanka rupees</field>
705+ </record>
706+
707+ <record id="base.LTL" model="res.currency">
708+ <field name="print_on_check">lithuanian litas</field>
709+ </record>
710+
711+ <record id="base.LVL" model="res.currency">
712+ <field name="print_on_check">latvian lats</field>
713+ </record>
714+
715+ <record id="base.MAD" model="res.currency">
716+ <field name="print_on_check">moroccan dirhams</field>
717+ </record>
718+
719+ <record id="base.MMK" model="res.currency">
720+ <field name="print_on_check">Myanmar kyats</field>
721+ </record>
722+
723+ <record id="base.MXN" model="res.currency">
724+ <field name="print_on_check">mexican pesos</field>
725+ </record>
726+
727+ <record id="base.MYR" model="res.currency">
728+ <field name="print_on_check">malaysian ringgits</field>
729+ </record>
730+
731+ <record id="base.MZN" model="res.currency">
732+ <field name="print_on_check">mozambican meticals</field>
733+ </record>
734+
735+ <record id="base.NIO" model="res.currency">
736+ <field name="print_on_check">nicaraguan córdobas</field>
737+ </record>
738+
739+ <record id="base.NOK" model="res.currency">
740+ <field name="print_on_check">norwegian krones</field>
741+ </record>
742+
743+ <record id="base.PAB" model="res.currency">
744+ <field name="print_on_check">panamanian balboas</field>
745+ </record>
746+
747+ <record id="base.PEN" model="res.currency">
748+ <field name="print_on_check">peruvian new sols</field>
749+ </record>
750+
751+ <record id="base.PHP" model="res.currency">
752+ <field name="print_on_check">philippine pesos</field>
753+ </record>
754+
755+ <record id="base.PKR" model="res.currency">
756+ <field name="print_on_check">pakistan rupees</field>
757+ </record>
758+
759+ <record id="base.PLN" model="res.currency">
760+ <field name="print_on_check">polish zlotys</field>
761+ </record>
762+
763+ <record id="base.RON" model="res.currency">
764+ <field name="print_on_check">romanian new leus</field>
765+ </record>
766+
767+ <record id="base.RSD" model="res.currency">
768+ <field name="print_on_check">serbian dinars</field>
769+ </record>
770+
771+ <record id="base.RUB" model="res.currency">
772+ <field name="print_on_check">russian roubles</field>
773+ </record>
774+
775+ <record id="base.SAR" model="res.currency">
776+ <field name="print_on_check">saudi riyals</field>
777+ </record>
778+
779+ <record id="base.SEK" model="res.currency">
780+ <field name="print_on_check">swedish kronas</field>
781+ </record>
782+
783+ <record id="base.SGD" model="res.currency">
784+ <field name="print_on_check">Singapore dollars</field>
785+ </record>
786+
787+ <record id="base.SIT" model="res.currency">
788+ <field name="print_on_check">slovenian tolars</field>
789+ </record>
790+
791+ <record id="base.SKK" model="res.currency">
792+ <field name="print_on_check">slovak korunas</field>
793+ </record>
794+
795+ <record id="base.THB" model="res.currency">
796+ <field name="print_on_check">thai bahts</field>
797+ </record>
798+
799+ <record id="base.TND" model="res.currency">
800+ <field name="print_on_check">tunisian dinars</field>
801+ </record>
802+
803+ <record id="base.TRL" model="res.currency">
804+ <field name="print_on_check">turkish liras</field>
805+ </record>
806+
807+ <record id="base.TWD" model="res.currency">
808+ <field name="print_on_check">taiwanese new dollars</field>
809+ </record>
810+
811+ <record id="base.UAH" model="res.currency">
812+ <field name="print_on_check">ukrainian hryvnias</field>
813+ </record>
814+
815+ <record id="base.VEF" model="res.currency">
816+ <field name="print_on_check">venezuelan bolivars fuerte</field>
817+ </record>
818+
819+ <record id="base.VND" model="res.currency">
820+ <field name="print_on_check">vietnamese dongs</field>
821+ </record>
822+
823+ <record id="base.XAF" model="res.currency">
824+ <field name="print_on_check">CFA francs</field>
825+ </record>
826+
827+ <record id="base.XCD" model="res.currency">
828+ <field name="print_on_check">east caribbean dollars</field>
829+ </record>
830+
831+ <record id="base.XPF" model="res.currency">
832+ <field name="print_on_check">CFP francs</field>
833+ </record>
834+
835+ </data>
836+</openerp>
837
838=== added file 'res_currency_print_on_check/currency_view.xml'
839--- res_currency_print_on_check/currency_view.xml 1970-01-01 00:00:00 +0000
840+++ res_currency_print_on_check/currency_view.xml 2013-06-11 13:35:38 +0000
841@@ -0,0 +1,17 @@
842+<?xml version="1.0" encoding="utf-8"?>
843+<openerp>
844+ <data>
845+
846+ <record id="view_currency_form" model="ir.ui.view">
847+ <field name="name">res.currency.form.print_on_check</field>
848+ <field name="model">res.currency</field>
849+ <field name="inherit_id" ref="base.view_currency_form"/>
850+ <field name="arch" type="xml">
851+ <xpath expr="//field[@name='rate']" position="after">
852+ <field name="print_on_check"/>
853+ </xpath>
854+ </field>
855+ </record>
856+
857+ </data>
858+</openerp>
859
860=== added directory 'res_currency_print_on_check/i18n'
861=== added file 'res_currency_print_on_check/i18n/res_currency_print_on_check.pot'
862--- res_currency_print_on_check/i18n/res_currency_print_on_check.pot 1970-01-01 00:00:00 +0000
863+++ res_currency_print_on_check/i18n/res_currency_print_on_check.pot 2013-06-11 13:35:38 +0000
864@@ -0,0 +1,27 @@
865+# Translation of OpenERP Server.
866+# This file contains the translation of the following modules:
867+# * res_currency_print_on_check
868+#
869+msgid ""
870+msgstr ""
871+"Project-Id-Version: OpenERP Server 7.0\n"
872+"Report-Msgid-Bugs-To: \n"
873+"POT-Creation-Date: 2013-06-08 16:22+0000\n"
874+"PO-Revision-Date: 2013-06-08 16:22+0000\n"
875+"Last-Translator: <>\n"
876+"Language-Team: \n"
877+"MIME-Version: 1.0\n"
878+"Content-Type: text/plain; charset=UTF-8\n"
879+"Content-Transfer-Encoding: \n"
880+"Plural-Forms: \n"
881+
882+#. module: res_currency_print_on_check
883+#: model:ir.model,name:res_currency_print_on_check.model_res_currency
884+msgid "Currency"
885+msgstr "Currency"
886+
887+#. module: res_currency_print_on_check
888+#: field:res.currency,print_on_check:0
889+msgid "Display Name"
890+msgstr "Display Name"
891+

Subscribers

People subscribed via source and target branches