Merge lp:~initos.com/syleam-modules/7.0-pricelist-discount into lp:~syleam/syleam-modules/7.0
- 7.0-pricelist-discount
- Merge into 7.0
Proposed by
Thomas Rehn
Status: | Needs review |
---|---|
Proposed branch: | lp:~initos.com/syleam-modules/7.0-pricelist-discount |
Merge into: | lp:~syleam/syleam-modules/7.0 |
Diff against target: |
542 lines (+474/-0) 13 files modified
pricelist_discount/.description (+1/-0) pricelist_discount/__init__.py (+31/-0) pricelist_discount/__openerp__.py (+48/-0) pricelist_discount/i18n/de.po (+37/-0) pricelist_discount/i18n/fr.po (+37/-0) pricelist_discount/i18n/pricelist_discount.pot (+37/-0) pricelist_discount/product.py (+67/-0) pricelist_discount/product_view.xml (+44/-0) sale_pricelist_discount/.description (+1/-0) sale_pricelist_discount/__init__.py (+31/-0) sale_pricelist_discount/__openerp__.py (+49/-0) sale_pricelist_discount/i18n/sale_pricelist_discount.pot (+21/-0) sale_pricelist_discount/sale.py (+70/-0) |
To merge this branch: | bzr merge lp:~initos.com/syleam-modules/7.0-pricelist-discount |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Syleam's employee | Pending | ||
Review via email: mp+199679@code.launchpad.net |
Commit message
Description of the change
This branch contains migrations of the 'pricelist_
The changes are mostly whitespace organization, the code is now PEP-8 compliant.
To post a comment you must log in.
Unmerged revisions
- 3. By Thomas Rehn
-
migrated "pricelist_
discount" and "sale_pricelist _discount" to version 7
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'pricelist_discount' |
2 | === added file 'pricelist_discount/.description' |
3 | --- pricelist_discount/.description 1970-01-01 00:00:00 +0000 |
4 | +++ pricelist_discount/.description 2013-12-19 15:54:25 +0000 |
5 | @@ -0,0 +1,1 @@ |
6 | +Pricelist Discount |
7 | |
8 | === added file 'pricelist_discount/__init__.py' |
9 | --- pricelist_discount/__init__.py 1970-01-01 00:00:00 +0000 |
10 | +++ pricelist_discount/__init__.py 2013-12-19 15:54:25 +0000 |
11 | @@ -0,0 +1,31 @@ |
12 | +# -*- coding: utf-8 -*- |
13 | +############################################################################## |
14 | +# |
15 | +# pricelist_discount module for OpenERP, Pricelist Discount |
16 | +# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>) |
17 | +# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr> |
18 | +# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>) |
19 | +# Benoît MOTTIN <benoit.mottin@syleam.fr> |
20 | +# Sebastien LANGE <sebastien.lange@syleam.fr> |
21 | +# Copyright (C) 2013 initOS GmbH & Co. KG <http://www.initos.com> |
22 | +# |
23 | +# This file is a part of pricelist_discount |
24 | +# |
25 | +# pricelist_discount is free software: you can redistribute it and/or modify |
26 | +# it under the terms of the GNU Affero General Public License as published |
27 | +# by the Free Software Foundation, either version 3 of the License, or |
28 | +# (at your option) any later version. |
29 | +# |
30 | +# pricelist_discount is distributed in the hope that it will be useful, |
31 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
32 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
33 | +# GNU Affero General Public License for more details. |
34 | +# |
35 | +# You should have received a copy of the GNU Affero General Public License |
36 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
37 | +# |
38 | +############################################################################## |
39 | + |
40 | +from . import product |
41 | + |
42 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
43 | |
44 | === added file 'pricelist_discount/__openerp__.py' |
45 | --- pricelist_discount/__openerp__.py 1970-01-01 00:00:00 +0000 |
46 | +++ pricelist_discount/__openerp__.py 2013-12-19 15:54:25 +0000 |
47 | @@ -0,0 +1,48 @@ |
48 | +# -*- coding: utf-8 -*- |
49 | +############################################################################## |
50 | +# |
51 | +# pricelist_discount module for OpenERP, Pricelist Discount |
52 | +# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>) |
53 | +# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr> |
54 | +# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>) |
55 | +# Benoît MOTTIN <benoit.mottin@syleam.fr> |
56 | +# Sebastien LANGE <sebastien.lange@syleam.fr> |
57 | +# |
58 | +# This file is a part of pricelist_discount |
59 | +# |
60 | +# pricelist_discount is free software: you can redistribute it and/or modify |
61 | +# it under the terms of the GNU Affero General Public License as published |
62 | +# by the Free Software Foundation, either version 3 of the License, or |
63 | +# (at your option) any later version. |
64 | +# |
65 | +# pricelist_discount is distributed in the hope that it will be useful, |
66 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
67 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
68 | +# GNU Affero General Public License for more details. |
69 | +# |
70 | +# You should have received a copy of the GNU Affero General Public License |
71 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
72 | +# |
73 | +############################################################################## |
74 | + |
75 | +{ |
76 | + 'name': 'Pricelist Discount', |
77 | + 'version': '0.2', |
78 | + 'category': 'Sales Management', |
79 | + 'description': """Add discount in pricelist""", |
80 | + 'author': 'SYLEAM; initOS', |
81 | + 'depends': [ |
82 | + 'base', |
83 | + 'product', |
84 | + ], |
85 | + 'data': [ |
86 | + 'product_view.xml', |
87 | + ], |
88 | + 'demo': [], |
89 | + 'test': [], |
90 | + 'installable': True, |
91 | + 'active': False, |
92 | + 'license': 'AGPL-3', |
93 | +} |
94 | + |
95 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
96 | |
97 | === added directory 'pricelist_discount/i18n' |
98 | === added file 'pricelist_discount/i18n/de.po' |
99 | --- pricelist_discount/i18n/de.po 1970-01-01 00:00:00 +0000 |
100 | +++ pricelist_discount/i18n/de.po 2013-12-19 15:54:25 +0000 |
101 | @@ -0,0 +1,37 @@ |
102 | +# Translation of OpenERP Server. |
103 | +# This file contains the translation of the following modules: |
104 | +# * pricelist_discount |
105 | +# |
106 | +msgid "" |
107 | +msgstr "" |
108 | +"Project-Id-Version: OpenERP Server 7.0\n" |
109 | +"Report-Msgid-Bugs-To: \n" |
110 | +"POT-Creation-Date: 2013-12-19 15:30+0000\n" |
111 | +"PO-Revision-Date: 2013-12-19 15:30+0000\n" |
112 | +"Last-Translator: <>\n" |
113 | +"Language-Team: \n" |
114 | +"MIME-Version: 1.0\n" |
115 | +"Content-Type: text/plain; charset=UTF-8\n" |
116 | +"Content-Transfer-Encoding: \n" |
117 | +"Plural-Forms: \n" |
118 | + |
119 | +#. module: pricelist_discount |
120 | +#: view:product.pricelist.item:0 |
121 | +msgid "Others Informations" |
122 | +msgstr "Andere Informationen" |
123 | + |
124 | +#. module: pricelist_discount |
125 | +#: model:ir.model,name:pricelist_discount.model_product_pricelist |
126 | +msgid "Pricelist" |
127 | +msgstr "Preisliste" |
128 | + |
129 | +#. module: pricelist_discount |
130 | +#: model:ir.model,name:pricelist_discount.model_product_pricelist_item |
131 | +msgid "Pricelist item" |
132 | +msgstr "Preislisteneintrag" |
133 | + |
134 | +#. module: pricelist_discount |
135 | +#: field:product.pricelist.item,discount:0 |
136 | +msgid "Discount (%)" |
137 | +msgstr "Rabatt (%)" |
138 | + |
139 | |
140 | === added file 'pricelist_discount/i18n/fr.po' |
141 | --- pricelist_discount/i18n/fr.po 1970-01-01 00:00:00 +0000 |
142 | +++ pricelist_discount/i18n/fr.po 2013-12-19 15:54:25 +0000 |
143 | @@ -0,0 +1,37 @@ |
144 | +# Translation of OpenERP Server. |
145 | +# This file contains the translation of the following modules: |
146 | +# * pricelist_discount |
147 | +# |
148 | +msgid "" |
149 | +msgstr "" |
150 | +"Project-Id-Version: OpenERP Server 6.1\n" |
151 | +"Report-Msgid-Bugs-To: \n" |
152 | +"POT-Creation-Date: 2013-12-19 15:30+0000\n" |
153 | +"PO-Revision-Date: 2012-08-31 11:24+0100\n" |
154 | +"Last-Translator: MOTTIN Benoît <benoit.mottin@syleam.fr>\n" |
155 | +"Language-Team: \n" |
156 | +"Language: \n" |
157 | +"MIME-Version: 1.0\n" |
158 | +"Content-Type: text/plain; charset=UTF-8\n" |
159 | +"Content-Transfer-Encoding: 8bit\n" |
160 | +"Plural-Forms: \n" |
161 | + |
162 | +#. module: pricelist_discount |
163 | +#: view:product.pricelist.item:0 |
164 | +msgid "Others Informations" |
165 | +msgstr "Autres informations" |
166 | + |
167 | +#. module: pricelist_discount |
168 | +#: model:ir.model,name:pricelist_discount.model_product_pricelist |
169 | +msgid "Pricelist" |
170 | +msgstr "Liste de prix" |
171 | + |
172 | +#. module: pricelist_discount |
173 | +#: model:ir.model,name:pricelist_discount.model_product_pricelist_item |
174 | +msgid "Pricelist item" |
175 | +msgstr "Élément de la liste de prix" |
176 | + |
177 | +#. module: pricelist_discount |
178 | +#: field:product.pricelist.item,discount:0 |
179 | +msgid "Discount (%)" |
180 | +msgstr "Remise (%)" |
181 | |
182 | === added file 'pricelist_discount/i18n/pricelist_discount.pot' |
183 | --- pricelist_discount/i18n/pricelist_discount.pot 1970-01-01 00:00:00 +0000 |
184 | +++ pricelist_discount/i18n/pricelist_discount.pot 2013-12-19 15:54:25 +0000 |
185 | @@ -0,0 +1,37 @@ |
186 | +# Translation of OpenERP Server. |
187 | +# This file contains the translation of the following modules: |
188 | +# * pricelist_discount |
189 | +# |
190 | +msgid "" |
191 | +msgstr "" |
192 | +"Project-Id-Version: OpenERP Server 7.0\n" |
193 | +"Report-Msgid-Bugs-To: \n" |
194 | +"POT-Creation-Date: 2013-12-19 15:30+0000\n" |
195 | +"PO-Revision-Date: 2013-12-19 15:30+0000\n" |
196 | +"Last-Translator: <>\n" |
197 | +"Language-Team: \n" |
198 | +"MIME-Version: 1.0\n" |
199 | +"Content-Type: text/plain; charset=UTF-8\n" |
200 | +"Content-Transfer-Encoding: \n" |
201 | +"Plural-Forms: \n" |
202 | + |
203 | +#. module: pricelist_discount |
204 | +#: view:product.pricelist.item:0 |
205 | +msgid "Others Informations" |
206 | +msgstr "" |
207 | + |
208 | +#. module: pricelist_discount |
209 | +#: model:ir.model,name:pricelist_discount.model_product_pricelist |
210 | +msgid "Pricelist" |
211 | +msgstr "" |
212 | + |
213 | +#. module: pricelist_discount |
214 | +#: model:ir.model,name:pricelist_discount.model_product_pricelist_item |
215 | +msgid "Pricelist item" |
216 | +msgstr "" |
217 | + |
218 | +#. module: pricelist_discount |
219 | +#: field:product.pricelist.item,discount:0 |
220 | +msgid "Discount (%)" |
221 | +msgstr "" |
222 | + |
223 | |
224 | === added file 'pricelist_discount/product.py' |
225 | --- pricelist_discount/product.py 1970-01-01 00:00:00 +0000 |
226 | +++ pricelist_discount/product.py 2013-12-19 15:54:25 +0000 |
227 | @@ -0,0 +1,67 @@ |
228 | +# -*- coding: utf-8 -*- |
229 | +############################################################################## |
230 | +# |
231 | +# pricelist_discount module for OpenERP, Pricelist Discount |
232 | +# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>) |
233 | +# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr> |
234 | +# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>) |
235 | +# Benoît MOTTIN <benoit.mottin@syleam.fr> |
236 | +# Sebastien LANGE <sebastien.lange@syleam.fr> |
237 | +# Copyright (C) 2013 initOS GmbH & Co. KG <http://www.initos.com> |
238 | +# |
239 | +# This file is a part of pricelist_discount |
240 | +# |
241 | +# pricelist_discount is free software: you can redistribute it and/or modify |
242 | +# it under the terms of the GNU Affero General Public License as published |
243 | +# by the Free Software Foundation, either version 3 of the License, or |
244 | +# (at your option) any later version. |
245 | +# |
246 | +# pricelist_discount is distributed in the hope that it will be useful, |
247 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
248 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
249 | +# GNU Affero General Public License for more details. |
250 | +# |
251 | +# You should have received a copy of the GNU Affero General Public License |
252 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
253 | +# |
254 | +############################################################################## |
255 | + |
256 | +from osv import osv, fields |
257 | + |
258 | + |
259 | +class product_pricelist(osv.Model): |
260 | + _inherit = "product.pricelist" |
261 | + |
262 | + def price_get(self, cr, uid, ids, prod_id, qty, partner=None, |
263 | + context=None): |
264 | + """ |
265 | + Add discount if set in result |
266 | + """ |
267 | + context = context or {} |
268 | + result = super(product_pricelist, self)\ |
269 | + .price_get(cr, uid, ids, prod_id, qty, |
270 | + partner=partner, context=context) |
271 | + if 'discount' in context: |
272 | + discount = self.pool.get('product.pricelist.item')\ |
273 | + .browse(cr, uid, result['item_id'].values()[0], |
274 | + context=context)\ |
275 | + .discount or False |
276 | + if discount: |
277 | + result.update({'discount': discount}) |
278 | + return result |
279 | + |
280 | + |
281 | +class product_pricelist_item(osv.Model): |
282 | + _inherit = 'product.pricelist.item' |
283 | + |
284 | + _columns = { |
285 | + 'discount': fields.float('Discount (%)', digits=(16, 2)), |
286 | + } |
287 | + |
288 | + _defaults = { |
289 | + 'discount': 0.0, |
290 | + } |
291 | + |
292 | + |
293 | + |
294 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
295 | |
296 | === added file 'pricelist_discount/product_view.xml' |
297 | --- pricelist_discount/product_view.xml 1970-01-01 00:00:00 +0000 |
298 | +++ pricelist_discount/product_view.xml 2013-12-19 15:54:25 +0000 |
299 | @@ -0,0 +1,44 @@ |
300 | +<?xml version="1.0" encoding="UTF-8"?> |
301 | +<openerp> |
302 | + <data> |
303 | + ############################################################################## |
304 | + # |
305 | + # pricelist_discount module for OpenERP, Pricelist Discount |
306 | + # Copyright (C) 2012 SYLEAM Info Services ([http://www.syleam.fr/]) |
307 | + # Benoît MOTTIN [benoit.mottin@syleam.fr] |
308 | + # Sebastien LANGE [sebastien.lange@syleam.fr] |
309 | + # |
310 | + # This file is a part of pricelist_discount |
311 | + # |
312 | + # pricelist_discount is free software: you can redistribute it and/or modify |
313 | + # it under the terms of the GNU Affero General Public License as published by |
314 | + # the Free Software Foundation, either version 3 of the License, or |
315 | + # (at your option) any later version. |
316 | + # |
317 | + # pricelist_discount is distributed in the hope that it will be useful, |
318 | + # but WITHOUT ANY WARRANTY; without even the implied warranty of |
319 | + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
320 | + # GNU Affero General Public License for more details. |
321 | + # |
322 | + # You should have received a copy of the GNU Affero General Public License |
323 | + # along with this program. If not, see [http://www.gnu.org/licenses/]. |
324 | + # |
325 | + ############################################################################## |
326 | + |
327 | + <record id="view_product_pricelist_item_form" model="ir.ui.view"> |
328 | + <field name="name">product.pricelist.item</field> |
329 | + <field name="model">product.pricelist.item</field> |
330 | + <field name="inherit_id" ref="product.product_pricelist_item_form_view" /> |
331 | + <field name="type">tree</field> |
332 | + <field name="arch" type="xml"> |
333 | + <xpath expr="//field[@name='price_max_margin']" position="after"> |
334 | + <group colspan="3"> |
335 | + <separator colspan="4" string="Others Informations"/> |
336 | + <field name="discount"/> |
337 | + </group> |
338 | + </xpath> |
339 | + </field> |
340 | + </record> |
341 | + |
342 | + </data> |
343 | +</openerp> |
344 | |
345 | === added directory 'sale_pricelist_discount' |
346 | === added file 'sale_pricelist_discount/.description' |
347 | --- sale_pricelist_discount/.description 1970-01-01 00:00:00 +0000 |
348 | +++ sale_pricelist_discount/.description 2013-12-19 15:54:25 +0000 |
349 | @@ -0,0 +1,1 @@ |
350 | +Sale pricelist discount |
351 | |
352 | === added file 'sale_pricelist_discount/__init__.py' |
353 | --- sale_pricelist_discount/__init__.py 1970-01-01 00:00:00 +0000 |
354 | +++ sale_pricelist_discount/__init__.py 2013-12-19 15:54:25 +0000 |
355 | @@ -0,0 +1,31 @@ |
356 | +# -*- coding: utf-8 -*- |
357 | +############################################################################## |
358 | +# |
359 | +# sale_pricelist_discount module for OpenERP, Sale pricelist discount |
360 | +# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>) |
361 | +# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr> |
362 | +# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>) |
363 | +# Benoît MOTTIN <benoit.mottin@syleam.fr> |
364 | +# Sebastien LANGE <sebastien.lange@syleam.fr> |
365 | +# Copyright (C) 2013 initOS GmbH & Co. KG <http://www.initos.com> |
366 | +# |
367 | +# This file is a part of sale_pricelist_discount |
368 | +# |
369 | +# sale_pricelist_discount is free software: you can redistribute it and/or |
370 | +# modify it under the terms of the GNU Affero General Public License as |
371 | +# published by the Free Software Foundation, either version 3 of the |
372 | +# License, or (at your option) any later version. |
373 | +# |
374 | +# sale_pricelist_discount is distributed in the hope that it will be useful, |
375 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
376 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
377 | +# GNU Affero General Public License for more details. |
378 | +# |
379 | +# You should have received a copy of the GNU Affero General Public License |
380 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
381 | +# |
382 | +############################################################################## |
383 | + |
384 | +from . import sale |
385 | + |
386 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
387 | |
388 | === added file 'sale_pricelist_discount/__openerp__.py' |
389 | --- sale_pricelist_discount/__openerp__.py 1970-01-01 00:00:00 +0000 |
390 | +++ sale_pricelist_discount/__openerp__.py 2013-12-19 15:54:25 +0000 |
391 | @@ -0,0 +1,49 @@ |
392 | +# -*- coding: utf-8 -*- |
393 | +############################################################################## |
394 | +# |
395 | +# sale_pricelist_discount module for OpenERP, Sale pricelist discount |
396 | +# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>) |
397 | +# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr> |
398 | +# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>) |
399 | +# Benoît MOTTIN <benoit.mottin@syleam.fr> |
400 | +# Sebastien LANGE <sebastien.lange@syleam.fr> |
401 | +# Copyright (C) 2013 initOS GmbH & Co. KG <http://www.initos.com> |
402 | +# |
403 | +# This file is a part of sale_pricelist_discount |
404 | +# |
405 | +# sale_pricelist_discount is free software: you can redistribute it and/or |
406 | +# modify it under the terms of the GNU Affero General Public License as |
407 | +# published by the Free Software Foundation, either version 3 of the |
408 | +# License, or (at your option) any later version. |
409 | +# |
410 | +# sale_pricelist_discount is distributed in the hope that it will be useful, |
411 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
412 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
413 | +# GNU Affero General Public License for more details. |
414 | +# |
415 | +# You should have received a copy of the GNU Affero General Public License |
416 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
417 | +# |
418 | +############################################################################## |
419 | + |
420 | +{ |
421 | + 'name': 'Sale Pricelist Discount', |
422 | + 'version': '0.4', |
423 | + 'category': 'Sales Management', |
424 | + 'description': """ |
425 | + Get Discount in pricelist and put it in discount sale's field""", |
426 | + 'author': 'SYLEAM; initOS', |
427 | + 'depends': [ |
428 | + 'base', |
429 | + 'sale', |
430 | + 'pricelist_discount', |
431 | + ], |
432 | + 'data': [], |
433 | + 'demo': [], |
434 | + 'test': [], |
435 | + 'installable': True, |
436 | + 'active': False, |
437 | + 'license': 'AGPL-3', |
438 | +} |
439 | + |
440 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
441 | |
442 | === added directory 'sale_pricelist_discount/i18n' |
443 | === added file 'sale_pricelist_discount/i18n/sale_pricelist_discount.pot' |
444 | --- sale_pricelist_discount/i18n/sale_pricelist_discount.pot 1970-01-01 00:00:00 +0000 |
445 | +++ sale_pricelist_discount/i18n/sale_pricelist_discount.pot 2013-12-19 15:54:25 +0000 |
446 | @@ -0,0 +1,21 @@ |
447 | +# Translation of OpenERP Server. |
448 | +# This file contains the translation of the following modules: |
449 | +# |
450 | +msgid "" |
451 | +msgstr "" |
452 | +"Project-Id-Version: OpenERP Server 7.0\n" |
453 | +"Report-Msgid-Bugs-To: \n" |
454 | +"POT-Creation-Date: 2013-12-19 15:30+0000\n" |
455 | +"PO-Revision-Date: 2013-12-19 15:30+0000\n" |
456 | +"Last-Translator: <>\n" |
457 | +"Language-Team: \n" |
458 | +"MIME-Version: 1.0\n" |
459 | +"Content-Type: text/plain; charset=UTF-8\n" |
460 | +"Content-Transfer-Encoding: \n" |
461 | +"Plural-Forms: \n" |
462 | + |
463 | +#. module: sale_pricelist_discount |
464 | +#: model:ir.model,name:sale_pricelist_discount.model_sale_order_line |
465 | +msgid "Sales Order Line" |
466 | +msgstr "" |
467 | + |
468 | |
469 | === added file 'sale_pricelist_discount/sale.py' |
470 | --- sale_pricelist_discount/sale.py 1970-01-01 00:00:00 +0000 |
471 | +++ sale_pricelist_discount/sale.py 2013-12-19 15:54:25 +0000 |
472 | @@ -0,0 +1,70 @@ |
473 | +# -*- coding: utf-8 -*- |
474 | +############################################################################## |
475 | +# |
476 | +# sale_pricelist_discount module for OpenERP, Sale pricelist discount |
477 | +# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>) |
478 | +# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr> |
479 | +# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>) |
480 | +# Benoît MOTTIN <benoit.mottin@syleam.fr> |
481 | +# Sebastien LANGE <sebastien.lange@syleam.fr> |
482 | +# Copyright (C) 2013 initOS GmbH & Co. KG <http://www.initos.com> |
483 | +# |
484 | +# This file is a part of sale_pricelist_discount |
485 | +# |
486 | +# sale_pricelist_discount is free software: you can redistribute it and/or |
487 | +# modify it under the terms of the GNU Affero General Public License as |
488 | +# published by the Free Software Foundation, either version 3 of the |
489 | +# License, or (at your option) any later version. |
490 | +# |
491 | +# sale_pricelist_discount is distributed in the hope that it will be useful, |
492 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
493 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
494 | +# GNU Affero General Public License for more details. |
495 | +# |
496 | +# You should have received a copy of the GNU Affero General Public License |
497 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
498 | +# |
499 | +############################################################################## |
500 | + |
501 | +from osv import osv |
502 | +import time |
503 | +from tools import DEFAULT_SERVER_DATE_FORMAT |
504 | + |
505 | + |
506 | +class sale_order_line(osv.Model): |
507 | + _inherit = 'sale.order.line' |
508 | + |
509 | + def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, |
510 | + uom=False, qty_uos=0, uos=False, name='', |
511 | + partner_id=False, lang=False, update_tax=True, |
512 | + date_order=False, packaging=False, |
513 | + fiscal_position=False, flag=False, context=None): |
514 | + """ |
515 | + Get discount if exists |
516 | + """ |
517 | + result = super(sale_order_line, self)\ |
518 | + .product_id_change(cr, uid, ids, pricelist, product, qty, uom, |
519 | + qty_uos, uos, name, partner_id, lang, |
520 | + update_tax, date_order, packaging, |
521 | + fiscal_position, flag, context=context) |
522 | + if not product: |
523 | + return result |
524 | + if not date_order: |
525 | + date_order = time.strftime(DEFAULT_SERVER_DATE_FORMAT) |
526 | + |
527 | + # get discount |
528 | + discount_params = { |
529 | + 'uom': uom or self.pool.get('product.product') |
530 | + .browse(cr, uid, product, context=context) |
531 | + .uom_id.id, |
532 | + 'date': date_order, |
533 | + 'discount': True, |
534 | + } |
535 | + price_dict = self.pool.get('product.pricelist')\ |
536 | + .price_get(cr, uid, [pricelist], product, qty or 1.0, |
537 | + partner_id, discount_params) |
538 | + if price_dict.get('discount', False): |
539 | + result['value']['discount'] = price_dict['discount'] |
540 | + return result |
541 | + |
542 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |