Merge lp:~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7 into lp:~account-core-editors/account-invoicing/7.0

Proposed by Alex Comba - Agile BG
Status: Needs review
Proposed branch: lp:~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 373 lines (+324/-0)
9 files modified
invoice_line_no_picking_name/__init__.py (+23/-0)
invoice_line_no_picking_name/__openerp__.py (+48/-0)
invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot (+42/-0)
invoice_line_no_picking_name/i18n/it.po (+42/-0)
invoice_line_no_picking_name/res_config.py (+36/-0)
invoice_line_no_picking_name/res_config_view.xml (+20/-0)
invoice_line_no_picking_name/security/invoice_security.xml (+13/-0)
invoice_line_no_picking_name/stock.py (+50/-0)
invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml (+50/-0)
To merge this branch: bzr merge lp:~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7
Reviewer Review Type Date Requested Status
Lorenzo Battistini (community) Disapprove
Pedro Manuel Baeza Needs Resubmitting
Review via email: mp+220289@code.launchpad.net

Commit message

[ADD] module invoice_line_no_picking_name

Description of the change

I added the module 'invoice_line_no_picking_name' which allows to not use the picking name on the invoice lines.
To do so, the user has to belong to group_not_use_picking_name_per_invoice_line.
This is possible by selecting the related option in the following menu:

Settings --> Configuration --> Warehouse --> Products

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
60. By Alex Comba - Agile BG

[FIX] Added missing security/invoice_security.xml

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

This project is now hosted on https://github.com/OCA/account-invoicing. 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
Revision history for this message
Lorenzo Battistini (elbati) wrote :
review: Disapprove

Unmerged revisions

60. By Alex Comba - Agile BG

[FIX] Added missing security/invoice_security.xml

59. By Alex Comba - Agile BG

[FIX] test/invoice_line_no_picking_name.yml

58. By Alex Comba - Agile BG

[FIX] test/invoice_line_no_picking_name.yml

57. By Alex Comba - Agile BG

[REM] key 'active' since not validated using https://github.com/nbessi/openerp-conventions

56. By Alex Comba - Agile BG

[IMP] Updated the translation files

55. By Alex Comba - Agile BG

[IMP] Refactoring: replaced picking by invoice

54. By Alex Comba - Agile BG

[FIX] header of __init__.py

53. By Alex Comba - Agile BG

[FIX] override of _prepare_invoice_line

52. By Alex Comba - Agile BG

[IMP] test/invoice_line_no_picking_name.yml

51. By Alex Comba - Agile BG

