Merge lp:~openerp-community-reviewer/e-commerce-addons/move_sale_exception_to_sale_wkfl_branches-jge into lp:~extra-addons-commiter/e-commerce-addons/7.0
- move_sale_exception_to_sale_wkfl_branches-jge
- Merge into 7.0
Status: | Merged |
---|---|
Merged at revision: | 286 |
Proposed branch: | lp:~openerp-community-reviewer/e-commerce-addons/move_sale_exception_to_sale_wkfl_branches-jge |
Merge into: | lp:~extra-addons-commiter/e-commerce-addons/7.0 |
Diff against target: |
582 lines (+0/-524) 11 files modified
sale_exceptions/__init__.py (+0/-25) sale_exceptions/__openerp__.py (+0/-48) sale_exceptions/sale.py (+0/-208) sale_exceptions/sale_exceptions_data.xml (+0/-19) sale_exceptions/sale_view.xml (+0/-106) sale_exceptions/sale_workflow.xml (+0/-9) sale_exceptions/security/ir.model.access.csv (+0/-3) sale_exceptions/settings/sale.exception.csv (+0/-5) sale_exceptions/wizard/__init__.py (+0/-1) sale_exceptions/wizard/sale_exception_confirm.py (+0/-56) sale_exceptions/wizard/sale_exception_confirm_view.xml (+0/-44) |
To merge this branch: | bzr merge lp:~openerp-community-reviewer/e-commerce-addons/move_sale_exception_to_sale_wkfl_branches-jge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nicolas Bessi - Camptocamp (community) | Approve | ||
Guewen Baconnier @ Camptocamp | Approve | ||
Pedro Manuel Baeza (community) | Approve | ||
Review via email: mp+193570@code.launchpad.net |
Commit message
[MOVE] Move here the sale_exceptions module to the lp:sale-wkfl branch
Description of the change
Hi,
I suggest to move the sale_exceptions module from e-commerce-addons to lp:sale-wkfl branch because it concern the sales workflow in a more generic way than just the e-commerce context.
I put the branch under the reviewer team so feel free to fix stuff if you'd like. This depends on this merge : https:/
WARNING : Do not merge this one before ensuring the first one is merged !!!
Regards,
Joël
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote : | # |
Hi, I am working on the split of sale_exception in two module "sale_exception" and "exception_rule". The aim is to have the exception on different object like purchase_order, stock_picking, invoice ... (already implemented on purchase_order and soon on picking).
If we put the module sale_exception here where should I put the module "exception_rule" and "purchase_
I see two solution possible
- Putting exception_rule in "server-env-tools" and than all implementation in sale-wkfl, purchase-wkfl...
- Creating a project "workflow-
What do you prefers?
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote : | # |
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
I approve for the move.
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote : | # |
LGTM
Preview Diff
1 | === removed directory 'sale_exceptions' |
2 | === removed file 'sale_exceptions/__init__.py' |
3 | --- sale_exceptions/__init__.py 2012-02-24 09:31:32 +0000 |
4 | +++ sale_exceptions/__init__.py 1970-01-01 00:00:00 +0000 |
5 | @@ -1,25 +0,0 @@ |
6 | -# -*- coding: utf-8 -*- |
7 | -############################################################################## |
8 | -# |
9 | -# OpenERP, Open Source Management Solution |
10 | -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
11 | -# |
12 | -# This program is free software: you can redistribute it and/or modify |
13 | -# it under the terms of the GNU Affero General Public License as |
14 | -# published by the Free Software Foundation, either version 3 of the |
15 | -# License, or (at your option) any later version. |
16 | -# |
17 | -# This program is distributed in the hope that it will be useful, |
18 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | -# GNU Affero General Public License for more details. |
21 | -# |
22 | -# You should have received a copy of the GNU Affero General Public License |
23 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | -# |
25 | -############################################################################## |
26 | - |
27 | -import sale |
28 | -import wizard |
29 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
30 | - |
31 | |
32 | === removed file 'sale_exceptions/__openerp__.py' |
33 | --- sale_exceptions/__openerp__.py 2012-12-26 13:05:09 +0000 |
34 | +++ sale_exceptions/__openerp__.py 1970-01-01 00:00:00 +0000 |
35 | @@ -1,48 +0,0 @@ |
36 | -# -*- coding: utf-8 -*- |
37 | -############################################################################## |
38 | -# |
39 | -# OpenERP, Open Source Management Solution |
40 | -# Copyright (C) 2011 Akretion LTDA. |
41 | -# authors: Raphaël Valyi, Renato Lima |
42 | -# Copyright (C) 2010-2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com> |
43 | -# Copyright (C) 2012 Camptocamp SA (Guewen Baconnier) |
44 | -# |
45 | -# This program is free software: you can redistribute it and/or modify |
46 | -# it under the terms of the GNU Affero General Public License as |
47 | -# published by the Free Software Foundation, either version 3 of the |
48 | -# License, or (at your option) any later version. |
49 | -# |
50 | -# This program is distributed in the hope that it will be useful, |
51 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
52 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
53 | -# GNU Affero General Public License for more details. |
54 | -# |
55 | -# You should have received a copy of the GNU Affero General Public License |
56 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
57 | -# |
58 | -############################################################################## |
59 | - |
60 | - |
61 | -{ |
62 | - 'name': 'Sale Exceptions', |
63 | - 'version': '0.1', |
64 | - 'category': 'Generic Modules/Sale', |
65 | - 'description': """ |
66 | -This module allows you attach several customizable exceptions to your sale order in a way that you can filter orders by exceptions type and fix them. |
67 | -This is especially useful in an order importation scenario such as with the base_sale_multi_channels module, because it's likely a few orders have errors when you import them (like product not found in OpenERP, wrong line format etc...) |
68 | -""", |
69 | - 'author': 'Akretion', |
70 | - 'website': 'http://www.akretion.com', |
71 | - 'depends': ['sale'], |
72 | - 'init_xml': [ |
73 | - 'settings/sale.exception.csv', |
74 | - ], |
75 | - 'update_xml': ['sale_workflow.xml', |
76 | - 'sale_view.xml', |
77 | - 'sale_exceptions_data.xml', |
78 | - 'wizard/sale_exception_confirm_view.xml', |
79 | - 'security/ir.model.access.csv'], |
80 | - 'demo_xml': [], |
81 | - 'installable': True, |
82 | -} |
83 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
84 | |
85 | === removed file 'sale_exceptions/sale.py' |
86 | --- sale_exceptions/sale.py 2012-12-26 13:05:09 +0000 |
87 | +++ sale_exceptions/sale.py 1970-01-01 00:00:00 +0000 |
88 | @@ -1,208 +0,0 @@ |
89 | -# -*- coding: utf-8 -*- |
90 | -############################################################################## |
91 | -# |
92 | -# OpenERP, Open Source Management Solution |
93 | -# Copyright (C) 2011 Akretion LTDA. |
94 | -# Copyright (C) 2010-2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com> |
95 | -# Copyright (C) 2012 Camptocamp SA (Guewen Baconnier) |
96 | -# |
97 | -# This program is free software: you can redistribute it and/or modify |
98 | -# it under the terms of the GNU Affero General Public License as |
99 | -# published by the Free Software Foundation, either version 3 of the |
100 | -# License, or (at your option) any later version. |
101 | -# |
102 | -# This program is distributed in the hope that it will be useful, |
103 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
104 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
105 | -# GNU Affero General Public License for more details. |
106 | -# |
107 | -# You should have received a copy of the GNU Affero General Public License |
108 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
109 | -# |
110 | -############################################################################## |
111 | - |
112 | -import time |
113 | -import netsvc |
114 | - |
115 | -from openerp.osv.orm import Model |
116 | -from openerp.osv import fields |
117 | -from openerp.osv.osv import except_osv |
118 | -from tools.safe_eval import safe_eval as eval |
119 | -from tools.translate import _ |
120 | - |
121 | -class sale_exception(Model): |
122 | - _name = "sale.exception" |
123 | - _description = "Sale Exceptions" |
124 | - _order="active desc, sequence asc" |
125 | - _columns = { |
126 | - 'name': fields.char('Exception Name', size=64, required=True, translate=True), |
127 | - 'description': fields.text('Description', translate=True), |
128 | - 'sequence': fields.integer('Sequence', help="Gives the sequence order when applying the test"), |
129 | - 'model': fields.selection([('sale.order', 'Sale Order'), |
130 | - ('sale.order.line', 'Sale Order Line')], |
131 | - string='Apply on', required=True), |
132 | - 'active': fields.boolean('Active'), |
133 | - 'code': fields.text('Python Code', |
134 | - help="Python code executed to check if the exception apply or not. " \ |
135 | - "The code must apply block = True to apply the exception."), |
136 | - 'sale_order_ids': fields.many2many('sale.order', 'sale_order_exception_rel', |
137 | - 'exception_id', 'sale_order_id', |
138 | - string='Sale Orders', readonly=True), |
139 | - } |
140 | - |
141 | - _defaults = { |
142 | - 'code': """# Python code. Use failed = True to block the sale order. |
143 | -# You can use the following variables : |
144 | -# - self: ORM model of the record which is checked |
145 | -# - order or line: browse_record of the sale order or sale order line |
146 | -# - object: same as order or line, browse_record of the sale order or sale order line |
147 | -# - pool: ORM model pool (i.e. self.pool) |
148 | -# - time: Python time module |
149 | -# - cr: database cursor |
150 | -# - uid: current user id |
151 | -# - context: current context |
152 | -""" |
153 | - } |
154 | - |
155 | -class sale_order(Model): |
156 | - _inherit = "sale.order" |
157 | - |
158 | - _order = 'main_exception_id asc, date_order desc, name desc' |
159 | - |
160 | - def _get_main_error(self, cr, uid, ids, name, args, context=None): |
161 | - res = {} |
162 | - for sale_order in self.browse(cr, uid, ids, context=context): |
163 | - if sale_order.state == 'draft' and sale_order.exceptions_ids: |
164 | - res[sale_order.id] = sale_order.exceptions_ids[0].id |
165 | - else: |
166 | - res[sale_order.id] = False |
167 | - return res |
168 | - |
169 | - _columns = { |
170 | - 'main_exception_id': fields.function(_get_main_error, |
171 | - type='many2one', |
172 | - relation="sale.exception", |
173 | - string='Main Exception', |
174 | - store={ |
175 | - 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['exceptions_ids', 'state'], 10), |
176 | - }), |
177 | - 'exceptions_ids': fields.many2many('sale.exception', 'sale_order_exception_rel', |
178 | - 'sale_order_id', 'exception_id', |
179 | - string='Exceptions'), |
180 | - 'ignore_exceptions': fields.boolean('Ignore Exceptions'), |
181 | - } |
182 | - |
183 | - def test_all_draft_orders(self, cr, uid, context=None): |
184 | - ids = self.search(cr, uid, [('state', '=', 'draft')]) |
185 | - self.test_exceptions(cr, uid, ids) |
186 | - return True |
187 | - |
188 | - def _popup_exceptions(self, cr, uid, order_id, context=None): |
189 | - model_data_obj = self.pool.get('ir.model.data') |
190 | - list_obj = self.pool.get('sale.exception.confirm') |
191 | - ctx = context.copy() |
192 | - ctx.update({'active_id': order_id, |
193 | - 'active_ids': [order_id]}) |
194 | - list_id = list_obj.create(cr, uid, {}, context=ctx) |
195 | - view_id = model_data_obj.get_object_reference( |
196 | - cr, uid, 'sale_exceptions', 'view_sale_exception_confirm')[1] |
197 | - action = { |
198 | - 'name': _("Exceptions On Sale Order"), |
199 | - 'type': 'ir.actions.act_window', |
200 | - 'view_type': 'form', |
201 | - 'view_mode': 'form', |
202 | - 'res_model': 'sale.exception.confirm', |
203 | - 'view_id': [view_id], |
204 | - 'target': 'new', |
205 | - 'nodestroy': True, |
206 | - 'res_id': list_id, |
207 | - } |
208 | - return action |
209 | - |
210 | - def action_button_confirm(self, cr, uid, ids, context=None): |
211 | - exception_ids = self.detect_exceptions(cr, uid, ids, context=context) |
212 | - if exception_ids: |
213 | - return self._popup_exceptions(cr, uid, ids[0], context=context) |
214 | - else: |
215 | - return super(sale_order, self).action_button_confirm(cr, uid, ids, context=context) |
216 | - |
217 | - def test_exceptions(self, cr, uid, ids, context=None): |
218 | - """ |
219 | - Condition method for the workflow from draft to confirm |
220 | - """ |
221 | - exception_ids = self.detect_exceptions(cr, uid, ids, context=context) |
222 | - if exception_ids: |
223 | - return False |
224 | - return True |
225 | - |
226 | - def detect_exceptions(self, cr, uid, ids, context=None): |
227 | - exception_obj = self.pool.get('sale.exception') |
228 | - order_exception_ids = exception_obj.search(cr, uid, |
229 | - [('model', '=', 'sale.order')], context=context) |
230 | - line_exception_ids = exception_obj.search(cr, uid, |
231 | - [('model', '=', 'sale.order.line')], context=context) |
232 | - |
233 | - order_exceptions = exception_obj.browse(cr, uid, order_exception_ids, context=context) |
234 | - line_exceptions = exception_obj.browse(cr, uid, line_exception_ids, context=context) |
235 | - |
236 | - exception_ids = False |
237 | - for order in self.browse(cr, uid, ids): |
238 | - if order.ignore_exceptions: |
239 | - continue |
240 | - exception_ids = self._detect_exceptions(cr, uid, order, |
241 | - order_exceptions, line_exceptions, context=context) |
242 | - |
243 | - self.write(cr, uid, [order.id], {'exceptions_ids': [(6, 0, exception_ids)]}) |
244 | - return exception_ids |
245 | - |
246 | - def _exception_rule_eval_context(self, cr, uid, obj_name, obj, context=None): |
247 | - if context is None: |
248 | - context = {} |
249 | - |
250 | - return {obj_name: obj, |
251 | - 'self': self.pool.get(obj._name), |
252 | - 'object': obj, |
253 | - 'obj': obj, |
254 | - 'pool': self.pool, |
255 | - 'cr': cr, |
256 | - 'uid': uid, |
257 | - 'user': self.pool.get('res.users').browse(cr, uid, uid), |
258 | - 'time': time, |
259 | - # copy context to prevent side-effects of eval |
260 | - 'context': dict(context),} |
261 | - |
262 | - def _rule_eval(self, cr, uid, rule, obj_name, obj, context): |
263 | - expr = rule.code |
264 | - space = self._exception_rule_eval_context(cr, uid, obj_name, obj, |
265 | - context=context) |
266 | - try: |
267 | - eval(expr, space, |
268 | - mode='exec', nocopy=True) # nocopy allows to return 'result' |
269 | - except Exception, e: |
270 | - raise except_osv(_('Error'), _('Error when evaluating the sale exception rule :\n %s \n(%s)') % |
271 | - (rule.name, e)) |
272 | - return space.get('failed', False) |
273 | - |
274 | - def _detect_exceptions(self, cr, uid, order, order_exceptions, line_exceptions, context=None): |
275 | - exception_ids = [] |
276 | - for rule in order_exceptions: |
277 | - if self._rule_eval(cr, uid, rule, 'order', order, context): |
278 | - exception_ids.append(rule.id) |
279 | - |
280 | - for order_line in order.order_line: |
281 | - for rule in line_exceptions: |
282 | - if rule.id in exception_ids: |
283 | - continue # we do not matter if the exception as already been |
284 | - # found for an order line of this order |
285 | - if self._rule_eval(cr, uid, rule, 'line', order_line, context): |
286 | - exception_ids.append(rule.id) |
287 | - |
288 | - return exception_ids |
289 | - |
290 | - def copy(self, cr, uid, id, default=None, context=None): |
291 | - if default is None: |
292 | - default = {} |
293 | - default.update({ |
294 | - 'ignore_exceptions': False, |
295 | - }) |
296 | - return super(sale_order, self).copy(cr, uid, id, default=default, context=context) |
297 | |
298 | === removed file 'sale_exceptions/sale_exceptions_data.xml' |
299 | --- sale_exceptions/sale_exceptions_data.xml 2012-09-06 12:34:40 +0000 |
300 | +++ sale_exceptions/sale_exceptions_data.xml 1970-01-01 00:00:00 +0000 |
301 | @@ -1,19 +0,0 @@ |
302 | -<?xml version="1.0" encoding="utf-8"?> |
303 | -<openerp> |
304 | - <data noupdate="1"> |
305 | - |
306 | - <record forcecreate="True" id="ir_cron_test_orders" model="ir.cron"> |
307 | - <field name="name">Test Draft Orders</field> |
308 | - <field eval="False" name="active"/> |
309 | - <field name="user_id" ref="base.user_root"/> |
310 | - <field name="interval_number">20</field> |
311 | - <field name="interval_type">minutes</field> |
312 | - <field name="numbercall">-1</field> |
313 | - <field eval="False" name="doall"/> |
314 | - <field eval="'sale.order'" name="model"/> |
315 | - <field eval="'test_all_draft_orders'" name="function"/> |
316 | - <field eval="'()'" name="args"/> |
317 | - </record> |
318 | - |
319 | - </data> |
320 | -</openerp> |
321 | |
322 | === removed file 'sale_exceptions/sale_view.xml' |
323 | --- sale_exceptions/sale_view.xml 2012-12-26 13:19:13 +0000 |
324 | +++ sale_exceptions/sale_view.xml 1970-01-01 00:00:00 +0000 |
325 | @@ -1,106 +0,0 @@ |
326 | -<?xml version="1.0" ?> |
327 | -<openerp> |
328 | - <data> |
329 | - |
330 | - <record id="view_sale_exception_tree" model="ir.ui.view"> |
331 | - <field name="name">sale.exception.tree</field> |
332 | - <field name="model">sale.exception</field> |
333 | - <field name="type">tree</field> |
334 | - <field name="arch" type="xml"> |
335 | - <tree string="Sale Exception"> |
336 | - <field name="active"/> |
337 | - <field name="name"/> |
338 | - <field name="description"/> |
339 | - <field name="model"/> |
340 | - <field name="sequence"/> |
341 | - </tree> |
342 | - </field> |
343 | - </record> |
344 | - |
345 | - <record id="view_sale_exception_form" model="ir.ui.view"> |
346 | - <field name="name">sale.exception.form</field> |
347 | - <field name="model">sale.exception</field> |
348 | - <field name="type">form</field> |
349 | - <field name="arch" type="xml"> |
350 | - <form string="Sale Exception Setup"> |
351 | - <group colspan="4" col="2"> |
352 | - <field name="name"/> |
353 | - <field name="description"/> |
354 | - </group> |
355 | - <group col="4" colspan="4" groups="base.group_sale_manager"> |
356 | - <field name="active"/> |
357 | - <field name="sequence"/> |
358 | - <group colspan="4" col="2" groups="base.group_system"> |
359 | - <field name="model"/> |
360 | - <field name="code"/> |
361 | - </group> |
362 | - </group> |
363 | - <group colspan="4" col="2"> |
364 | - <separator string="Affected Sales Orders"/> |
365 | - <newline/> |
366 | - <field name="sale_order_ids" nolabel="1" domain="[('state', '=', 'draft')]"/> |
367 | - </group> |
368 | - </form> |
369 | - </field> |
370 | - </record> |
371 | - |
372 | - <record id="action_sale_test_tree" model="ir.actions.act_window"> |
373 | - <field name="name">Exception Rules</field> |
374 | - <field name="res_model">sale.exception</field> |
375 | - <field name="view_type">form</field> |
376 | - <field name="view_mode">tree,form</field> |
377 | - <field name="view_id" ref="view_sale_exception_tree"/> |
378 | - <field name="context">{'active_test': False}</field> |
379 | - </record> |
380 | - |
381 | - <menuitem action="action_sale_test_tree" id="menu_sale_test" parent="base.menu_sale_config_sales" /> |
382 | - |
383 | - |
384 | - <record id="view_order_form" model="ir.ui.view"> |
385 | - <field name="name">sale_exceptions.view_order_form</field> |
386 | - <field name="model">sale.order</field> |
387 | - <field name="type">form</field> |
388 | - <field name="priority">100</field> |
389 | - <field name="inherit_id" ref="sale.view_order_form"/> |
390 | - <field name="arch" type="xml"> |
391 | - <field name="name" position="after"> |
392 | - <field name="main_exception_id" nolabel="1" |
393 | - attrs="{'invisible':[('main_exception_id','=', False)]}"/> |
394 | - </field> |
395 | - <xpath expr="//page[@string='Other Information']/group" |
396 | - position="inside"> |
397 | - <group name="exception" colspan="2" col="2"> |
398 | - <separator string="Exception" colspan="2"/> |
399 | - <field name="exceptions_ids" colspan="2" nolabel="1"/> |
400 | - </group> |
401 | - </xpath> |
402 | - </field> |
403 | - </record> |
404 | - |
405 | - <record id="view_order_tree" model="ir.ui.view"> |
406 | - <field name="name">sale_exceptions.view_order_tree</field> |
407 | - <field name="model">sale.order</field> |
408 | - <field name="type">tree</field> |
409 | - <field name="inherit_id" ref="sale.view_order_tree"/> |
410 | - <field name="arch" type="xml"> |
411 | - <field name="state" position="after"> |
412 | - <field name="main_exception_id"/> |
413 | - </field> |
414 | - </field> |
415 | - </record> |
416 | - |
417 | - <record id="view_sales_order_filter" model="ir.ui.view"> |
418 | - <field name="name">sale_exceptions.view_sales_order_filter</field> |
419 | - <field name="model">sale.order</field> |
420 | - <field name="inherit_id" ref="sale.view_sales_order_filter" /> |
421 | - <field name="type">search</field> |
422 | - <field eval="32" name="priority"/> |
423 | - <field name="arch" type="xml"> |
424 | - <filter icon="terp-check" string="Sales" position="after"> |
425 | - <separator orientation="vertical"/> |
426 | - <filter icon="terp-emblem-important" name="tofix" string="TO FIX" domain="[('main_exception_id','!=',False)]"/> |
427 | - </filter> |
428 | - </field> |
429 | - </record> |
430 | - </data> |
431 | -</openerp> |
432 | |
433 | === removed file 'sale_exceptions/sale_workflow.xml' |
434 | --- sale_exceptions/sale_workflow.xml 2011-03-07 12:19:42 +0000 |
435 | +++ sale_exceptions/sale_workflow.xml 1970-01-01 00:00:00 +0000 |
436 | @@ -1,9 +0,0 @@ |
437 | -<?xml version="1.0" encoding="utf-8"?> |
438 | -<openerp> |
439 | - <data> |
440 | - <record id="sale.trans_draft_router" model="workflow.transition"> |
441 | - <field name="signal">order_confirm</field> |
442 | - <field name="condition">test_exceptions()</field> |
443 | - </record> |
444 | - </data> |
445 | -</openerp> |
446 | |
447 | === removed directory 'sale_exceptions/security' |
448 | === removed file 'sale_exceptions/security/ir.model.access.csv' |
449 | --- sale_exceptions/security/ir.model.access.csv 2012-02-13 09:31:57 +0000 |
450 | +++ sale_exceptions/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
451 | @@ -1,3 +0,0 @@ |
452 | -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" |
453 | -"access_sale_exception","sale.exception","model_sale_exception","base.group_user",1,0,0,0 |
454 | -"access_sale_exception_manager","sale.exception","model_sale_exception","base.group_sale_manager",1,1,1,1 |
455 | |
456 | === removed directory 'sale_exceptions/settings' |
457 | === removed file 'sale_exceptions/settings/sale.exception.csv' |
458 | --- sale_exceptions/settings/sale.exception.csv 2012-05-19 11:13:51 +0000 |
459 | +++ sale_exceptions/settings/sale.exception.csv 1970-01-01 00:00:00 +0000 |
460 | @@ -1,5 +0,0 @@ |
461 | -"id","name","description","sequence","model","code","active" |
462 | -"excep_no_zip","No ZIP code on destination",,50,"sale.order","if not order.partner_shipping_id.zip: |
463 | - failed=True",False |
464 | -"excep_no_stock","Not Enough Virtual Stock",,50,"sale.order.line","if line.product_id and line.product_id.type == 'product' and line.product_id.virtual_available < line.product_uom_qty: |
465 | - failed=True",False |
466 | |
467 | === removed directory 'sale_exceptions/wizard' |
468 | === removed file 'sale_exceptions/wizard/__init__.py' |
469 | --- sale_exceptions/wizard/__init__.py 2012-02-24 09:31:32 +0000 |
470 | +++ sale_exceptions/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
471 | @@ -1,1 +0,0 @@ |
472 | -import sale_exception_confirm |
473 | |
474 | === removed file 'sale_exceptions/wizard/sale_exception_confirm.py' |
475 | --- sale_exceptions/wizard/sale_exception_confirm.py 2012-05-16 12:53:59 +0000 |
476 | +++ sale_exceptions/wizard/sale_exception_confirm.py 1970-01-01 00:00:00 +0000 |
477 | @@ -1,56 +0,0 @@ |
478 | -# -*- encoding: utf-8 -*- |
479 | -############################################################################## |
480 | -# |
481 | -# Copyright Camptocamp SA |
482 | -# @author: Guewen Baconnier |
483 | -# |
484 | -# This program is free software: you can redistribute it and/or modify |
485 | -# it under the terms of the GNU General Public License as published by |
486 | -# the Free Software Foundation, either version 3 of the License, or |
487 | -# (at your option) any later version. |
488 | -# |
489 | -# This program is distributed in the hope that it will be useful, |
490 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
491 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
492 | -# GNU General Public License for more details. |
493 | -# |
494 | -# You should have received a copy of the GNU General Public License |
495 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
496 | -# |
497 | -############################################################################## |
498 | - |
499 | -import netsvc |
500 | - |
501 | -from osv import osv, fields |
502 | - |
503 | - |
504 | -class SaleExceptionConfirm(osv.osv_memory): |
505 | - |
506 | - _name = 'sale.exception.confirm' |
507 | - |
508 | - _columns = { |
509 | - 'sale_id': fields.many2one('sale.order', 'Sale'), |
510 | - 'exception_ids': fields.many2many('sale.exception', string='Exceptions to resolve', readonly=True), |
511 | - 'ignore': fields.boolean('Ignore Exceptions'), |
512 | - } |
513 | - |
514 | - def default_get(self, cr, uid, fields, context=None): |
515 | - res = super(SaleExceptionConfirm, self).default_get(cr, uid, fields, context=context) |
516 | - order_obj = self.pool.get('sale.order') |
517 | - sale_id = context.get('active_id', False) |
518 | - if sale_id: |
519 | - sale = order_obj.browse(cr, uid, sale_id, context=context) |
520 | - exception_ids = [e.id for e in sale.exceptions_ids] |
521 | - res.update({'exception_ids': [(6, 0, exception_ids)]}) |
522 | - |
523 | - res.update({'sale_id': sale_id}) |
524 | - return res |
525 | - |
526 | - def action_confirm(self, cr, uid, ids, context=None): |
527 | - form = self.browse(cr, uid, ids[0], context=context) |
528 | - if form.ignore: |
529 | - self.pool.get('sale.order').write(cr, uid, form.sale_id.id, |
530 | - {'ignore_exceptions': True}, context=context) |
531 | - return {'type': 'ir.actions.act_window_close'} |
532 | - |
533 | -SaleExceptionConfirm() |
534 | |
535 | === removed file 'sale_exceptions/wizard/sale_exception_confirm_view.xml' |
536 | --- sale_exceptions/wizard/sale_exception_confirm_view.xml 2012-12-26 09:30:24 +0000 |
537 | +++ sale_exceptions/wizard/sale_exception_confirm_view.xml 1970-01-01 00:00:00 +0000 |
538 | @@ -1,44 +0,0 @@ |
539 | -<?xml version="1.0" encoding="utf-8"?> |
540 | -<openerp> |
541 | - <data> |
542 | - |
543 | - <record id="view_sale_exception_confirm" model="ir.ui.view"> |
544 | - <field name="name">Sale Exceptions</field> |
545 | - <field name="model">sale.exception.confirm</field> |
546 | - <field name="type">form</field> |
547 | - <field name="arch" type="xml"> |
548 | - <form string="Sale Exceptions On Sale Order" version="7.0"> |
549 | - <group> |
550 | - <field name="exception_ids" nolabel="1" colspan="4"> |
551 | - <form string="Sale Exception"> |
552 | - <field name="name" colspan="4"/> |
553 | - <field name="description" colspan="4"/> |
554 | - </form> |
555 | - <tree string="Sale Exceptions"> |
556 | - <field name="name"/> |
557 | - <field name="description"/> |
558 | - </tree> |
559 | - </field> |
560 | - <newline/> |
561 | - <field name="ignore" groups='base.group_sale_manager'/> |
562 | - </group> |
563 | - <footer> |
564 | - <button name="action_confirm" string="_Ok" |
565 | - colspan="1" type="object" icon="gtk-ok" /> |
566 | - </footer> |
567 | - </form> |
568 | - </field> |
569 | - </record> |
570 | - |
571 | - <record id="action_sale_exception_confirm" model="ir.actions.act_window"> |
572 | - <field name="name">Sale Exceptions</field> |
573 | - <field name="type">ir.actions.act_window</field> |
574 | - <field name="res_model">sale.exception.confirm</field> |
575 | - <field name="view_type">form</field> |
576 | - <field name="view_mode">form</field> |
577 | - <field name="view_id" ref="view_sale_exception_confirm"/> |
578 | - <field name="target">new</field> |
579 | - </record> |
580 | - |
581 | - </data> |
582 | -</openerp> |
As your reasoning on community list, I approve it blindly.
Regards.