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
=== modified file 'l10n_ve_fiscal_book/model/fiscal_book.py'
--- l10n_ve_fiscal_book/model/fiscal_book.py 2013-06-14 16:36:37 +0000
+++ l10n_ve_fiscal_book/model/fiscal_book.py 2013-12-12 21:34:56 +0000
@@ -62,13 +62,15 @@
62 @param field_name: field [get_partner_addr]62 @param field_name: field [get_partner_addr]
63 """63 """
64 context = context or {}64 context = context or {}
65 rp_obj = self.pool.get('res.partner')
65 res = {}.fromkeys(ids, 'NO HAY DIRECCION FISCAL DEFINIDA')66 res = {}.fromkeys(ids, 'NO HAY DIRECCION FISCAL DEFINIDA')
66 #~ TODO: ASK: what company, fisal.book.company_id?67 #~ TODO: ASK: what company, fisal.book.company_id?
67 addr = self.pool.get('res.users').browse(68 ru_obj = self.pool.get('res.users')
68 cr, uid, uid, context=context).company_id.partner_id69 rc_brw = ru_obj.browse(cr, uid, uid, context=context).company_id
70 addr = rp_obj._find_accounting_partner(rc_brw.partner_id)
69 for fb_id in ids:71 for fb_id in ids:
70 if addr:72 if addr:
71 res[fb_id] = addr.type == 'invoice' and (addr.street or '') + \73 res[fb_id] = (addr.street or '') + \
72 ' ' + (addr.street2 or '') + ' ' + (addr.zip or '') + ' ' \74 ' ' + (addr.street2 or '') + ' ' + (addr.zip or '') + ' ' \
73 + (addr.city or '') + ' ' + \75 + (addr.city or '') + ' ' + \
74 (addr.country_id and addr.country_id.name or '') + \76 (addr.country_id and addr.country_id.name or '') + \
@@ -240,7 +242,7 @@
240 " according to the Venezuelan RLIVA statement for fiscal" \242 " according to the Venezuelan RLIVA statement for fiscal" \
241 " accounting books. Options:" \243 " accounting books. Options:" \
242 " - Art. 75: Pruchase Book." \244 " - Art. 75: Pruchase Book." \
243 " - Art. 76: Sale Book. Reflects every individual operation datail." \245 " - Art. 76: Sale Book. Reflects every individual operation detail." \
244 " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one " \246 " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one " \
245 " consolidated line. Only fiscal billing." \247 " consolidated line. Only fiscal billing." \
246 " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show" \248 " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show" \
@@ -698,12 +700,13 @@
698 """700 """
699 context = context or {}701 context = context or {}
700 iwdl_obj = self.pool.get('account.wh.iva.line')702 iwdl_obj = self.pool.get('account.wh.iva.line')
703 rp_obj = self.pool.get('res.partner')
701 fb_brw = self.browse(cr, uid, fb_id, context=context)704 fb_brw = self.browse(cr, uid, fb_id, context=context)
702 #~ Relate wh iva lines705 #~ Relate wh iva lines
703 iwdl_ids = self._get_wh_iva_line_ids(cr, uid, fb_id, context=context)706 iwdl_ids = self._get_wh_iva_line_ids(cr, uid, fb_id, context=context)
704707
705 if fb_brw.type == "purchase" and iwdl_ids \708 if fb_brw.type == "purchase" and iwdl_ids and not \
706 and not fb_brw.company_id.partner_id.wh_iva_agent:709 rp_obj._find_accounting_partner(fb_brw.company_id.partner_id).wh_iva_agent:
707 raise osv.except_osv(_("Error!"),710 raise osv.except_osv(_("Error!"),
708 _("You have withholdings registred but you are not a withholding agent"))711 _("You have withholdings registred but you are not a withholding agent"))
709712
@@ -833,6 +836,7 @@
833 cf_obj = self.pool.get('customs.form')836 cf_obj = self.pool.get('customs.form')
834 fbl_obj = self.pool.get('fiscal.book.line')837 fbl_obj = self.pool.get('fiscal.book.line')
835 fb_brw = self.browse(cr, uid, fb_id, context=context)838 fb_brw = self.browse(cr, uid, fb_id, context=context)
839 rp_obj = self.pool.get('res.partner')
836840
837 #~ add book lines for withholding iva lines841 #~ add book lines for withholding iva lines
838 if fb_brw.iwdl_ids:842 if fb_brw.iwdl_ids:
@@ -845,6 +849,7 @@
845 t_type = fb_brw.type == 'sale' and 'tp' or 'do'849 t_type = fb_brw.type == 'sale' and 'tp' or 'do'
846 for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids,850 for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids,
847 context=context):851 context=context):
852 rp_brw = rp_obj._find_accounting_partner(iwdl_brw.retention_id.partner_id)
848 values = {853 values = {
849 'iwdl_id': iwdl_brw.id,854 'iwdl_id': iwdl_brw.id,
850 'rank': my_rank,855 'rank': my_rank,
@@ -854,8 +859,8 @@
854 'doc_type': self.get_doc_type(cr, uid, iwdl_id=iwdl_brw.id,859 'doc_type': self.get_doc_type(cr, uid, iwdl_id=iwdl_brw.id,
855 context=context),860 context=context),
856 'wh_number': iwdl_brw.retention_id.number or False,861 'wh_number': iwdl_brw.retention_id.number or False,
857 'partner_name': iwdl_brw.retention_id.partner_id.name or False,862 'partner_name': rp_brw.name or 'N/A',
858 'partner_vat': iwdl_brw.retention_id.partner_id.vat or False,863 'partner_vat': rp_brw.vat or 'N/A',
859 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer864 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer
860 and iwdl_brw.invoice_id.invoice_printer865 and iwdl_brw.invoice_id.invoice_printer
861 or (fb_brw.type == 'sale'866 or (fb_brw.type == 'sale'
@@ -877,6 +882,7 @@
877 context=context)882 context=context)
878 doc_type = self.get_doc_type(cr, uid, inv_id=inv_brw.id,883 doc_type = self.get_doc_type(cr, uid, inv_id=inv_brw.id,
879 context=context)884 context=context)
885 rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id)
880 values = {886 values = {
881 'invoice_id': inv_brw.id,887 'invoice_id': inv_brw.id,
882 'rank': my_rank,888 'rank': my_rank,
@@ -899,9 +905,9 @@
899 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR") \905 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR") \
900 and (inv_brw.parent_id and inv_brw.parent_id.number or False) \906 and (inv_brw.parent_id and inv_brw.parent_id.number or False) \
901 or False,907 or False,
902 'partner_name': inv_brw.partner_id.name or False,908 'partner_name': rp_brw.name or 'N/A',
903 'partner_vat': inv_brw.partner_id.vat \909 'partner_vat': rp_brw.vat \
904 and inv_brw.partner_id.vat[2:] or 'N/A',910 and rp_brw.vat[2:] or 'N/A',
905 'invoice_number': inv_brw.fiscal_printer911 'invoice_number': inv_brw.fiscal_printer
906 and inv_brw.invoice_printer912 and inv_brw.invoice_printer
907 or (fb_brw.type == 'sale'913 or (fb_brw.type == 'sale'
@@ -928,7 +934,7 @@
928 for cf_brw in fb_brw.cf_ids:934 for cf_brw in fb_brw.cf_ids:
929935
930 cf_partner_brws = \936 cf_partner_brws = \
931 list(set([cfl_brw.tax_code.partner_id937 list(set([rp_obj._find_accounting_partner(cfl_brw.tax_code.partner_id)
932 for cfl_brw in cf_brw.cfl_ids938 for cfl_brw in cf_brw.cfl_ids
933 if not cfl_brw.tax_code.vat_detail]))939 if not cfl_brw.tax_code.vat_detail]))
934940
@@ -943,7 +949,7 @@
943 for partner_brw in cf_partner_brws:949 for partner_brw in cf_partner_brws:
944 values = common_values.copy()950 values = common_values.copy()
945 values['rank'] = my_rank951 values['rank'] = my_rank
946 values['partner_name'] = partner_brw.name or False952 values['partner_name'] = partner_brw.name or 'N/A'
947 values['partner_vat'] = partner_brw.vat \953 values['partner_vat'] = partner_brw.vat \
948 and partner_brw.vat[2:] or 'N/A'954 and partner_brw.vat[2:] or 'N/A'
949 values['total_with_iva'] = \955 values['total_with_iva'] = \
@@ -972,6 +978,7 @@
972 @param cf_id: customs form id978 @param cf_id: customs form id
973 @param partner_id: partner id979 @param partner_id: partner id
974 """980 """
981 #KEEP AN EYE ON HERE, No check has been made on accounting partner
975 context = context or {}982 context = context or {}
976 cf_obj = self.pool.get('customs.form')983 cf_obj = self.pool.get('customs.form')
977 cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids984 cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids
@@ -1660,12 +1667,14 @@
1660 """1667 """
1661 context = context or {}1668 context = context or {}
1662 inv_obj = self.pool.get('account.invoice')1669 inv_obj = self.pool.get('account.invoice')
1670 rp_obj = self.pool.get('res.partner')
1663 inv_brw = inv_obj.browse(cr, uid, inv_id, context=context)1671 inv_brw = inv_obj.browse(cr, uid, inv_id, context=context)
1672 rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id).id,
1664 fb_brw = self.browse(cr, uid, fb_id, context=context)1673 fb_brw = self.browse(cr, uid, fb_id, context=context)
1665 return inv_brw.customs_form_id \1674 return inv_brw.customs_form_id \
1666 and (fb_brw.type == 'sale' and 'ex' or 'im') \1675 and (fb_brw.type == 'sale' and 'ex' or 'im') \
1667 or (fb_brw.type == 'purchase' and 'do' \1676 or (fb_brw.type == 'purchase' and 'do' \
1668 or (inv_brw.partner_id.vat_subjected and 'tp' or 'ntp' ))1677 or (rp_brw.vat_subjected and 'tp' or 'ntp' ))
16691678
1670 def unlink(self, cr, uid, ids, context=None):1679 def unlink(self, cr, uid, ids, context=None):
1671 """ Overwrite the unlink method to throw an exception if the book is1680 """ Overwrite the unlink method to throw an exception if the book is
16721681
=== modified file 'l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py'
--- l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2013-05-30 21:11:54 +0000
+++ l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2013-12-12 21:34:56 +0000
@@ -87,14 +87,16 @@
87 def _do_new_record(self, control, inv_browse):87 def _do_new_record(self, control, inv_browse):
88 invoice = [i for i in inv_browse if i.nro_ctrl == control][0]88 invoice = [i for i in inv_browse if i.nro_ctrl == control][0]
89 amount = (invoice.amount_tax * invoice.p_ret) / 10089 amount = (invoice.amount_tax * invoice.p_ret) / 100
90 rp_obj = self.pool.get('res.partner')
91 rp_brw = rp_obj._find_accounting_partner(invoice.partner_id).id,
90 return (invoice.date_invoice,92 return (invoice.date_invoice,
91 invoice.date_document,93 invoice.date_document,
92 invoice.partner_id.vat,94 rp_brw.vat,
93 invoice.partner_id.id,95 rp_brw.id,
94 invoice.number,96 invoice.number,
95 invoice.nro_ctrl,97 invoice.nro_ctrl,
96 amount,98 amount,
97 invoice.partner_id.name)99 rp_brw.name)
98100
99 def _do_sale_report(self, cr, uid, data, context=None):101 def _do_sale_report(self, cr, uid, data, context=None):
100 """102 """

Subscribers

People subscribed via source and target branches

to all changes: