Merge lp:~akretion-team/sale-wkfl/7.0-addmulticpny-sale-except-module-dbl into lp:~sale-core-editors/sale-wkfl/7.0

Proposed by David BEAL (ak)
Status: Needs review
Proposed branch: lp:~akretion-team/sale-wkfl/7.0-addmulticpny-sale-except-module-dbl
Merge into: lp:~sale-core-editors/sale-wkfl/7.0
Diff against target: 448 lines (+185/-122)
5 files modified
sale_exceptions/__openerp__.py (+30/-8)
sale_exceptions/i18n/sale_exceptions.pot (+127/-106)
sale_exceptions/sale.py (+11/-6)
sale_exceptions/sale_view.xml (+3/-2)
sale_exceptions/security/rule.xml (+14/-0)
To merge this branch: bzr merge lp:~akretion-team/sale-wkfl/7.0-addmulticpny-sale-except-module-dbl
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Benoit Guillot - http://www.akretion.com (community) code review, no test Approve
Review via email: mp+223750@code.launchpad.net

Description of the change

add multicompany support to sale_exceptions module

To post a comment you must log in.
Revision history for this message
Benoit Guillot - http://www.akretion.com (benoit-guillot-z) wrote :

LGTM

review: Approve (code review, no test)
49. By David BEAL (ak)

[FIX] module version

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Please update pot file.

The rest LGTM.

Regards.

review: Needs Fixing (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Another thing: please comply with 80 cols PEP8.

Regards.

review: Needs Fixing (code review)
50. By David BEAL (ak)

[FIX] PEP8

51. By David BEAL (ak)

[FIX] add pot

Revision history for this message
David BEAL (ak) (davidbeal) wrote :

@pedro

fix is done

thanks for approve if ok

Regards

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for the changes.

Regards.

review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/sale-workflow. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

51. By David BEAL (ak)

[FIX] add pot

50. By David BEAL (ak)

[FIX] PEP8

49. By David BEAL (ak)

[FIX] module version

48. By David BEAL (ak)

[IMP] add multicompany support to sale_exceptions module

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_exceptions/__openerp__.py'
2--- sale_exceptions/__openerp__.py 2013-11-15 12:19:07 +0000
3+++ sale_exceptions/__openerp__.py 2014-06-19 21:07:47 +0000
4@@ -21,26 +21,48 @@
5 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6 #
7 ##############################################################################
8+
9 {'name': 'Sale Exceptions',
10- 'version': '0.1',
11+ 'version': '1.0',
12 'category': 'Generic Modules/Sale',
13 'description': """
14+
15+DESCRIPTION
16+============
17 This module allows you attach several customizable exceptions to your sale order
18 in a way that you can filter orders by exceptions type and fix them.
19
20 This is especially useful in an order importation scenario such as with
21 the base_sale_multi_channels module, because it's likely a few orders have errors
22 when you import them (like product not found in OpenERP, wrong line format etc...)
23+
24+
25+AUTHORS
26+========
27+
28+Akretion
29+----------
30+ - Raphaël Valyi
31+ - Renato Lima
32+ - Sébastien BEAU <sebastien.beau@akretion.com>
33+
34+Camptocamp
35+-----------
36+ - Guewen Baconnier
37+
38 """,
39 'author': 'Akretion',
40 'website': 'http://www.akretion.com',
41 'depends': ['sale'],
42- 'init_xml': ['settings/sale.exception.csv'],
43- 'update_xml': ['sale_workflow.xml',
44- 'sale_view.xml',
45- 'sale_exceptions_data.xml',
46- 'wizard/sale_exception_confirm_view.xml',
47- 'security/ir.model.access.csv'],
48- 'demo_xml': [],
49+ 'data': [
50+ 'settings/sale.exception.csv',
51+ 'sale_workflow.xml',
52+ 'sale_view.xml',
53+ 'sale_exceptions_data.xml',
54+ 'wizard/sale_exception_confirm_view.xml',
55+ 'security/ir.model.access.csv',
56+ 'security/rule.xml',
57+ ],
58+ 'demo': [],
59 'installable': True,
60 }
61
62=== modified file 'sale_exceptions/i18n/sale_exceptions.pot'
63--- sale_exceptions/i18n/sale_exceptions.pot 2013-11-15 12:55:29 +0000
64+++ sale_exceptions/i18n/sale_exceptions.pot 2014-06-19 21:07:47 +0000
65@@ -6,8 +6,8 @@
66 msgstr ""
67 "Project-Id-Version: OpenERP Server 7.0\n"
68 "Report-Msgid-Bugs-To: \n"
69-"POT-Creation-Date: 2013-05-02 06:57+0000\n"
70-"PO-Revision-Date: 2013-05-02 06:57+0000\n"
71+"POT-Creation-Date: 2014-06-19 21:05+0000\n"
72+"PO-Revision-Date: 2014-06-19 21:05+0000\n"
73 "Last-Translator: <>\n"
74 "Language-Team: \n"
75 "MIME-Version: 1.0\n"
76@@ -16,13 +16,13 @@
77 "Plural-Forms: \n"
78
79 #. module: sale_exceptions
80-#: model:ir.model,name:sale_exceptions.model_sale_exception_confirm
81-msgid "sale.exception.confirm"
82+#: field:sale.exception,active:0
83+msgid "Active"
84 msgstr ""
85
86 #. module: sale_exceptions
87-#: selection:sale.exception,model:0
88-msgid "Sale Order Line"
89+#: view:sale.exception:0
90+msgid "Affected Sales Orders"
91 msgstr ""
92
93 #. module: sale_exceptions
94@@ -31,8 +31,21 @@
95 msgstr ""
96
97 #. module: sale_exceptions
98-#: model:sale.exception,name:sale_exceptions.excep_no_stock
99-msgid "Not Enough Virtual Stock"
100+#: view:sale.order:0
101+msgid "Blocked in draft"
102+msgstr ""
103+
104+#. module: sale_exceptions
105+#: code:addons/sale_exceptions/sale.py:123
106+#: model:ir.actions.act_window,name:sale_exceptions.action_sale_exception_confirm
107+#: view:sale.exception.confirm:0
108+#, python-format
109+msgid "Blocked in draft due to exceptions"
110+msgstr ""
111+
112+#. module: sale_exceptions
113+#: field:sale.exception,company_id:0
114+msgid "Company"
115 msgstr ""
116
117 #. module: sale_exceptions
118@@ -41,34 +54,79 @@
119 msgstr ""
120
121 #. module: sale_exceptions
122+#: code:addons/sale_exceptions/sale.py:211
123+#, python-format
124+msgid "Error"
125+msgstr ""
126+
127+#. module: sale_exceptions
128+#: code:addons/sale_exceptions/sale.py:212
129+#, python-format
130+msgid "Error when evaluating the sale exception rule:\n"
131+" %s \n"
132+"(%s)"
133+msgstr ""
134+
135+#. module: sale_exceptions
136+#: view:sale.order:0
137+msgid "Error:"
138+msgstr ""
139+
140+#. module: sale_exceptions
141+#: view:sale.order:0
142+msgid "Exception"
143+msgstr ""
144+
145+#. module: sale_exceptions
146+#: field:sale.exception,name:0
147+msgid "Exception Name"
148+msgstr ""
149+
150+#. module: sale_exceptions
151+#: model:ir.actions.act_window,name:sale_exceptions.action_sale_test_tree
152+#: model:ir.ui.menu,name:sale_exceptions.menu_sale_test
153+msgid "Exception Rules"
154+msgstr ""
155+
156+#. module: sale_exceptions
157+#: field:sale.order,exceptions_ids:0
158+msgid "Exceptions"
159+msgstr ""
160+
161+#. module: sale_exceptions
162+#: field:sale.exception.confirm,exception_ids:0
163+msgid "Exceptions to resolve"
164+msgstr ""
165+
166+#. module: sale_exceptions
167 #: help:sale.exception,sequence:0
168 msgid "Gives the sequence order when applying the test"
169 msgstr ""
170
171 #. module: sale_exceptions
172-#: view:sale.exception.confirm:0
173-msgid "Sale Exceptions On Sale Order"
174-msgstr ""
175-
176-#. module: sale_exceptions
177-#: field:sale.exception.confirm,exception_ids:0
178-msgid "Exceptions to resolve"
179-msgstr ""
180-
181-#. module: sale_exceptions
182-#: view:sale.exception.confirm:0
183-msgid "_Ok"
184-msgstr ""
185-
186-#. module: sale_exceptions
187-#: view:sale.exception:0
188-#: view:sale.exception.confirm:0
189-msgid "Sale Exception"
190-msgstr ""
191-
192-#. module: sale_exceptions
193-#: view:sale.order:0
194-msgid "TO FIX"
195+#: field:sale.exception.confirm,ignore:0
196+#: field:sale.order,ignore_exceptions:0
197+msgid "Ignore Exceptions"
198+msgstr ""
199+
200+#. module: sale_exceptions
201+#: field:sale.order,main_exception_id:0
202+msgid "Main Exception"
203+msgstr ""
204+
205+#. module: sale_exceptions
206+#: model:sale.exception,name:sale_exceptions.excep_no_zip
207+msgid "No ZIP code on destination"
208+msgstr ""
209+
210+#. module: sale_exceptions
211+#: model:sale.exception,name:sale_exceptions.excep_no_stock
212+msgid "Not Enough Virtual Stock"
213+msgstr ""
214+
215+#. module: sale_exceptions
216+#: field:sale.exception,code:0
217+msgid "Python Code"
218 msgstr ""
219
220 #. module: sale_exceptions
221@@ -77,55 +135,47 @@
222 msgstr ""
223
224 #. module: sale_exceptions
225-#: view:sale.order:0
226-msgid "Exception"
227-msgstr ""
228-
229-#. module: sale_exceptions
230-#: view:sale.order:0
231-msgid "Error:"
232-msgstr ""
233-
234-#. module: sale_exceptions
235-#: selection:sale.exception,model:0
236-msgid "Sale Order"
237-msgstr ""
238-
239-#. module: sale_exceptions
240 #: field:sale.exception.confirm,sale_id:0
241 msgid "Sale"
242 msgstr ""
243
244 #. module: sale_exceptions
245-#: field:sale.exception,active:0
246-msgid "Active"
247-msgstr ""
248-
249-#. module: sale_exceptions
250-#: field:sale.exception,name:0
251-msgid "Exception Name"
252-msgstr ""
253-
254-#. module: sale_exceptions
255-#: field:sale.order,exceptions_ids:0
256-msgid "Exceptions"
257-msgstr ""
258-
259-#. module: sale_exceptions
260-#: model:ir.actions.act_window,name:sale_exceptions.action_sale_exception_confirm
261+#: view:sale.exception:0
262+msgid "Sale Exception"
263+msgstr ""
264+
265+#. module: sale_exceptions
266+#: view:sale.exception:0
267+msgid "Sale Exception Setup"
268+msgstr ""
269+
270+#. module: sale_exceptions
271+#: code:_description:0
272 #: model:ir.model,name:sale_exceptions.model_sale_exception
273 #: view:sale.exception.confirm:0
274+#, python-format
275 msgid "Sale Exceptions"
276 msgstr ""
277
278 #. module: sale_exceptions
279-#: model:ir.actions.act_window,name:sale_exceptions.action_sale_test_tree
280-#: model:ir.ui.menu,name:sale_exceptions.menu_sale_test
281-msgid "Exception Rules"
282-msgstr ""
283-
284-#. module: sale_exceptions
285+#: selection:sale.exception,model:0
286+msgid "Sale Order"
287+msgstr ""
288+
289+#. module: sale_exceptions
290+#: selection:sale.exception,model:0
291+msgid "Sale Order Line"
292+msgstr ""
293+
294+#. module: sale_exceptions
295+#: field:sale.exception,sale_order_ids:0
296+msgid "Sale Orders"
297+msgstr ""
298+
299+#. module: sale_exceptions
300+#: code:_description:0
301 #: model:ir.model,name:sale_exceptions.model_sale_order
302+#, python-format
303 msgid "Sales Order"
304 msgstr ""
305
306@@ -135,43 +185,14 @@
307 msgstr ""
308
309 #. module: sale_exceptions
310-#: field:sale.exception,code:0
311-msgid "Python Code"
312-msgstr ""
313-
314-#. module: sale_exceptions
315-#: view:sale.order:0
316-msgid "Sales"
317-msgstr ""
318-
319-#. module: sale_exceptions
320-#: model:sale.exception,name:sale_exceptions.excep_no_zip
321-msgid "No ZIP code on destination"
322-msgstr ""
323-
324-#. module: sale_exceptions
325-#: view:sale.exception:0
326-msgid "Sale Exception Setup"
327-msgstr ""
328-
329-#. module: sale_exceptions
330-#: view:sale.exception:0
331-msgid "Affected Sales Orders"
332-msgstr ""
333-
334-#. module: sale_exceptions
335-#: field:sale.exception,sale_order_ids:0
336-msgid "Sale Orders"
337-msgstr ""
338-
339-#. module: sale_exceptions
340-#: field:sale.exception.confirm,ignore:0
341-#: field:sale.order,ignore_exceptions:0
342-msgid "Ignore Exceptions"
343-msgstr ""
344-
345-#. module: sale_exceptions
346-#: field:sale.order,main_exception_id:0
347-msgid "Main Exception"
348+#: view:sale.exception.confirm:0
349+msgid "_Close"
350+msgstr ""
351+
352+#. module: sale_exceptions
353+#: code:_description:0
354+#: model:ir.model,name:sale_exceptions.model_sale_exception_confirm
355+#, python-format
356+msgid "sale.exception.confirm"
357 msgstr ""
358
359
360=== modified file 'sale_exceptions/sale.py'
361--- sale_exceptions/sale.py 2013-11-15 12:55:29 +0000
362+++ sale_exceptions/sale.py 2014-06-19 21:07:47 +0000
363@@ -28,12 +28,13 @@
364 from openerp.tools.translate import _
365
366
367-class sale_exception(orm.Model):
368+class SaleException(orm.Model):
369 _name = "sale.exception"
370 _description = "Sale Exceptions"
371 _order = "active desc, sequence asc"
372 _columns = {
373 'name': fields.char('Exception Name', required=True, translate=True),
374+ 'company_id': fields.many2one('res.company', 'Company'),
375 'description': fields.text('Description', translate=True),
376 'sequence': fields.integer(
377 'Sequence',
378@@ -64,11 +65,14 @@
379 # - cr: database cursor
380 # - uid: current user id
381 # - context: current context
382-"""
383+""",
384+ 'company_id': lambda s, cr, uid, c:
385+ s.pool['res.company']._company_default_get(
386+ cr, uid, 'sale.exception', context=c),
387 }
388
389
390-class sale_order(orm.Model):
391+class SaleOrder(orm.Model):
392 _inherit = "sale.order"
393
394 _order = 'main_exception_id asc, date_order desc, name desc'
395@@ -133,8 +137,8 @@
396 if exception_ids:
397 return self._popup_exceptions(cr, uid, ids[0], context=context)
398 else:
399- return super(sale_order, self).action_button_confirm(cr, uid, ids,
400- context=context)
401+ return super(SaleOrder, self).action_button_confirm(cr, uid, ids,
402+ context=context)
403
404 def test_exceptions(self, cr, uid, ids, context=None):
405 """
406@@ -233,4 +237,5 @@
407 default.update({
408 'ignore_exceptions': False,
409 })
410- return super(sale_order, self).copy(cr, uid, id, default=default, context=context)
411+ return super(SaleOrder, self).copy(
412+ cr, uid, id, default=default, context=context)
413
414=== modified file 'sale_exceptions/sale_view.xml'
415--- sale_exceptions/sale_view.xml 2013-11-15 12:55:29 +0000
416+++ sale_exceptions/sale_view.xml 2014-06-19 21:07:47 +0000
417@@ -28,9 +28,10 @@
418 <group col="4" colspan="4" groups="base.group_sale_manager">
419 <field name="active"/>
420 <field name="sequence"/>
421- <group colspan="4" col="2" groups="base.group_system">
422+ <group colspan="4" col="4" groups="base.group_system">
423 <field name="model"/>
424- <field name="code"/>
425+ <field name="company_id" groups="base.group_multi_company"/>
426+ <field name="code" colspan="4"/>
427 </group>
428 </group>
429 <group colspan="4" col="2">
430
431=== added file 'sale_exceptions/security/rule.xml'
432--- sale_exceptions/security/rule.xml 1970-01-01 00:00:00 +0000
433+++ sale_exceptions/security/rule.xml 2014-06-19 21:07:47 +0000
434@@ -0,0 +1,14 @@
435+<?xml version="1.0" encoding="utf-8"?>
436+<openerp>
437+ <data noupdate="1">
438+
439+ <record id="sale_exception_comp_rule" model="ir.rule">
440+ <field name="name">Sale exception multi-company</field>
441+ <field name="model_id" ref="model_sale_exception"/>
442+ <field name="global" eval="True"/>
443+ <field name="domain_force">
444+['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
445+ </record>
446+
447+ </data>
448+</openerp>

Subscribers

People subscribed via source and target branches