[ADD] adding test/invoice_line_no_picking_name.yml

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'invoice_line_no_picking_name'
2=== added file 'invoice_line_no_picking_name/__init__.py'
3--- invoice_line_no_picking_name/__init__.py 1970-01-01 00:00:00 +0000
4+++ invoice_line_no_picking_name/__init__.py 2014-05-23 08:09:09 +0000
5@@ -0,0 +1,23 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author: Alex Comba <alex.comba@agilebg.com>
10+# Copyright (C) 2014 Agile Business Group sagl
11+# (<http://www.agilebg.com>)
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as published
15+# by the Free Software Foundation, either version 3 of the License, or
16+# (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+from . import res_config
28+from . import stock
29
30=== added file 'invoice_line_no_picking_name/__openerp__.py'
31--- invoice_line_no_picking_name/__openerp__.py 1970-01-01 00:00:00 +0000
32+++ invoice_line_no_picking_name/__openerp__.py 2014-05-23 08:09:09 +0000
33@@ -0,0 +1,48 @@
34+# -*- coding: utf-8 -*-
35+##############################################################################
36+#
37+# Author: Alex Comba <alex.comba@agilebg.com>
38+# Copyright (C) 2014 Agile Business Group sagl
39+# (<http://www.agilebg.com>)
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as published
43+# by the Free Software Foundation, either version 3 of the License, or
44+# (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+{
56+ 'name': "Invoice line no picking name",
57+ 'version': '0.1',
58+ 'category': 'Generic Modules/Accounting',
59+ 'description': """
60+This module allows to not use the picking name on the invoice lines.
61+To do so, the user has to belong to
62+group_not_use_picking_name_per_invoice_line.
63+This is possible by selecting the related option in the following menu:
64+
65+Settings --> Configuration --> Warehouse --> Products
66+ """,
67+ 'author': 'Agile Business Group',
68+ 'website': 'http://www.agilebg.com',
69+ 'license': 'AGPL-3',
70+ "depends": [
71+ 'sale_stock',
72+ ],
73+ "data": [
74+ 'security/invoice_security.xml',
75+ 'res_config_view.xml',
76+ ],
77+ 'test': [
78+ 'test/invoice_line_no_picking_name.yml',
79+ ],
80+ "installable": True
81+}
82
83=== added directory 'invoice_line_no_picking_name/i18n'
84=== added file 'invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot'
85--- invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot 1970-01-01 00:00:00 +0000
86+++ invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot 2014-05-23 08:09:09 +0000
87@@ -0,0 +1,42 @@
88+# Translation of OpenERP Server.
89+# This file contains the translation of the following modules:
90+# * invoice_line_no_picking_name
91+#
92+msgid ""
93+msgstr ""
94+"Project-Id-Version: OpenERP Server 7.0\n"
95+"Report-Msgid-Bugs-To: \n"
96+"POT-Creation-Date: 2014-05-20 15:27+0000\n"
97+"PO-Revision-Date: 2014-05-20 15:27+0000\n"
98+"Last-Translator: <>\n"
99+"Language-Team: \n"
100+"MIME-Version: 1.0\n"
101+"Content-Type: text/plain; charset=UTF-8\n"
102+"Content-Transfer-Encoding: \n"
103+"Plural-Forms: \n"
104+
105+#. module: invoice_line_no_picking_name
106+#: field:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
107+msgid "Allow not using the picking name on the invoice lines"
108+msgstr ""
109+
110+#. module: invoice_line_no_picking_name
111+#: model:res.groups,name:invoice_line_no_picking_name.group_not_use_picking_name_per_invoice_line
112+msgid "Not use picking name on invoice lines"
113+msgstr ""
114+
115+#. module: invoice_line_no_picking_name
116+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_config_settings
117+msgid "stock.config.settings"
118+msgstr ""
119+
120+#. module: invoice_line_no_picking_name
121+#: help:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
122+msgid "Allows you to not use the picking name on the invoice lines."
123+msgstr ""
124+
125+#. module: invoice_line_no_picking_name
126+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_picking
127+msgid "Picking List"
128+msgstr ""
129+
130
131=== added file 'invoice_line_no_picking_name/i18n/it.po'
132--- invoice_line_no_picking_name/i18n/it.po 1970-01-01 00:00:00 +0000
133+++ invoice_line_no_picking_name/i18n/it.po 2014-05-23 08:09:09 +0000
134@@ -0,0 +1,42 @@
135+# Translation of OpenERP Server.
136+# This file contains the translation of the following modules:
137+# * invoice_line_no_picking_name
138+#
139+msgid ""
140+msgstr ""
141+"Project-Id-Version: OpenERP Server 7.0\n"
142+"Report-Msgid-Bugs-To: \n"
143+"POT-Creation-Date: 2014-05-20 15:28+0000\n"
144+"PO-Revision-Date: 2014-05-20 17:35+0100\n"
145+"Last-Translator: Alex Comba <alex.comba@agilebg.com>\n"
146+"Language-Team: \n"
147+"MIME-Version: 1.0\n"
148+"Content-Type: text/plain; charset=UTF-8\n"
149+"Content-Transfer-Encoding: 8bit\n"
150+"Plural-Forms: \n"
151+"X-Generator: Poedit 1.5.4\n"
152+
153+#. module: invoice_line_no_picking_name
154+#: field:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
155+msgid "Allow not using the picking name on the invoice lines"
156+msgstr "Permette di non usare il nome del picking sulle righe della fattura"
157+
158+#. module: invoice_line_no_picking_name
159+#: model:res.groups,name:invoice_line_no_picking_name.group_not_use_picking_name_per_invoice_line
160+msgid "Not use picking name on invoice lines"
161+msgstr "Non usare il nome del picking sulle righe della fattura"
162+
163+#. module: invoice_line_no_picking_name
164+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_config_settings
165+msgid "stock.config.settings"
166+msgstr "stock.config.settings"
167+
168+#. module: invoice_line_no_picking_name
169+#: help:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
170+msgid "Allows you to not use the picking name on the invoice lines."
171+msgstr "Permette di non usare il nome del picking sulle righe della fattura."
172+
173+#. module: invoice_line_no_picking_name
174+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_picking
175+msgid "Picking List"
176+msgstr "Picking List"
177
178=== added file 'invoice_line_no_picking_name/res_config.py'
179--- invoice_line_no_picking_name/res_config.py 1970-01-01 00:00:00 +0000
180+++ invoice_line_no_picking_name/res_config.py 2014-05-23 08:09:09 +0000
181@@ -0,0 +1,36 @@
182+# -*- coding: utf-8 -*-
183+##############################################################################
184+#
185+# Author: Alex Comba <alex.comba@agilebg.com>
186+# Copyright (C) 2014 Agile Business Group sagl
187+# (<http://www.agilebg.com>)
188+#
189+# This program is free software: you can redistribute it and/or modify
190+# it under the terms of the GNU Affero General Public License as published
191+# by the Free Software Foundation, either version 3 of the License, or
192+# (at your option) any later version.
193+#
194+# This program is distributed in the hope that it will be useful,
195+# but WITHOUT ANY WARRANTY; without even the implied warranty of
196+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
197+# GNU Affero General Public License for more details.
198+#
199+# You should have received a copy of the GNU Affero General Public License
200+# along with this program. If not, see <http://www.gnu.org/licenses/>.
201+#
202+##############################################################################
203+
204+from openerp.osv import fields, osv
205+
206+
207+class stock_config_settings(osv.TransientModel):
208+ _inherit = 'stock.config.settings'
209+
210+ _columns = {
211+ 'group_not_use_picking_name_per_invoice_line': fields.boolean(
212+ "Allow not using the picking name on the invoice lines",
213+ implied_group="invoice_line_no_picking_name."
214+ "group_not_use_picking_name_per_invoice_line",
215+ help="Allows you to not use the picking name on the invoice lines."
216+ ),
217+ }
218
219=== added file 'invoice_line_no_picking_name/res_config_view.xml'
220--- invoice_line_no_picking_name/res_config_view.xml 1970-01-01 00:00:00 +0000
221+++ invoice_line_no_picking_name/res_config_view.xml 2014-05-23 08:09:09 +0000
222@@ -0,0 +1,20 @@
223+<?xml version="1.0" encoding="utf-8"?>
224+<openerp>
225+ <data>
226+
227+ <record id="view_stock_config_settings" model="ir.ui.view">
228+ <field name="name">stock settings</field>
229+ <field name="model">stock.config.settings</field>
230+ <field name="inherit_id" ref="stock.view_stock_config_settings"/>
231+ <field name="arch" type="xml">
232+ <xpath expr="//label[@for='group_uos']" position="after">
233+ <div>
234+ <field name="group_not_use_picking_name_per_invoice_line" class="oe_inline"/>
235+ <label for="group_not_use_picking_name_per_invoice_line"/>
236+ </div>
237+ </xpath>
238+ </field>
239+ </record>
240+
241+ </data>
242+</openerp>
243\ No newline at end of file
244
245=== added directory 'invoice_line_no_picking_name/security'
246=== added file 'invoice_line_no_picking_name/security/invoice_security.xml'
247--- invoice_line_no_picking_name/security/invoice_security.xml 1970-01-01 00:00:00 +0000
248+++ invoice_line_no_picking_name/security/invoice_security.xml 2014-05-23 08:09:09 +0000
249@@ -0,0 +1,13 @@
250+<?xml version="1.0" encoding="utf-8"?>
251+<openerp>
252+
253+ <data noupdate="0">
254+
255+ <record id="group_not_use_picking_name_per_invoice_line" model="res.groups">
256+ <field name="name">Not use picking name on invoice lines</field>
257+ <field name="category_id" ref="base.module_category_hidden"/>
258+ </record>
259+
260+ </data>
261+
262+</openerp>
263
264=== added file 'invoice_line_no_picking_name/stock.py'
265--- invoice_line_no_picking_name/stock.py 1970-01-01 00:00:00 +0000
266+++ invoice_line_no_picking_name/stock.py 2014-05-23 08:09:09 +0000
267@@ -0,0 +1,50 @@
268+# -*- coding: utf-8 -*-
269+##############################################################################
270+#
271+# Author: Alex Comba <alex.comba@agilebg.com>
272+# Copyright (C) 2014 Agile Business Group sagl
273+# (<http://www.agilebg.com>)
274+#
275+# This program is free software: you can redistribute it and/or modify
276+# it under the terms of the GNU Affero General Public License as published
277+# by the Free Software Foundation, either version 3 of the License, or
278+# (at your option) any later version.
279+#
280+# This program is distributed in the hope that it will be useful,
281+# but WITHOUT ANY WARRANTY; without even the implied warranty of
282+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
283+# GNU Affero General Public License for more details.
284+#
285+# You should have received a copy of the GNU Affero General Public License
286+# along with this program. If not, see <http://www.gnu.org/licenses/>.
287+#
288+##############################################################################
289+
290+from openerp.osv import orm
291+
292+
293+class stock_picking(orm.Model):
294+ _inherit = "stock.picking"
295+
296+ def _prepare_invoice_line(
297+ self, cr, uid, group, picking, move_line,
298+ invoice_id, invoice_vals, context=None
299+ ):
300+ res = super(stock_picking, self)._prepare_invoice_line(
301+ cr, uid, group, picking, move_line,
302+ invoice_id, invoice_vals, context=context
303+ )
304+ if move_line:
305+ user = self.pool.get('res.users').browse(
306+ cr, uid, uid, context=context)
307+ user_groups = [g.id for g in user.groups_id]
308+ ref = self.pool.get('ir.model.data').get_object_reference(
309+ cr, uid, 'invoice_line_no_picking_name',
310+ 'group_not_use_picking_name_per_invoice_line'
311+ )
312+
313+ if ref and len(ref) > 1 and ref[1]:
314+ group_id = ref[1]
315+ if group_id in user_groups:
316+ res['name'] = move_line.name
317+ return res
318
319=== added directory 'invoice_line_no_picking_name/test'
320=== added file 'invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml'
321--- invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml 1970-01-01 00:00:00 +0000
322+++ invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml 2014-05-23 08:09:09 +0000
323@@ -0,0 +1,50 @@
324+-
325+ In order to test invoice_line_no_picking_name,
326+ I assign group_not_use_picking_name_per_invoice_line group to the admin user.
327+-
328+ !record {model: res.users, id: base.user_root}:
329+ groups_id:
330+ - invoice_line_no_picking_name.group_not_use_picking_name_per_invoice_line
331+-
332+ I create sale order having picking as order_policy.
333+-
334+ !record {model: sale.order, id: sale_order_test}:
335+ partner_id: base.res_partner_2
336+ order_policy: picking
337+ order_line:
338+ - product_id: product.product_product_7
339+ product_uom_qty: 8
340+-
341+ I confirm sale order.
342+-
343+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_test}
344+-
345+ Now, I dispatch delivery order.
346+-
347+ !python {model: stock.partial.picking}: |
348+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_test"))
349+ for picking in order.picking_ids:
350+ data = picking.force_assign()
351+ if data == True:
352+ partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [picking.id]})
353+ self.do_partial(cr, uid, [partial_id])
354+-
355+ I create invoice from delivery order having group as True.
356+-
357+ !python {model: stock.invoice.onshipping}: |
358+ sale = self.pool.get('sale.order')
359+ sale_order = sale.browse(cr, uid, ref("sale_order_test"))
360+ assert len(sale_order.picking_ids) == 1, "'There are more than one matching picking, while only one was expected."
361+ picking_ids = [x.id for x in sale_order.picking_ids]
362+ wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal'), 'group': True},
363+ context={'active_ids': picking_ids, 'active_model': 'stock.picking'})
364+ self.create_invoice(cr, uid, [wiz_id], {"active_ids": picking_ids, "active_id": picking_ids[0]})
365+-
366+ I check the invoice details after dispatched delivery.
367+-
368+ !python {model: sale.order}: |
369+ order = self.browse(cr, uid, ref("sale_order_test"))
370+ assert order.invoice_ids, "Invoice is not created."
371+ assert len(order.invoice_ids) == 1, "'There are more than one matching invoice, while only one was expected."
372+ assert len(order.invoice_ids[0].invoice_line) == 1, "'There are more than one matching invoice line, while only one was expected"
373+ assert order.picking_ids[0].name not in order.invoice_ids[0].invoice_line[0].name, 'The invoice line description contains the picking name'

Subscribers

People subscribed via source and target branches