Merge lp:~savoirfairelinux-openerp/openerp-canada/7.0-l10n_ca_account_check_writing-supplier-ref into lp:openerp-canada

Proposed by Virgil Dupras
Status: Superseded
Proposed branch: lp:~savoirfairelinux-openerp/openerp-canada/7.0-l10n_ca_account_check_writing-supplier-ref
Merge into: lp:openerp-canada
Diff against target: 62 lines (+38/-5)
2 files modified
l10n_ca_account_check_writing/account_voucher.py (+25/-0)
l10n_ca_account_check_writing/report/l10n_ca_check_print.py (+13/-5)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openerp-canada/7.0-l10n_ca_account_check_writing-supplier-ref
Reviewer Review Type Date Requested Status
OpenERP Community Reviewer/Maintainer Pending
Review via email: mp+165671@code.launchpad.net

This proposal has been superseded by a proposal from 2013-05-25.

To post a comment you must log in.

Unmerged revisions

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/account_voucher.py'
2--- l10n_ca_account_check_writing/account_voucher.py 2013-05-10 14:57:50 +0000
3+++ l10n_ca_account_check_writing/account_voucher.py 2013-05-24 17:08:30 +0000
4@@ -72,3 +72,28 @@
5 },
6 'nodestroy': True
7 }
8+
9+# By default, the supplier reference number is not so easily accessible from a voucher line because
10+# there's no direct link between the voucher and the invoice. Fortunately, there was this recently
11+# submitted patch from Lorenzo Battistini (Agile) BG at
12+# https://code.launchpad.net/~elbati/account-payment/adding_account_voucher_supplier_invoice_number_7/+merge/165622
13+# which solves this exact problem and I shamelessely copied that code, which works well.
14+
15+class voucher_line(orm.Model):
16+ _inherit = 'account.voucher.line'
17+
18+ def get_suppl_inv_num(self, cr, uid, move_line_id, context=None):
19+ move_line = self.pool.get('account.move.line').browse(cr, uid, move_line_id, context)
20+ return (move_line.invoice and move_line.invoice.supplier_invoice_number or '')
21+
22+ def _get_supplier_invoice_number(self, cr, uid, ids, name, args, context=None):
23+ res={}
24+ for line in self.browse(cr, uid, ids, context):
25+ res[line.id] = ''
26+ if line.move_line_id:
27+ res[line.id] = self.get_suppl_inv_num(cr, uid, line.move_line_id.id, context=context)
28+ return res
29+
30+ _columns = {
31+ 'supplier_invoice_number': fields.function(_get_supplier_invoice_number, type='char', size=64, string="Supplier Invoice Number"),
32+ }
33
34=== modified file 'l10n_ca_account_check_writing/report/l10n_ca_check_print.py'
35--- l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-05-10 16:02:52 +0000
36+++ l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-05-24 17:08:30 +0000
37@@ -47,12 +47,20 @@
38 self.number_lines = len(voucher_lines)
39 for i in range(0, min(10,self.number_lines)):
40 if i < self.number_lines:
41+ voucher_line = voucher_lines[i]
42+ # In general, the supplier invoice reference number is a much better description
43+ # for writing checks than our own reference number, but if we don't have it, we
44+ # might as well use our internal number
45+ if voucher_line.supplier_invoice_number:
46+ name = voucher_line.supplier_invoice_number
47+ else:
48+ name = voucher_line.name
49 res = {
50- 'date_due' : voucher_lines[i].date_due,
51- 'name' : voucher_lines[i].name,
52- 'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False,
53- 'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False,
54- 'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False,
55+ 'date_due' : voucher_line.date_due,
56+ 'name' : name,
57+ 'amount_original' : voucher_line.amount_original and voucher_line.amount_original or False,
58+ 'amount_unreconciled' : voucher_line.amount_unreconciled and voucher_line.amount_unreconciled or False,
59+ 'amount' : voucher_line.amount and voucher_line.amount or False,
60 }
61 else :
62 res = {

Subscribers

People subscribed via source and target branches