Merge lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_FB-dev-hbto into lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_wh_core-dev-hbto

Proposed by hbto [Vauxoo] http://www.vauxoo.com
Status: Merged
Approved by: hbto [Vauxoo] http://www.vauxoo.com
Approved revision: 956
Merged at revision: 955
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_FB-dev-hbto
Merge into: lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_wh_core-dev-hbto
Diff against target: 161 lines (+28/-17)
2 files modified
l10n_ve_fiscal_book/model/fiscal_book.py (+23/-14)
l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py (+5/-3)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_FB-dev-hbto
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com Approve
Review via email: mp+198832@code.launchpad.net
To post a comment you must log in.
Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_book/model/fiscal_book.py'
2--- l10n_ve_fiscal_book/model/fiscal_book.py 2013-06-14 16:36:37 +0000
3+++ l10n_ve_fiscal_book/model/fiscal_book.py 2013-12-12 21:34:56 +0000
4@@ -62,13 +62,15 @@
5 @param field_name: field [get_partner_addr]
6 """
7 context = context or {}
8+ rp_obj = self.pool.get('res.partner')
9 res = {}.fromkeys(ids, 'NO HAY DIRECCION FISCAL DEFINIDA')
10 #~ TODO: ASK: what company, fisal.book.company_id?
11- addr = self.pool.get('res.users').browse(
12- cr, uid, uid, context=context).company_id.partner_id
13+ ru_obj = self.pool.get('res.users')
14+ rc_brw = ru_obj.browse(cr, uid, uid, context=context).company_id
15+ addr = rp_obj._find_accounting_partner(rc_brw.partner_id)
16 for fb_id in ids:
17 if addr:
18- res[fb_id] = addr.type == 'invoice' and (addr.street or '') + \
19+ res[fb_id] = (addr.street or '') + \
20 ' ' + (addr.street2 or '') + ' ' + (addr.zip or '') + ' ' \
21 + (addr.city or '') + ' ' + \
22 (addr.country_id and addr.country_id.name or '') + \
23@@ -240,7 +242,7 @@
24 " according to the Venezuelan RLIVA statement for fiscal" \
25 " accounting books. Options:" \
26 " - Art. 75: Pruchase Book." \
27- " - Art. 76: Sale Book. Reflects every individual operation datail." \
28+ " - Art. 76: Sale Book. Reflects every individual operation detail." \
29 " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one " \
30 " consolidated line. Only fiscal billing." \
31 " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show" \
32@@ -698,12 +700,13 @@
33 """
34 context = context or {}
35 iwdl_obj = self.pool.get('account.wh.iva.line')
36+ rp_obj = self.pool.get('res.partner')
37 fb_brw = self.browse(cr, uid, fb_id, context=context)
38 #~ Relate wh iva lines
39 iwdl_ids = self._get_wh_iva_line_ids(cr, uid, fb_id, context=context)
40
41- if fb_brw.type == "purchase" and iwdl_ids \
42- and not fb_brw.company_id.partner_id.wh_iva_agent:
43+ if fb_brw.type == "purchase" and iwdl_ids and not \
44+ rp_obj._find_accounting_partner(fb_brw.company_id.partner_id).wh_iva_agent:
45 raise osv.except_osv(_("Error!"),
46 _("You have withholdings registred but you are not a withholding agent"))
47
48@@ -833,6 +836,7 @@
49 cf_obj = self.pool.get('customs.form')
50 fbl_obj = self.pool.get('fiscal.book.line')
51 fb_brw = self.browse(cr, uid, fb_id, context=context)
52+ rp_obj = self.pool.get('res.partner')
53
54 #~ add book lines for withholding iva lines
55 if fb_brw.iwdl_ids:
56@@ -845,6 +849,7 @@
57 t_type = fb_brw.type == 'sale' and 'tp' or 'do'
58 for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids,
59 context=context):
60+ rp_brw = rp_obj._find_accounting_partner(iwdl_brw.retention_id.partner_id)
61 values = {
62 'iwdl_id': iwdl_brw.id,
63 'rank': my_rank,
64@@ -854,8 +859,8 @@
65 'doc_type': self.get_doc_type(cr, uid, iwdl_id=iwdl_brw.id,
66 context=context),
67 'wh_number': iwdl_brw.retention_id.number or False,
68- 'partner_name': iwdl_brw.retention_id.partner_id.name or False,
69- 'partner_vat': iwdl_brw.retention_id.partner_id.vat or False,
70+ 'partner_name': rp_brw.name or 'N/A',
71+ 'partner_vat': rp_brw.vat or 'N/A',
72 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer
73 and iwdl_brw.invoice_id.invoice_printer
74 or (fb_brw.type == 'sale'
75@@ -877,6 +882,7 @@
76 context=context)
77 doc_type = self.get_doc_type(cr, uid, inv_id=inv_brw.id,
78 context=context)
79+ rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id)
80 values = {
81 'invoice_id': inv_brw.id,
82 'rank': my_rank,
83@@ -899,9 +905,9 @@
84 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR") \
85 and (inv_brw.parent_id and inv_brw.parent_id.number or False) \
86 or False,
87- 'partner_name': inv_brw.partner_id.name or False,
88- 'partner_vat': inv_brw.partner_id.vat \
89- and inv_brw.partner_id.vat[2:] or 'N/A',
90+ 'partner_name': rp_brw.name or 'N/A',
91+ 'partner_vat': rp_brw.vat \
92+ and rp_brw.vat[2:] or 'N/A',
93 'invoice_number': inv_brw.fiscal_printer
94 and inv_brw.invoice_printer
95 or (fb_brw.type == 'sale'
96@@ -928,7 +934,7 @@
97 for cf_brw in fb_brw.cf_ids:
98
99 cf_partner_brws = \
100- list(set([cfl_brw.tax_code.partner_id
101+ list(set([rp_obj._find_accounting_partner(cfl_brw.tax_code.partner_id)
102 for cfl_brw in cf_brw.cfl_ids
103 if not cfl_brw.tax_code.vat_detail]))
104
105@@ -943,7 +949,7 @@
106 for partner_brw in cf_partner_brws:
107 values = common_values.copy()
108 values['rank'] = my_rank
109- values['partner_name'] = partner_brw.name or False
110+ values['partner_name'] = partner_brw.name or 'N/A'
111 values['partner_vat'] = partner_brw.vat \
112 and partner_brw.vat[2:] or 'N/A'
113 values['total_with_iva'] = \
114@@ -972,6 +978,7 @@
115 @param cf_id: customs form id
116 @param partner_id: partner id
117 """
118+ #KEEP AN EYE ON HERE, No check has been made on accounting partner
119 context = context or {}
120 cf_obj = self.pool.get('customs.form')
121 cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids
122@@ -1660,12 +1667,14 @@
123 """
124 context = context or {}
125 inv_obj = self.pool.get('account.invoice')
126+ rp_obj = self.pool.get('res.partner')
127 inv_brw = inv_obj.browse(cr, uid, inv_id, context=context)
128+ rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id).id,
129 fb_brw = self.browse(cr, uid, fb_id, context=context)
130 return inv_brw.customs_form_id \
131 and (fb_brw.type == 'sale' and 'ex' or 'im') \
132 or (fb_brw.type == 'purchase' and 'do' \
133- or (inv_brw.partner_id.vat_subjected and 'tp' or 'ntp' ))
134+ or (rp_brw.vat_subjected and 'tp' or 'ntp' ))
135
136 def unlink(self, cr, uid, ids, context=None):
137 """ Overwrite the unlink method to throw an exception if the book is
138
139=== modified file 'l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py'
140--- l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2013-05-30 21:11:54 +0000
141+++ l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2013-12-12 21:34:56 +0000
142@@ -87,14 +87,16 @@
143 def _do_new_record(self, control, inv_browse):
144 invoice = [i for i in inv_browse if i.nro_ctrl == control][0]
145 amount = (invoice.amount_tax * invoice.p_ret) / 100
146+ rp_obj = self.pool.get('res.partner')
147+ rp_brw = rp_obj._find_accounting_partner(invoice.partner_id).id,
148 return (invoice.date_invoice,
149 invoice.date_document,
150- invoice.partner_id.vat,
151- invoice.partner_id.id,
152+ rp_brw.vat,
153+ rp_brw.id,
154 invoice.number,
155 invoice.nro_ctrl,
156 amount,
157- invoice.partner_id.name)
158+ rp_brw.name)
159
160 def _do_sale_report(self, cr, uid, data, context=None):
161 """

Subscribers

People subscribed via source and target branches

to all changes: