Merge lp:~acysos-team/openerp-spain/openerp-spain-fix-odoo into lp:~openerp-spain-team/openerp-spain/7.0
- openerp-spain-fix-odoo
- Merge into 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 |
Related bugs: |
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 |
Commit message
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 : | # |
review:
Approve
(code review)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed file '.directory' | |||
2 | --- .directory 2012-11-15 16:14:59 +0000 | |||
3 | +++ .directory 1970-01-01 00:00:00 +0000 | |||
4 | @@ -1,5 +0,0 @@ | |||
5 | 1 | [Dolphin] | ||
6 | 2 | Timestamp=2012,9,6,18,38,0 | ||
7 | 3 | |||
8 | 4 | [Settings] | ||
9 | 5 | HiddenFilesShown=true | ||
10 | 6 | 0 | ||
11 | === modified file 'l10n_es_aeat_mod340/account.py' | |||
12 | --- l10n_es_aeat_mod340/account.py 2014-02-09 16:33:45 +0000 | |||
13 | +++ l10n_es_aeat_mod340/account.py 2014-06-25 13:31:44 +0000 | |||
14 | @@ -41,50 +41,50 @@ | |||
15 | 41 | class wizard_update_charts_accounts(orm.TransientModel): | 41 | class wizard_update_charts_accounts(orm.TransientModel): |
16 | 42 | _inherit = 'wizard.update.charts.accounts' | 42 | _inherit = 'wizard.update.charts.accounts' |
17 | 43 | 43 | ||
19 | 44 | def _find_tax_codes(self, cr, uid, wizard, context=None): | 44 | def _find_tax_codes(self, cr, uid, wizard, chart_template_ids, |
20 | 45 | context=None): | ||
21 | 45 | """ | 46 | """ |
22 | 46 | Search for, and load, tax code templates to create/update. | 47 | Search for, and load, tax code templates to create/update. |
23 | 48 | |||
24 | 49 | @param chart_template_ids: IDs of the chart templates to look on, | ||
25 | 50 | calculated once in the calling method. | ||
26 | 47 | """ | 51 | """ |
27 | 52 | if not wizard.chart_template_id: | ||
28 | 53 | return {} | ||
29 | 48 | new_tax_codes = 0 | 54 | new_tax_codes = 0 |
30 | 49 | updated_tax_codes = 0 | 55 | updated_tax_codes = 0 |
31 | 50 | tax_code_template_mapping = {} | 56 | tax_code_template_mapping = {} |
37 | 51 | 57 | tax_code_templ_obj = self.pool['account.tax.code.template'] | |
38 | 52 | tax_code_templ_obj = self.pool.get('account.tax.code.template') | 58 | tax_code_obj = self.pool['account.tax.code'] |
39 | 53 | tax_code_obj = self.pool.get('account.tax.code') | 59 | wiz_tax_code_obj = self.pool['wizard.update.charts.accounts.tax.code'] |
35 | 54 | wiz_tax_code_obj = self.pool.get('wizard.update.charts.accounts.tax.code') | ||
36 | 55 | |||
40 | 56 | # Remove previous tax codes | 60 | # Remove previous tax codes |
41 | 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, [])) |
42 | 58 | |||
43 | 59 | # | ||
44 | 60 | # Search for new / updated tax codes | 62 | # Search for new / updated tax codes |
45 | 61 | # | ||
46 | 62 | root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id | 63 | root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id |
57 | 63 | children_tax_code_template = tax_code_templ_obj.search(cr, uid, | 64 | children_tax_code_template = tax_code_templ_obj.search(cr, uid, [( |
58 | 64 | [('parent_id', 'child_of', [root_tax_code_id])], order='id') | 65 | 'parent_id', 'child_of', [root_tax_code_id])], order='id', |
59 | 65 | for tax_code_template in tax_code_templ_obj.browse(cr, uid, | 66 | context=context) |
60 | 66 | children_tax_code_template): | 67 | for tax_code_template in tax_code_templ_obj.browse(cr, uid, |
61 | 67 | # Ensure the tax code template is on the map (search for the mapped tax code id). | 68 | children_tax_code_template, context=context): |
62 | 68 | self._map_tax_code_template(cr, uid, wizard, | 69 | # Ensure the tax code template is on the map (search for the mapped |
63 | 69 | tax_code_template_mapping, | 70 | # tax code id). |
64 | 70 | tax_code_template, context) | 71 | tax_code_id = self._map_tax_code_template(cr, uid, wizard, |
65 | 71 | 72 | tax_code_template_mapping, | |
66 | 72 | tax_code_id = tax_code_template_mapping.get(tax_code_template.id) | 73 | tax_code_template, context=context) |
67 | 73 | if not tax_code_id: | 74 | if not tax_code_id: |
68 | 74 | new_tax_codes += 1 | 75 | new_tax_codes += 1 |
69 | 75 | wiz_tax_code_obj.create(cr, uid, { | 76 | wiz_tax_code_obj.create(cr, uid, { |
74 | 76 | 'tax_code_id': tax_code_template.id, | 77 | 'tax_code_id': tax_code_template.id, |
75 | 77 | 'update_chart_wizard_id': wizard.id, | 78 | 'update_chart_wizard_id': wizard.id, |
76 | 78 | 'type': 'new', | 79 | 'type': 'new', |
77 | 79 | }, context) | 80 | 'notes': _('Name or code not found.'), |
78 | 81 | }, context) | ||
79 | 80 | elif wizard.update_tax_code: | 82 | elif wizard.update_tax_code: |
80 | 81 | # | ||
81 | 82 | # Check the tax code for changes. | 83 | # Check the tax code for changes. |
82 | 83 | # | ||
83 | 84 | modified = False | 84 | modified = False |
84 | 85 | notes = "" | 85 | notes = "" |
87 | 86 | tax_code = tax_code_obj.browse(cr, uid, tax_code_id, context=context) | 86 | tax_code = tax_code_obj.browse( |
88 | 87 | 87 | cr, uid, tax_code_id, context=context) | |
89 | 88 | if tax_code.code != tax_code_template.code: | 88 | if tax_code.code != tax_code_template.code: |
90 | 89 | notes += _("The code field is different.\n") | 89 | notes += _("The code field is different.\n") |
91 | 90 | modified = True | 90 | modified = True |
92 | @@ -97,49 +97,41 @@ | |||
93 | 97 | if tax_code.mod340 != tax_code_template.mod340: | 97 | if tax_code.mod340 != tax_code_template.mod340: |
94 | 98 | notes += _("The Mod 340 field is different.\n") | 98 | notes += _("The Mod 340 field is different.\n") |
95 | 99 | modified = True | 99 | modified = True |
96 | 100 | |||
97 | 101 | # TODO: We could check other account fields for changes... | 100 | # TODO: We could check other account fields for changes... |
98 | 102 | |||
99 | 103 | if modified: | 101 | if modified: |
100 | 104 | # | ||
101 | 105 | # Tax code to update. | 102 | # Tax code to update. |
102 | 106 | # | ||
103 | 107 | updated_tax_codes += 1 | 103 | updated_tax_codes += 1 |
104 | 108 | wiz_tax_code_obj.create(cr, uid, { | 104 | wiz_tax_code_obj.create(cr, uid, { |
114 | 109 | 'tax_code_id': tax_code_template.id, | 105 | 'tax_code_id': tax_code_template.id, |
115 | 110 | 'update_chart_wizard_id': wizard.id, | 106 | 'update_chart_wizard_id': wizard.id, |
116 | 111 | 'type': 'updated', | 107 | 'type': 'updated', |
117 | 112 | 'update_tax_code_id': tax_code_id, | 108 | 'update_tax_code_id': tax_code_id, |
118 | 113 | 'notes': notes, | 109 | 'notes': notes, |
119 | 114 | }, context) | 110 | }, context) |
120 | 115 | 111 | return { | |
121 | 116 | return { 'new': new_tax_codes, 'updated': updated_tax_codes, | 112 | 'new': new_tax_codes, |
122 | 117 | 'mapping': tax_code_template_mapping } | 113 | 'updated': updated_tax_codes, |
123 | 114 | 'mapping': tax_code_template_mapping | ||
124 | 115 | } | ||
125 | 118 | 116 | ||
126 | 119 | def _update_tax_codes(self, cr, uid, wizard, log, context=None): | 117 | def _update_tax_codes(self, cr, uid, wizard, log, context=None): |
127 | 120 | """ | 118 | """ |
128 | 121 | Search for, and load, tax code templates to create/update. | 119 | Search for, and load, tax code templates to create/update. |
129 | 122 | """ | 120 | """ |
132 | 123 | tax_code_obj = self.pool.get('account.tax.code') | 121 | taxcodes = self.pool.get('account.tax.code') |
131 | 124 | |||
133 | 125 | root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id | 122 | root_tax_code_id = wizard.chart_template_id.tax_code_root_id.id |
134 | 126 | |||
135 | 127 | new_tax_codes = 0 | 123 | new_tax_codes = 0 |
136 | 128 | updated_tax_codes = 0 | 124 | updated_tax_codes = 0 |
137 | 129 | tax_code_template_mapping = {} | 125 | tax_code_template_mapping = {} |
138 | 130 | |||
139 | 131 | for wiz_tax_code in wizard.tax_code_ids: | 126 | for wiz_tax_code in wizard.tax_code_ids: |
140 | 132 | tax_code_template = wiz_tax_code.tax_code_id | 127 | tax_code_template = wiz_tax_code.tax_code_id |
141 | 133 | tax_code_name = (root_tax_code_id == tax_code_template.id) and wizard.company_id.name or tax_code_template.name | 128 | tax_code_name = (root_tax_code_id == tax_code_template.id) and wizard.company_id.name or tax_code_template.name |
142 | 134 | |||
143 | 135 | # Ensure the parent tax code template is on the map. | 129 | # Ensure the parent tax code template is on the map. |
149 | 136 | self._map_tax_code_template(cr, uid, wizard, | 130 | self._map_tax_code_template(cr, uid, wizard, |
150 | 137 | tax_code_template_mapping, | 131 | tax_code_template_mapping, |
151 | 138 | tax_code_template.parent_id, context) | 132 | tax_code_template.parent_id, |
152 | 139 | 133 | context=context) | |
148 | 140 | # | ||
153 | 141 | # Values | 134 | # Values |
154 | 142 | # | ||
155 | 143 | vals = { | 135 | vals = { |
156 | 144 | 'name': tax_code_name, | 136 | 'name': tax_code_name, |
157 | 145 | 'code': tax_code_template.code, | 137 | 'code': tax_code_template.code, |
158 | @@ -152,40 +144,31 @@ | |||
159 | 152 | 144 | ||
160 | 153 | tax_code_id = None | 145 | tax_code_id = None |
161 | 154 | modified = False | 146 | modified = False |
162 | 155 | |||
163 | 156 | if wiz_tax_code.type == 'new': | 147 | if wiz_tax_code.type == 'new': |
164 | 157 | # | ||
165 | 158 | # Create the tax code | 148 | # Create the tax code |
168 | 159 | # | 149 | tax_code_id = taxcodes.create(cr, uid, vals) |
167 | 160 | tax_code_id = tax_code_obj.create(cr, uid, vals) | ||
169 | 161 | log.add(_("Created tax code %s.\n") % tax_code_name) | 150 | log.add(_("Created tax code %s.\n") % tax_code_name) |
170 | 162 | new_tax_codes += 1 | 151 | new_tax_codes += 1 |
171 | 163 | modified = True | 152 | modified = True |
172 | 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: |
173 | 165 | # | ||
174 | 166 | # Update the tax code | 154 | # Update the tax code |
175 | 167 | # | ||
176 | 168 | tax_code_id = wiz_tax_code.update_tax_code_id.id | 155 | tax_code_id = wiz_tax_code.update_tax_code_id.id |
178 | 169 | tax_code_obj.write(cr, uid, [tax_code_id], vals) | 156 | taxcodes.write(cr, uid, [tax_code_id], vals) |
179 | 170 | log.add(_("Updated tax code %s.\n") % tax_code_name) | 157 | log.add(_("Updated tax code %s.\n") % tax_code_name) |
180 | 171 | updated_tax_codes += 1 | 158 | updated_tax_codes += 1 |
181 | 172 | modified = True | 159 | modified = True |
182 | 173 | else: | 160 | else: |
183 | 174 | tax_code_id = wiz_tax_code.update_tax_code_id and wiz_tax_code.update_tax_code_id.id | 161 | tax_code_id = wiz_tax_code.update_tax_code_id and wiz_tax_code.update_tax_code_id.id |
184 | 175 | modified = False | 162 | modified = False |
185 | 176 | |||
186 | 177 | # Store the tax codes on the map | 163 | # Store the tax codes on the map |
187 | 178 | tax_code_template_mapping[tax_code_template.id] = tax_code_id | 164 | tax_code_template_mapping[tax_code_template.id] = tax_code_id |
188 | 179 | |||
189 | 180 | if modified: | 165 | if modified: |
190 | 181 | # | ||
191 | 182 | # Detect errors | 166 | # Detect errors |
192 | 183 | # | ||
193 | 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): |
194 | 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) |
195 | 186 | |||
196 | 187 | return { | 169 | return { |
197 | 188 | 'new': new_tax_codes, | 170 | 'new': new_tax_codes, |
198 | 189 | 'updated': updated_tax_codes, | 171 | 'updated': updated_tax_codes, |
199 | 190 | 'mapping': tax_code_template_mapping | 172 | 'mapping': tax_code_template_mapping |
200 | 191 | } | 173 | } |
201 | 174 | |||
202 | 192 | 175 | ||
203 | === modified file 'l10n_es_payment_order/report/remesas_report.py' | |||
204 | --- l10n_es_payment_order/report/remesas_report.py 2011-08-29 15:11:11 +0000 | |||
205 | +++ l10n_es_payment_order/report/remesas_report.py 2014-06-25 13:31:44 +0000 | |||
206 | @@ -22,7 +22,7 @@ | |||
207 | 22 | ############################################################################## | 22 | ############################################################################## |
208 | 23 | 23 | ||
209 | 24 | import time | 24 | import time |
211 | 25 | from report import report_sxw | 25 | from openerp.report import report_sxw |
212 | 26 | 26 | ||
213 | 27 | class remesas_report(report_sxw.rml_parse): | 27 | class remesas_report(report_sxw.rml_parse): |
214 | 28 | 28 |
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.