Merge lp:~vauxoo/addons-vauxoo/7.0-purchase_requisition_currency-dev-1585-kty into lp:addons-vauxoo/7.0
- 7.0-purchase_requisition_currency-dev-1585-kty
- Merge into 7.0
Status: | Merged |
---|---|
Merged at revision: | 1053 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/7.0-purchase_requisition_currency-dev-1585-kty |
Merge into: | lp:addons-vauxoo/7.0 |
Diff against target: |
345 lines (+287/-0) 7 files modified
purchase_requisition_currency/__init__.py (+27/-0) purchase_requisition_currency/__openerp__.py (+60/-0) purchase_requisition_currency/i18n/purchase_requisition_currency.pot (+44/-0) purchase_requisition_currency/model/__init__.py (+26/-0) purchase_requisition_currency/model/purchase_requisition.py (+88/-0) purchase_requisition_currency/view/purchase_requisition_view.xml (+17/-0) purchase_requisition_currency/wizard/__init__.py (+25/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/7.0-purchase_requisition_currency-dev-1585-kty |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Katherine Zaoral (Vauxoo) | Approve | ||
hbto [Vauxoo] http://www.vauxoo.com | Pending | ||
Review via email: mp+222894@code.launchpad.net |
Commit message
Description of the change
[MERGE] add new module purchase_
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
- 1053. By Katherine Zaoral (Vauxoo)
-
[ADD] overwrite the make_purchase_
order() method to check if the pricelist
currency of the purcahse order is the same of the purchase requisition. If not
then it would raise and exception.
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
add some missing functionality
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
Excelent!
Runbot is green.
Only waiting for the reviewer approvement.
- 1054. By Katherine Zaoral (Vauxoo)
-
[ADD] if the pricelist is different then search for one with the same currency
and overwrite the purchase order. if not it raise an exception. - 1055. By Katherine Zaoral (Vauxoo)
-
[FIX] syntax error.
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
the reviewer comments where applied.
- 1056. By Katherine Zaoral (Vauxoo)
-
[ADD] add module translation template file.
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
add missing translation template file.
- 1057. By Katherine Zaoral (Vauxoo)
-
[ADD] extend the module descriptor with the basic technical settings
configurations. - 1058. By Katherine Zaoral (Vauxoo)
-
[ADD] add groups in the field currency.
- 1059. By Katherine Zaoral (Vauxoo)
-
[ADD] add base module as a dependency becuase the view use a group record
defined in that module. - 1060. By Katherine Zaoral (Vauxoo)
-
[ADD] extend the module description with more details.
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
extend the module descriptor with more detail and add some groups restriction for the new currency field.
- 1061. By Katherine Zaoral (Vauxoo)
-
[ADD] add category type in the module descriptor.
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote : | # |
i will procedure with the merge
Preview Diff
1 | === added directory 'purchase_requisition_currency' |
2 | === added file 'purchase_requisition_currency/__init__.py' |
3 | --- purchase_requisition_currency/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ purchase_requisition_currency/__init__.py 2014-06-12 16:15:30 +0000 |
5 | @@ -0,0 +1,27 @@ |
6 | +#!/usr/bin/python |
7 | +# -*- encoding: utf-8 -*- |
8 | +############################################################################### |
9 | +# Module Writen to OpenERP, Open Source Management Solution |
10 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
11 | +# All Rights Reserved |
12 | +############# Credits ######################################################### |
13 | +# Coded by: Katherine Zaoral <kathy@vauxoo.com> |
14 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
15 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
16 | +############################################################################### |
17 | +# This program is free software: you can redistribute it and/or modify |
18 | +# it under the terms of the GNU Affero General Public License as published |
19 | +# by the Free Software Foundation, either version 3 of the License, or |
20 | +# (at your option) any later version. |
21 | +# |
22 | +# This program is distributed in the hope that it will be useful, |
23 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 | +# GNU Affero General Public License for more details. |
26 | +# |
27 | +# You should have received a copy of the GNU Affero General Public License |
28 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
29 | +############################################################################### |
30 | + |
31 | +import model |
32 | +import wizard |
33 | |
34 | === added file 'purchase_requisition_currency/__openerp__.py' |
35 | --- purchase_requisition_currency/__openerp__.py 1970-01-01 00:00:00 +0000 |
36 | +++ purchase_requisition_currency/__openerp__.py 2014-06-12 16:15:30 +0000 |
37 | @@ -0,0 +1,60 @@ |
38 | +#!/usr/bin/python |
39 | +# -*- encoding: utf-8 -*- |
40 | +############################################################################### |
41 | +# Module Writen to OpenERP, Open Source Management Solution |
42 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
43 | +# All Rights Reserved |
44 | +############# Credits ######################################################### |
45 | +# Coded by: Katherine Zaoral <kathy@vauxoo.com> |
46 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
47 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
48 | +############################################################################### |
49 | +# This program is free software: you can redistribute it and/or modify |
50 | +# it under the terms of the GNU Affero General Public License as published |
51 | +# by the Free Software Foundation, either version 3 of the License, or |
52 | +# (at your option) any later version. |
53 | +# |
54 | +# This program is distributed in the hope that it will be useful, |
55 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
56 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
57 | +# GNU Affero General Public License for more details. |
58 | +# |
59 | +# You should have received a copy of the GNU Affero General Public License |
60 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
61 | +############################################################################### |
62 | + |
63 | +{ |
64 | + 'name': 'Purchase Requisition Currency', |
65 | + 'version': '1.0', |
66 | + 'author': 'Vauxoo', |
67 | + 'website': 'http://www.vauxoo.com/', |
68 | + 'category': 'purchase', |
69 | + 'description': ''' |
70 | +Purchase Requisition Currency |
71 | +============================= |
72 | + |
73 | +Adds the currency field in the purchase requisition model. When you use the |
74 | +Request a Quotation button the purchase requisition currency new field will be |
75 | +take into account to generate the purchase orders with a pricelist that have |
76 | +the same currency. If there is not pricelist with the same purchase requisition |
77 | +currency then it will raise an exception. You need to active some User |
78 | +Technical Settings to take advantage of this functionality: |
79 | + |
80 | +- Multi Currencies. |
81 | +- Purchase Pricelist. |
82 | +''', |
83 | + 'depends': [ |
84 | + 'base', |
85 | + 'purchase_requisition', |
86 | + ], |
87 | + 'data': [ |
88 | + 'view/purchase_requisition_view.xml', |
89 | + ], |
90 | + 'demo': [], |
91 | + 'test': [], |
92 | + 'qweb': [], |
93 | + 'js': [], |
94 | + 'css': [], |
95 | + 'active': False, |
96 | + 'installable': True, |
97 | +} |
98 | |
99 | === added directory 'purchase_requisition_currency/data' |
100 | === added directory 'purchase_requisition_currency/demo' |
101 | === added directory 'purchase_requisition_currency/doc' |
102 | === added directory 'purchase_requisition_currency/doc/images' |
103 | === added directory 'purchase_requisition_currency/i18n' |
104 | === added file 'purchase_requisition_currency/i18n/purchase_requisition_currency.pot' |
105 | --- purchase_requisition_currency/i18n/purchase_requisition_currency.pot 1970-01-01 00:00:00 +0000 |
106 | +++ purchase_requisition_currency/i18n/purchase_requisition_currency.pot 2014-06-12 16:15:30 +0000 |
107 | @@ -0,0 +1,44 @@ |
108 | +# Translation of OpenERP Server. |
109 | +# This file contains the translation of the following modules: |
110 | +# * purchase_requisition_currency |
111 | +# |
112 | +msgid "" |
113 | +msgstr "" |
114 | +"Project-Id-Version: OpenERP Server 7.0\n" |
115 | +"Report-Msgid-Bugs-To: \n" |
116 | +"POT-Creation-Date: 2014-06-12 15:49+0000\n" |
117 | +"PO-Revision-Date: 2014-06-12 15:49+0000\n" |
118 | +"Last-Translator: <>\n" |
119 | +"Language-Team: \n" |
120 | +"MIME-Version: 1.0\n" |
121 | +"Content-Type: text/plain; charset=UTF-8\n" |
122 | +"Content-Transfer-Encoding: \n" |
123 | +"Plural-Forms: \n" |
124 | + |
125 | +#. module: purchase_requisition_currency |
126 | +#: field:purchase.requisition,currency_id:0 |
127 | +msgid "Currency" |
128 | +msgstr "" |
129 | + |
130 | +#. module: purchase_requisition_currency |
131 | +#: help:purchase.requisition,currency_id:0 |
132 | +msgid "Purchase Requisition Currency" |
133 | +msgstr "" |
134 | + |
135 | +#. module: purchase_requisition_currency |
136 | +#: code:addons/purchase_requisition_currency/model/purchase_requisition.py:86 |
137 | +#, python-format |
138 | +msgid "This operation can be done because there's not exist a pricelist with the same purchase requisition currency. ({pl} != {pr})" |
139 | +msgstr "" |
140 | + |
141 | +#. module: purchase_requisition_currency |
142 | +#: model:ir.model,name:purchase_requisition_currency.model_purchase_requisition |
143 | +msgid "Purchase Requisition" |
144 | +msgstr "" |
145 | + |
146 | +#. module: purchase_requisition_currency |
147 | +#: code:addons/purchase_requisition_currency/model/purchase_requisition.py:83 |
148 | +#, python-format |
149 | +msgid "Invalid Procedure!" |
150 | +msgstr "" |
151 | + |
152 | |
153 | === added directory 'purchase_requisition_currency/model' |
154 | === added file 'purchase_requisition_currency/model/__init__.py' |
155 | --- purchase_requisition_currency/model/__init__.py 1970-01-01 00:00:00 +0000 |
156 | +++ purchase_requisition_currency/model/__init__.py 2014-06-12 16:15:30 +0000 |
157 | @@ -0,0 +1,26 @@ |
158 | +#!/usr/bin/python |
159 | +# -*- encoding: utf-8 -*- |
160 | +############################################################################### |
161 | +# Module Writen to OpenERP, Open Source Management Solution |
162 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
163 | +# All Rights Reserved |
164 | +############# Credits ######################################################### |
165 | +# Coded by: Katherine Zaoral <kathy@vauxoo.com> |
166 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
167 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
168 | +############################################################################### |
169 | +# This program is free software: you can redistribute it and/or modify |
170 | +# it under the terms of the GNU Affero General Public License as published |
171 | +# by the Free Software Foundation, either version 3 of the License, or |
172 | +# (at your option) any later version. |
173 | +# |
174 | +# This program is distributed in the hope that it will be useful, |
175 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
176 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
177 | +# GNU Affero General Public License for more details. |
178 | +# |
179 | +# You should have received a copy of the GNU Affero General Public License |
180 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
181 | +############################################################################### |
182 | + |
183 | +import purchase_requisition |
184 | |
185 | === added file 'purchase_requisition_currency/model/purchase_requisition.py' |
186 | --- purchase_requisition_currency/model/purchase_requisition.py 1970-01-01 00:00:00 +0000 |
187 | +++ purchase_requisition_currency/model/purchase_requisition.py 2014-06-12 16:15:30 +0000 |
188 | @@ -0,0 +1,88 @@ |
189 | +#!/usr/bin/python |
190 | +# -*- encoding: utf-8 -*- |
191 | +############################################################################### |
192 | +# Module Writen to OpenERP, Open Source Management Solution |
193 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
194 | +# All Rights Reserved |
195 | +############# Credits ######################################################### |
196 | +# Coded by: Katherine Zaoral <kathy@vauxoo.com> |
197 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
198 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
199 | +############################################################################### |
200 | +# This program is free software: you can redistribute it and/or modify |
201 | +# it under the terms of the GNU Affero General Public License as published |
202 | +# by the Free Software Foundation, either version 3 of the License, or |
203 | +# (at your option) any later version. |
204 | +# |
205 | +# This program is distributed in the hope that it will be useful, |
206 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
207 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
208 | +# GNU Affero General Public License for more details. |
209 | +# |
210 | +# You should have received a copy of the GNU Affero General Public License |
211 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
212 | +############################################################################### |
213 | + |
214 | +from openerp.osv import fields, osv, orm |
215 | +from openerp.tools.translate import _ |
216 | +from openerp import tools |
217 | + |
218 | +class purchase_requisition(osv.Model): |
219 | + |
220 | + _inherit = 'purchase.requisition' |
221 | + _columns = { |
222 | + 'currency_id': fields.many2one( |
223 | + 'res.currency', 'Currency', help='Purchase Requisition Currency'), |
224 | + } |
225 | + |
226 | + _defaults = { |
227 | + 'currency_id': lambda s, c, u, ctx: |
228 | + s.pool.get('res.users').browse(c, u, u, context=ctx).company_id.currency_id.id, |
229 | + } |
230 | + |
231 | + def make_purchase_order(self, cr, uid, ids, partner_id, context=None): |
232 | + """ |
233 | + overwrithe method to check if the pricelist select by the created |
234 | + purchase order have the same currency of the purchase requisition |
235 | + currency. If not, it look for one pricelist that fits and change it. |
236 | + If it do not find any pricelist that fit then it would raise an |
237 | + exception. |
238 | + @return True or raise and exception. |
239 | + """ |
240 | + context = context or {} |
241 | + po_obj = self.pool.get('purchase.order') |
242 | + pl_obj = self.pool.get('product.pricelist') |
243 | + res = super(purchase_requisition, self).make_purchase_order( |
244 | + cr, uid, ids, partner_id, context=context) |
245 | + for pr_brw in self.browse(cr, uid, res.keys(), context=context): |
246 | + # extract the po_ids generated for the purchase requisition. |
247 | + # One purchase order or multiple purchase orders can be created so |
248 | + # we need to clean up this mange a list of the po_ids (not sublist |
249 | + # of ids). |
250 | + tmp_po_ids = list() |
251 | + po_ids = res.values() |
252 | + for po_id in po_ids: |
253 | + if not isinstance(po_id, (int, long)): |
254 | + po_ids.remove(po_id) |
255 | + tmp_po_ids.extend(po_id) |
256 | + po_ids.extend(tmp_po_ids) |
257 | + currency = dict(pr=pr_brw.currency_id) |
258 | + # check the pricelist currency |
259 | + for po_brw in po_obj.browse(cr, uid, po_ids, context=context): |
260 | + currency.update(pl=po_brw.pricelist_id.currency_id) |
261 | + if currency['pl'] != currency['pr']: |
262 | + domain = [('currency_id', '=', currency['pr'].id)] |
263 | + pl_ids = pl_obj.search(cr, uid, domain, context=context) |
264 | + if pl_ids: |
265 | + po_obj.write(cr, uid, po_brw.id, {'pricelist_id': |
266 | + pl_ids[0]}) |
267 | + else: |
268 | + currency.update( |
269 | + pl=currency['pl'].name, pr=currency['pr'].name) |
270 | + raise osv.except_osv( |
271 | + _('Invalid Procedure!'), |
272 | + _('This operation can be done because there\'s not' |
273 | + ' exist a pricelist with the same purchase' |
274 | + ' requisition currency. ({pl} != {pr})'.format( |
275 | + **currency))) |
276 | + return res |
277 | |
278 | === added directory 'purchase_requisition_currency/report' |
279 | === added directory 'purchase_requisition_currency/security' |
280 | === added directory 'purchase_requisition_currency/static' |
281 | === added directory 'purchase_requisition_currency/static/description' |
282 | === added file 'purchase_requisition_currency/static/description/index.html' |
283 | === added directory 'purchase_requisition_currency/static/src' |
284 | === added directory 'purchase_requisition_currency/static/src/css' |
285 | === added directory 'purchase_requisition_currency/static/src/img' |
286 | === added file 'purchase_requisition_currency/static/src/img/icon.png' |
287 | Binary files purchase_requisition_currency/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_currency/static/src/img/icon.png 2014-06-12 16:15:30 +0000 differ |
288 | === added directory 'purchase_requisition_currency/static/src/js' |
289 | === added directory 'purchase_requisition_currency/static/src/xml' |
290 | === added directory 'purchase_requisition_currency/test' |
291 | === added directory 'purchase_requisition_currency/view' |
292 | === added file 'purchase_requisition_currency/view/purchase_requisition_view.xml' |
293 | --- purchase_requisition_currency/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000 |
294 | +++ purchase_requisition_currency/view/purchase_requisition_view.xml 2014-06-12 16:15:30 +0000 |
295 | @@ -0,0 +1,17 @@ |
296 | +<?xml version="1.0" encoding="utf-8"?> |
297 | +<openerp> |
298 | + <data> |
299 | + |
300 | + <record model="ir.ui.view" id="purchase_requisition_currency_form"> |
301 | + <field name="name">purchase.requisition.currency.form</field> |
302 | + <field name="model">purchase.requisition</field> |
303 | + <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/> |
304 | + <field name="arch" type="xml"> |
305 | + <xpath expr="//field[@name='exclusive']" position="after"> |
306 | + <field name="currency_id" groups="base.group_multi_currency"/> |
307 | + </xpath> |
308 | + </field> |
309 | + </record> |
310 | + |
311 | + </data> |
312 | +</openerp> |
313 | |
314 | === added directory 'purchase_requisition_currency/wizard' |
315 | === added file 'purchase_requisition_currency/wizard/__init__.py' |
316 | --- purchase_requisition_currency/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
317 | +++ purchase_requisition_currency/wizard/__init__.py 2014-06-12 16:15:30 +0000 |
318 | @@ -0,0 +1,25 @@ |
319 | +#!/usr/bin/python |
320 | +# -*- encoding: utf-8 -*- |
321 | +############################################################################### |
322 | +# Module Writen to OpenERP, Open Source Management Solution |
323 | +# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>). |
324 | +# All Rights Reserved |
325 | +############# Credits ######################################################### |
326 | +# Coded by: Katherine Zaoral <kathy@vauxoo.com> |
327 | +# Planified by: Humberto Arocha <hbto@vauxoo.com> |
328 | +# Audited by: Humberto Arocha <hbto@vauxoo.com> |
329 | +############################################################################### |
330 | +# This program is free software: you can redistribute it and/or modify |
331 | +# it under the terms of the GNU Affero General Public License as published |
332 | +# by the Free Software Foundation, either version 3 of the License, or |
333 | +# (at your option) any later version. |
334 | +# |
335 | +# This program is distributed in the hope that it will be useful, |
336 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
337 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
338 | +# GNU Affero General Public License for more details. |
339 | +# |
340 | +# You should have received a copy of the GNU Affero General Public License |
341 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
342 | +############################################################################### |
343 | + |
344 | |
345 | === added directory 'purchase_requisition_currency/workflow' |
waiting for runbot