Merge lp:~agilebg/carriers-deliveries/adding_delivery_optional_invoice_line_7 into lp:~stock-logistic-core-editors/carriers-deliveries/7.0

Proposed by Alex Comba - Agile BG
Status: Needs review
Proposed branch: lp:~agilebg/carriers-deliveries/adding_delivery_optional_invoice_line_7
Merge into: lp:~stock-logistic-core-editors/carriers-deliveries/7.0
Diff against target: 281 lines (+243/-0)
7 files modified
delivery_optional_invoice_line/__init__.py (+21/-0)
delivery_optional_invoice_line/__openerp__.py (+44/-0)
delivery_optional_invoice_line/delivery.py (+47/-0)
delivery_optional_invoice_line/delivery_view.xml (+17/-0)
delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot (+32/-0)
delivery_optional_invoice_line/i18n/it.po (+32/-0)
delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml (+50/-0)
To merge this branch: bzr merge lp:~agilebg/carriers-deliveries/adding_delivery_optional_invoice_line_7
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review Approve
Sébastien BEAU - http://www.akretion.com code review, no test Approve
Lorenzo Battistini (community) Approve
Review via email: mp+213867@code.launchpad.net

Commit message

[ADD] module delivery_optional_invoice_line

Description of the change

I added the module named 'delivery_optional_invoice_line'.

It allows to remove the default shipping line from the invoices created from picking. To do so, the user shall go to the deliver carrier form and select the option 'Do not create line on invoice'.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Thanks to openerp-conventions
https://github.com/nbessi/openerp-conventions
I see
delivery_optional_invoice_line/__openerp__.py:43:5: O600 Warning unknown Manifest key ('active')

Apart from this, LGTM

review: Approve
47. By Alex Comba - Agile BG

[REM] key 'active' from the manifest file

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Thanks Lorenzo,

now https://github.com/nbessi/openerp-conventions doesn't show anymore the O600 Warning.

Cheers.

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Thanks for this module.
Having an additionnal delivery cost is a pain, your module make it optional it's ok for me.
LGTM

review: Approve (code review, no test)
Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Thanks Sébastien for your approval.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

This project is now hosted on https://github.com/OCA/carriers-deliveries. Please move your proposal there if you still want to merge it once fixed. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Hi Yannick,

does the migration still needed even if the MP has 3 approves?

I remain awaiting your confirmation before to proceed it. Thank you in advance.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Sorry for having a bit rushed the migration of this branch. One way or the other we must replicate this MP as a PR on github, now. Can you do this and putting this MP as reference, the PR will be merged fast as it was already approved.

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Ok, no problem!

I will migrate it to github asap. Thank you.

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Hi Yannick,

I migrated it to https://github.com/OCA/carrier-delivery/pull/4

Cheers.

Unmerged revisions

47. By Alex Comba - Agile BG

[REM] key 'active' from the manifest file

46. By Alex Comba - Agile BG

[IMP] _prepare_shipping_invoice_line of delivery.py

45. By Alex Comba - Agile BG

[FIX] Module decsription

44. By Alex Comba - Agile BG

[IMP] test/delivery_optional_invoice_line.yml

43. By Alex Comba - Agile BG

[IMP] Module description

42. By Alex Comba - Agile BG

[IMP] Added description and changed the category

41. By Alex Comba - Agile BG

[ADD] test/delivery_optional_invoice_line.yml

40. By Alex Comba - Agile BG

