Merge lp:~acysos-team/openerp-spain/openerp-spain-fix-odoo into lp:~openerp-spain-team/openerp-spain/7.0

Proposed by Ignacio Ibeas (www.acysos.com)
Status: Merged
Merged at revision: 481
Proposed branch: lp:~acysos-team/openerp-spain/openerp-spain-fix-odoo
Merge into: lp:~openerp-spain-team/openerp-spain/7.0
Diff against target: 213 lines (+47/-69)
3 files modified
.directory (+0/-5)
l10n_es_aeat_mod340/account.py (+46/-63)
l10n_es_payment_order/report/remesas_report.py (+1/-1)
To merge this branch: bzr merge lp:~acysos-team/openerp-spain/openerp-spain-fix-odoo
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Alejandro Santana code review, no test Approve
Review via email: mp+224448@code.launchpad.net

Description of the change

Adaptación de Mod340 y Payment_Order para hacerlos compatibles con Odoo.

To post a comment you must log in.
Revision history for this message
Alejandro Santana (alejandrosantana) :
review: Approve (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM.

Hay algunas cosas que corregir para cumplir con PEP8 y con las convenciones de comunidad, pero eso se puede hacer en otro momento.

Un saludo.

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file '.directory'
--- .directory 2012-11-15 16:14:59 +0000
+++ .directory 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1[Dolphin]
2Timestamp=2012,9,6,18,38,0
3
4[Settings]
5HiddenFilesShown=true
60
=== modified file 'l10n_es_aeat_mod340/account.py'
--- l10n_es_aeat_mod340/account.py 2014-02-09 16:33:45 +0000
+++ l10n_es_aeat_mod340/account.py 2014-06-25 13:31:44 +0000
@@ -41,50 +41,50 @@
41class wizard_update_charts_accounts(orm.TransientModel):41class wizard_update_charts_accounts(orm.TransientModel):
42 _inherit = 'wizard.update.charts.accounts'42 _inherit = 'wizard.update.charts.accounts'
43 43
44 def _find_tax_codes(self, cr, uid, wizard, context=None):44 def _find_tax_codes(self, cr, uid, wizard, chart_template_ids,
45 context=None):
45 """46 """
46 Search for, and load, tax code templates to create/update.47 Search for, and load, tax code templates to create/update.
48
49 @param chart_template_ids: IDs of the chart templates to look on,
50 calculated once in the calling method.
47 """51 """
52 if not wizard.chart_template_id:
53 return {}
48 new_tax_codes = 054 new_tax_codes = 0
49 updated_tax_codes = 055 updated_tax_codes = 0
50 tax_code_template_mapping = {}56 tax_code_template_mapping = {}
51 57 tax_code_templ_obj = self.pool['account.tax.code.template']
52 tax_code_templ_obj = self.pool.get('account.tax.code.template')58 tax_code_obj = self.pool['account.tax.code']
53 tax_code_obj = self.pool.get('account.tax.code')59 wiz_tax_code_obj = self.pool['wizard.update.charts.accounts.tax.code']
54 wiz_tax_code_obj = self.pool.get('wizard.update.charts.accounts.tax.code')
55
56 # Remove previous tax codes60 # Remove previous tax codes
57 wiz_tax_code_obj.unlink(cr, uid, wiz_tax_code_obj.search(cr, uid, []))61 wiz_tax_code_obj.unlink(cr, uid, wiz_tax_code_obj.search(cr, uid, []))
58
59 #
60 # Search for new / updated tax codes62 # Search for new / updated tax codes
61 #
62 root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id63 root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id
63 children_tax_code_template = tax_code_templ_obj.search(cr, uid, 64 children_tax_code_template = tax_code_templ_obj.search(cr, uid, [(
64 [('parent_id', 'child_of', [root_tax_code_id])], order='id')65 'parent_id', 'child_of', [root_tax_code_id])], order='id',
65 for tax_code_template in tax_code_templ_obj.browse(cr, uid, 66 context=context)
66 children_tax_code_template):67 for tax_code_template in tax_code_templ_obj.browse(cr, uid,
67 # Ensure the tax code template is on the map (search for the mapped tax code id).68 children_tax_code_template, context=context):
68 self._map_tax_code_template(cr, uid, wizard, 69 # Ensure the tax code template is on the map (search for the mapped
69 tax_code_template_mapping, 70 # tax code id).
70 tax_code_template, context)71 tax_code_id = self._map_tax_code_template(cr, uid, wizard,
7172 tax_code_template_mapping,
72 tax_code_id = tax_code_template_mapping.get(tax_code_template.id)73 tax_code_template, context=context)
73 if not tax_code_id:74 if not tax_code_id:
74 new_tax_codes += 175 new_tax_codes += 1
75 wiz_tax_code_obj.create(cr, uid, {76 wiz_tax_code_obj.create(cr, uid, {
76 'tax_code_id': tax_code_template.id,77 'tax_code_id': tax_code_template.id,
77 'update_chart_wizard_id': wizard.id,78 'update_chart_wizard_id': wizard.id,
78 'type': 'new',79 'type': 'new',
79 }, context)80 'notes': _('Name or code not found.'),
81 }, context)
80 elif wizard.update_tax_code:82 elif wizard.update_tax_code:
81 #
82 # Check the tax code for changes.83 # Check the tax code for changes.
83 #
84 modified = False84 modified = False
85 notes = ""85 notes = ""
86 tax_code = tax_code_obj.browse(cr, uid, tax_code_id, context=context)86 tax_code = tax_code_obj.browse(
8787 cr, uid, tax_code_id, context=context)
88 if tax_code.code != tax_code_template.code:88 if tax_code.code != tax_code_template.code:
89 notes += _("The code field is different.\n")89 notes += _("The code field is different.\n")
90 modified = True90 modified = True
@@ -97,49 +97,41 @@
97 if tax_code.mod340 != tax_code_template.mod340:97 if tax_code.mod340 != tax_code_template.mod340:
98 notes += _("The Mod 340 field is different.\n")98 notes += _("The Mod 340 field is different.\n")
99 modified = True99 modified = True
100
101 # TODO: We could check other account fields for changes...100 # TODO: We could check other account fields for changes...
102
103 if modified:101 if modified:
104 #
105 # Tax code to update.102 # Tax code to update.
106 #
107 updated_tax_codes += 1103 updated_tax_codes += 1
108 wiz_tax_code_obj.create(cr, uid, {104 wiz_tax_code_obj.create(cr, uid, {
109 'tax_code_id': tax_code_template.id,105 'tax_code_id': tax_code_template.id,
110 'update_chart_wizard_id': wizard.id,106 'update_chart_wizard_id': wizard.id,
111 'type': 'updated',107 'type': 'updated',
112 'update_tax_code_id': tax_code_id,108 'update_tax_code_id': tax_code_id,
113 'notes': notes,109 'notes': notes,
114 }, context)110 }, context)
115111 return {
116 return { 'new': new_tax_codes, 'updated': updated_tax_codes, 112 'new': new_tax_codes,
117 'mapping': tax_code_template_mapping }113 'updated': updated_tax_codes,
114 'mapping': tax_code_template_mapping
115 }
118 116
119 def _update_tax_codes(self, cr, uid, wizard, log, context=None):117 def _update_tax_codes(self, cr, uid, wizard, log, context=None):
120 """118 """
121 Search for, and load, tax code templates to create/update.119 Search for, and load, tax code templates to create/update.
122 """120 """
123 tax_code_obj = self.pool.get('account.tax.code')121 taxcodes = self.pool.get('account.tax.code')
124
125 root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id122 root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id
126
127 new_tax_codes = 0123 new_tax_codes = 0
128 updated_tax_codes = 0124 updated_tax_codes = 0
129 tax_code_template_mapping = {}125 tax_code_template_mapping = {}
130
131 for wiz_tax_code in wizard.tax_code_ids:126 for wiz_tax_code in wizard.tax_code_ids:
132 tax_code_template = wiz_tax_code.tax_code_id127 tax_code_template = wiz_tax_code.tax_code_id
133 tax_code_name = (root_tax_code_id == tax_code_template.id) and wizard.company_id.name or tax_code_template.name128 tax_code_name = (root_tax_code_id == tax_code_template.id) and wizard.company_id.name or tax_code_template.name
134
135 # Ensure the parent tax code template is on the map.129 # Ensure the parent tax code template is on the map.
136 self._map_tax_code_template(cr, uid, wizard, 130 self._map_tax_code_template(cr, uid, wizard,
137 tax_code_template_mapping, 131 tax_code_template_mapping,
138 tax_code_template.parent_id, context)132 tax_code_template.parent_id,
139133 context=context)
140 #
141 # Values134 # Values
142 #
143 vals = {135 vals = {
144 'name': tax_code_name,136 'name': tax_code_name,
145 'code': tax_code_template.code,137 'code': tax_code_template.code,
@@ -152,40 +144,31 @@
152144
153 tax_code_id = None145 tax_code_id = None
154 modified = False146 modified = False
155
156 if wiz_tax_code.type == 'new':147 if wiz_tax_code.type == 'new':
157 #
158 # Create the tax code148 # Create the tax code
159 #149 tax_code_id = taxcodes.create(cr, uid, vals)
160 tax_code_id = tax_code_obj.create(cr, uid, vals)
161 log.add(_("Created tax code %s.\n") % tax_code_name)150 log.add(_("Created tax code %s.\n") % tax_code_name)
162 new_tax_codes += 1151 new_tax_codes += 1
163 modified = True152 modified = True
164 elif wizard.update_tax_code and wiz_tax_code.update_tax_code_id:153 elif wizard.update_tax_code and wiz_tax_code.update_tax_code_id:
165 #
166 # Update the tax code154 # Update the tax code
167 #
168 tax_code_id = wiz_tax_code.update_tax_code_id.id155 tax_code_id = wiz_tax_code.update_tax_code_id.id
169 tax_code_obj.write(cr, uid, [tax_code_id], vals)156 taxcodes.write(cr, uid, [tax_code_id], vals)
170 log.add(_("Updated tax code %s.\n") % tax_code_name)157 log.add(_("Updated tax code %s.\n") % tax_code_name)
171 updated_tax_codes += 1158 updated_tax_codes += 1
172 modified = True159 modified = True
173 else:160 else:
174 tax_code_id = wiz_tax_code.update_tax_code_id and wiz_tax_code.update_tax_code_id.id161 tax_code_id = wiz_tax_code.update_tax_code_id and wiz_tax_code.update_tax_code_id.id
175 modified = False162 modified = False
176
177 # Store the tax codes on the map163 # Store the tax codes on the map
178 tax_code_template_mapping[tax_code_template.id] = tax_code_id164 tax_code_template_mapping[tax_code_template.id] = tax_code_id
179
180 if modified:165 if modified:
181 #
182 # Detect errors166 # Detect errors
183 #
184 if tax_code_template.parent_id and not tax_code_template_mapping.get(tax_code_template.parent_id.id):167 if tax_code_template.parent_id and not tax_code_template_mapping.get(tax_code_template.parent_id.id):
185 log.add(_("Tax code %s: The parent tax code %s can not be set.\n") % (tax_code_name, tax_code_template.parent_id.name), True)168 log.add(_("Tax code %s: The parent tax code %s can not be set.\n") % (tax_code_name, tax_code_template.parent_id.name), True)
186
187 return {169 return {
188 'new': new_tax_codes,170 'new': new_tax_codes,
189 'updated': updated_tax_codes,171 'updated': updated_tax_codes,
190 'mapping': tax_code_template_mapping172 'mapping': tax_code_template_mapping
191 }173 }
174
192175
=== modified file 'l10n_es_payment_order/report/remesas_report.py'
--- l10n_es_payment_order/report/remesas_report.py 2011-08-29 15:11:11 +0000
+++ l10n_es_payment_order/report/remesas_report.py 2014-06-25 13:31:44 +0000
@@ -22,7 +22,7 @@
22##############################################################################22##############################################################################
2323
24import time24import time
25from report import report_sxw25from openerp.report import report_sxw
2626
27class remesas_report(report_sxw.rml_parse):27class remesas_report(report_sxw.rml_parse):
2828