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
=== modified file 'l10n_ca_account_check_writing/account_voucher.py'
--- l10n_ca_account_check_writing/account_voucher.py 2013-05-10 14:57:50 +0000
+++ l10n_ca_account_check_writing/account_voucher.py 2013-05-24 17:08:30 +0000
@@ -72,3 +72,28 @@
72 },72 },
73 'nodestroy': True73 'nodestroy': True
74 }74 }
75
76# By default, the supplier reference number is not so easily accessible from a voucher line because
77# there's no direct link between the voucher and the invoice. Fortunately, there was this recently
78# submitted patch from Lorenzo Battistini (Agile) BG at
79# https://code.launchpad.net/~elbati/account-payment/adding_account_voucher_supplier_invoice_number_7/+merge/165622
80# which solves this exact problem and I shamelessely copied that code, which works well.
81
82class voucher_line(orm.Model):
83 _inherit = 'account.voucher.line'
84
85 def get_suppl_inv_num(self, cr, uid, move_line_id, context=None):
86 move_line = self.pool.get('account.move.line').browse(cr, uid, move_line_id, context)
87 return (move_line.invoice and move_line.invoice.supplier_invoice_number or '')
88
89 def _get_supplier_invoice_number(self, cr, uid, ids, name, args, context=None):
90 res={}
91 for line in self.browse(cr, uid, ids, context):
92 res[line.id] = ''
93 if line.move_line_id:
94 res[line.id] = self.get_suppl_inv_num(cr, uid, line.move_line_id.id, context=context)
95 return res
96
97 _columns = {
98 'supplier_invoice_number': fields.function(_get_supplier_invoice_number, type='char', size=64, string="Supplier Invoice Number"),
99 }
75100
=== 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-05-10 16:02:52 +0000
+++ l10n_ca_account_check_writing/report/l10n_ca_check_print.py 2013-05-24 17:08:30 +0000
@@ -47,12 +47,20 @@
47 self.number_lines = len(voucher_lines)47 self.number_lines = len(voucher_lines)
48 for i in range(0, min(10,self.number_lines)):48 for i in range(0, min(10,self.number_lines)):
49 if i < self.number_lines:49 if i < self.number_lines:
50 voucher_line = voucher_lines[i]
51 # In general, the supplier invoice reference number is a much better description
52 # for writing checks than our own reference number, but if we don't have it, we
53 # might as well use our internal number
54 if voucher_line.supplier_invoice_number:
55 name = voucher_line.supplier_invoice_number
56 else:
57 name = voucher_line.name
50 res = {58 res = {
51 'date_due' : voucher_lines[i].date_due,59 'date_due' : voucher_line.date_due,
52 'name' : voucher_lines[i].name,60 'name' : name,
53 'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False,61 'amount_original' : voucher_line.amount_original and voucher_line.amount_original or False,
54 'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False,62 'amount_unreconciled' : voucher_line.amount_unreconciled and voucher_line.amount_unreconciled or False,
55 'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False,63 'amount' : voucher_line.amount and voucher_line.amount or False,
56 }64 }
57 else :65 else :
58 res = {66 res = {

Subscribers

People subscribed via source and target branches