[ADD] module delivery_optional_invoice_line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'delivery_optional_invoice_line'
2=== added file 'delivery_optional_invoice_line/__init__.py'
3--- delivery_optional_invoice_line/__init__.py 1970-01-01 00:00:00 +0000
4+++ delivery_optional_invoice_line/__init__.py 2014-04-07 10:40:18 +0000
5@@ -0,0 +1,21 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Copyright (C) 2014 Agile Business Group sagl
10+# (<http://www.agilebg.com>)
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 published
14+# by the Free Software Foundation, either version 3 of the License, or
15+# (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+from . import delivery
27
28=== added file 'delivery_optional_invoice_line/__openerp__.py'
29--- delivery_optional_invoice_line/__openerp__.py 1970-01-01 00:00:00 +0000
30+++ delivery_optional_invoice_line/__openerp__.py 2014-04-07 10:40:18 +0000
31@@ -0,0 +1,44 @@
32+# -*- coding: utf-8 -*-
33+##############################################################################
34+#
35+# Copyright (C) 2014 Agile Business Group sagl
36+# (<http://www.agilebg.com>)
37+# @author Alex Comba <alex.comba@agilebg.com>
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU Affero General Public License as published
41+# by the Free Software Foundation, either version 3 of the License, or
42+# (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU Affero General Public License for more details.
48+#
49+# You should have received a copy of the GNU Affero General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+##############################################################################
53+{
54+ 'name': "Delivery Optional Invoice Line",
55+ 'version': '0.1',
56+ 'category': 'Sales Management',
57+ 'description': """
58+This module allows to remove the default shipping line from the invoices
59+created from picking. To do so, the user shall go to the deliver carrier form
60+and select the option 'Do not create line on invoice'.
61+ """,
62+ 'author': 'Agile Business Group',
63+ 'website': 'http://www.agilebg.com',
64+ 'license': 'AGPL-3',
65+ 'depends': [
66+ 'delivery',
67+ ],
68+ 'data': [
69+ 'delivery_view.xml',
70+ ],
71+ 'test': [
72+ 'test/delivery_optional_invoice_line.yml',
73+ ],
74+ 'installable': True
75+}
76
77=== added file 'delivery_optional_invoice_line/delivery.py'
78--- delivery_optional_invoice_line/delivery.py 1970-01-01 00:00:00 +0000
79+++ delivery_optional_invoice_line/delivery.py 2014-04-07 10:40:18 +0000
80@@ -0,0 +1,47 @@
81+# -*- coding: utf-8 -*-
82+##############################################################################
83+#
84+# Copyright (C) 2014 Agile Business Group sagl
85+# (<http://www.agilebg.com>)
86+#
87+# This program is free software: you can redistribute it and/or modify
88+# it under the terms of the GNU Affero General Public License as published
89+# by the Free Software Foundation, either version 3 of the License, or
90+# (at your option) any later version.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU Affero General Public License for more details.
96+#
97+# You should have received a copy of the GNU Affero General Public License
98+# along with this program. If not, see <http://www.gnu.org/licenses/>.
99+#
100+##############################################################################
101+
102+from openerp.osv import orm, fields
103+
104+
105+class delivery_carrier(orm.Model):
106+ _inherit = 'delivery.carrier'
107+
108+ _columns = {
109+ 'do_not_create_invoice_line': fields.boolean(
110+ 'Do not create line on invoice'),
111+ }
112+
113+
114+class stock_picking(orm.Model):
115+ _inherit = "stock.picking"
116+
117+ def _prepare_shipping_invoice_line(
118+ self, cr, uid, picking, invoice, context=None
119+ ):
120+ res = super(stock_picking, self)._prepare_shipping_invoice_line(
121+ cr, uid, picking, invoice, context=context)
122+ if (
123+ picking.carrier_id
124+ and picking.carrier_id.do_not_create_invoice_line
125+ ):
126+ res = None
127+ return res
128
129=== added file 'delivery_optional_invoice_line/delivery_view.xml'
130--- delivery_optional_invoice_line/delivery_view.xml 1970-01-01 00:00:00 +0000
131+++ delivery_optional_invoice_line/delivery_view.xml 2014-04-07 10:40:18 +0000
132@@ -0,0 +1,17 @@
133+<?xml version="1.0" encoding="utf-8"?>
134+<openerp>
135+ <data>
136+
137+ <record id="view_delivery_carrier_form" model="ir.ui.view">
138+ <field name="name">delivery.carrier.form</field>
139+ <field name="model">delivery.carrier</field>
140+ <field name="inherit_id" ref="delivery.view_delivery_carrier_form"/>
141+ <field name="arch" type="xml">
142+ <xpath expr="/form[@string='Carrier']/group/group/field[@name='active']" position="after">
143+ <field name="do_not_create_invoice_line"/>
144+ </xpath>
145+ </field>
146+ </record>
147+
148+ </data>
149+</openerp>
150\ No newline at end of file
151
152=== added directory 'delivery_optional_invoice_line/i18n'
153=== added file 'delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot'
154--- delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot 1970-01-01 00:00:00 +0000
155+++ delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot 2014-04-07 10:40:18 +0000
156@@ -0,0 +1,32 @@
157+# Translation of OpenERP Server.
158+# This file contains the translation of the following modules:
159+# * delivery_optional_invoice_line
160+#
161+msgid ""
162+msgstr ""
163+"Project-Id-Version: OpenERP Server 7.0\n"
164+"Report-Msgid-Bugs-To: \n"
165+"POT-Creation-Date: 2014-03-31 14:00+0000\n"
166+"PO-Revision-Date: 2014-03-31 14:00+0000\n"
167+"Last-Translator: <>\n"
168+"Language-Team: \n"
169+"MIME-Version: 1.0\n"
170+"Content-Type: text/plain; charset=UTF-8\n"
171+"Content-Transfer-Encoding: \n"
172+"Plural-Forms: \n"
173+
174+#. module: delivery_optional_invoice_line
175+#: model:ir.model,name:delivery_optional_invoice_line.model_delivery_carrier
176+msgid "Carrier"
177+msgstr ""
178+
179+#. module: delivery_optional_invoice_line
180+#: model:ir.model,name:delivery_optional_invoice_line.model_stock_picking
181+msgid "Picking List"
182+msgstr ""
183+
184+#. module: delivery_optional_invoice_line
185+#: field:delivery.carrier,do_not_create_invoice_line:0
186+msgid "Do not create invoice line"
187+msgstr ""
188+
189
190=== added file 'delivery_optional_invoice_line/i18n/it.po'
191--- delivery_optional_invoice_line/i18n/it.po 1970-01-01 00:00:00 +0000
192+++ delivery_optional_invoice_line/i18n/it.po 2014-04-07 10:40:18 +0000
193@@ -0,0 +1,32 @@
194+# Translation of OpenERP Server.
195+# This file contains the translation of the following modules:
196+# * delivery_optional_invoice_line
197+#
198+msgid ""
199+msgstr ""
200+"Project-Id-Version: OpenERP Server 7.0\n"
201+"Report-Msgid-Bugs-To: \n"
202+"POT-Creation-Date: 2014-03-31 14:01+0000\n"
203+"PO-Revision-Date: 2014-03-31 16:07+0100\n"
204+"Last-Translator: Alex Comba <alex.comba@agilebg.com>\n"
205+"Language-Team: \n"
206+"MIME-Version: 1.0\n"
207+"Content-Type: text/plain; charset=UTF-8\n"
208+"Content-Transfer-Encoding: 8bit\n"
209+"Plural-Forms: \n"
210+"X-Generator: Poedit 1.5.4\n"
211+
212+#. module: delivery_optional_invoice_line
213+#: model:ir.model,name:delivery_optional_invoice_line.model_delivery_carrier
214+msgid "Carrier"
215+msgstr "Trasportatore"
216+
217+#. module: delivery_optional_invoice_line
218+#: model:ir.model,name:delivery_optional_invoice_line.model_stock_picking
219+msgid "Picking List"
220+msgstr "Picking List"
221+
222+#. module: delivery_optional_invoice_line
223+#: field:delivery.carrier,do_not_create_invoice_line:0
224+msgid "Do not create invoice line"
225+msgstr "Non creare riga di fattura"
226
227=== added directory 'delivery_optional_invoice_line/test'
228=== added file 'delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml'
229--- delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml 1970-01-01 00:00:00 +0000
230+++ delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml 2014-04-07 10:40:18 +0000
231@@ -0,0 +1,50 @@
232+
233+-
234+ In order to test process of the Delivery Optional Invoice Line,
235+-
236+ I set the do_not_create_invoice_line field as True on the free_delivery_carrier.
237+-
238+ !record {model: delivery.carrier, id: delivery.free_delivery_carrier}:
239+ do_not_create_invoice_line: True
240+-
241+ I create sale order having picking as order_policy and free_delivery_carrier as carrier_id.
242+-
243+ !record {model: sale.order, id: sale_order_test}:
244+ partner_id: base.res_partner_2
245+ order_policy: picking
246+ carrier_id: delivery.free_delivery_carrier
247+ order_line:
248+ - product_id: product.product_product_7
249+ product_uom_qty: 8
250+-
251+ I confirm sale order.
252+-
253+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_test}
254+-
255+ Now, I dispatch delivery order.
256+-
257+ !python {model: stock.partial.picking}: |
258+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_test"))
259+ for pick in order.picking_ids:
260+ data = pick.force_assign()
261+ if data == True:
262+ partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
263+ self.do_partial(cr, uid, [partial_id])
264+-
265+ I create invoice from delivery order.
266+-
267+ !python {model: stock.invoice.onshipping}: |
268+ sale = self.pool.get('sale.order')
269+ sale_order = sale.browse(cr, uid, ref("sale_order_test"))
270+ ship_ids = [x.id for x in sale_order.picking_ids]
271+ wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
272+ {'active_ids': ship_ids, 'active_model': 'stock.picking'})
273+ self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
274+-
275+ I check the invoice details after dispatched delivery.
276+-
277+ !python {model: sale.order}: |
278+ order = self.browse(cr, uid, ref("sale_order_test"))
279+ assert order.invoice_ids, "Invoice is not created."
280+ for invoice in order.invoice_ids:
281+ assert len(invoice.invoice_line) == len(order.order_line), "Lines of Invoice and Sale Order are not correspond"

Subscribers

People subscribed via source and target branches