Merge lp:~vauxoo/openerp-venezuela-localization/javy-bug886213 into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Javier Duran
Status: Merged
Merged at revision: 479
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/javy-bug886213
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 44 lines (+16/-5)
1 file modified
l10n_ve_split_invoice/invoice.py (+16/-5)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/javy-bug886213
Reviewer Review Type Date Requested Status
Gabriela Quilarque Pending
Nhomar - Vauxoo Pending
Javier Duran Pending
Review via email: mp+82023@code.launchpad.net

Description of the change

Mejora y correción del método que separa y divide la factura cuando esta supera una máxima cantidad de líneas permitidas para que funcione con los modulos:

- account_invoice_layout
- sale_layout

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_split_invoice/invoice.py'
2--- l10n_ve_split_invoice/invoice.py 2011-10-25 20:33:16 +0000
3+++ l10n_ve_split_invoice/invoice.py 2011-11-11 21:33:24 +0000
4@@ -31,17 +31,27 @@
5 _inherit = 'account.invoice'
6
7 def split_invoice(self, cr, uid, ids):
8+ '''
9+ Split the invoice when the lines exceed the maximum set for the company
10+ '''
11 for inv in self.browse(cr, uid, ids):
12 inv_id =False
13- cont2 = 0
14 if inv.type in ["out_invoice","out_refund"]:
15 if len(inv.invoice_line)> inv.company_id.lines_invoice:
16- lst = []
17- inv_id = self.copy(cr, uid, inv.id,
18- {
19- 'name': inv.name,
20+ lst = []
21+ invoice = self.read(cr, uid, inv.id, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', 'period_id'])
22+ invoice.update({
23+ 'state': 'draft',
24+ 'number': False,
25 'invoice_line': [],
26+ 'tax_line': []
27 })
28+ # take the id part of the tuple returned for many2one fields
29+ for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
30+ 'account_id', 'currency_id', 'payment_term', 'journal_id', 'period_id'):
31+ invoice[field] = invoice[field] and invoice[field][0]
32+
33+ inv_id = self.create(cr, uid, invoice)
34 cont = 0
35 lst = inv.invoice_line
36 while cont < inv.company_id.lines_invoice:
37@@ -55,6 +65,7 @@
38 wf_service = netsvc.LocalService("workflow")
39 self.button_compute(cr, uid, [inv_id], set_total=True)
40 # wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr)
41+ return True
42
43 def action_date_assign(self, cr, uid, ids, *args):
44 data = super(account_invoice, self).action_date_assign(cr, uid, ids, *args)