Merge lp:~jmarquez/openerp-venezuela-localization/NHOMAR-RefundCleanUpMethod into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Nhomar - Vauxoo
Status: Merged
Merged at revision: 490
Proposed branch: lp:~jmarquez/openerp-venezuela-localization/NHOMAR-RefundCleanUpMethod
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 26 lines (+18/-0)
1 file modified
l10n_ve_fiscal_requirements/invoice.py (+18/-0)
To merge this branch: bzr merge lp:~jmarquez/openerp-venezuela-localization/NHOMAR-RefundCleanUpMethod
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com verify Approve
Review via email: mp+86481@code.launchpad.net

Description of the change

Agregando metodo para evitar conflictos con campos many2one en la generación de las notas de crédito.

To post a comment you must log in.
Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) :
review: Approve (verify)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_requirements/invoice.py'
2--- l10n_ve_fiscal_requirements/invoice.py 2011-11-03 20:04:51 +0000
3+++ l10n_ve_fiscal_requirements/invoice.py 2011-12-20 23:27:25 +0000
4@@ -34,6 +34,24 @@
5 'parent_id':fields.many2one('account.invoice', 'Parent Invoice', readonly=True, states={'draft':[('readonly',False)]}, help='When this field has information, this invoice is a credit note or debit note. This field is used to reference to the invoice that originated this credit note or debit note.'),
6 'child_ids':fields.one2many('account.invoice', 'parent_id', 'Debit and Credit Notes', readonly=True, states={'draft':[('readonly',False)]}),
7 }
8+
9+
10+ def _refund_cleanup_lines(self, cr, uid, lines):
11+ """
12+ Metodo created to clean invoice lines
13+ """
14+ for line in lines:
15+ del line['id']
16+ del line['invoice_id']
17+ #TODO Verify one more elegant way to do this
18+ for field in ('company_id', 'partner_id', 'account_id', 'product_id',
19+ 'uos_id', 'account_analytic_id', 'tax_code_id', 'base_code_id',
20+ "concept_id","tax_id"):
21+ line[field] = line.get(field, False) and line[field][0]
22+ if 'invoice_line_tax_id' in line:
23+ line['invoice_line_tax_id'] = [(6,0, line.get('invoice_line_tax_id', [])) ]
24+ return map(lambda x: (0,0,x), lines)
25+
26 account_invoice()
27
28