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
=== added directory 'delivery_optional_invoice_line'
=== added file 'delivery_optional_invoice_line/__init__.py'
--- delivery_optional_invoice_line/__init__.py 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/__init__.py 2014-04-07 10:40:18 +0000
@@ -0,0 +1,21 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2014 Agile Business Group sagl
5# (<http://www.agilebg.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from . import delivery
022
=== added file 'delivery_optional_invoice_line/__openerp__.py'
--- delivery_optional_invoice_line/__openerp__.py 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/__openerp__.py 2014-04-07 10:40:18 +0000
@@ -0,0 +1,44 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2014 Agile Business Group sagl
5# (<http://www.agilebg.com>)
6# @author Alex Comba <alex.comba@agilebg.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 'name': "Delivery Optional Invoice Line",
24 'version': '0.1',
25 'category': 'Sales Management',
26 'description': """
27This module allows to remove the default shipping line from the invoices
28created from picking. To do so, the user shall go to the deliver carrier form
29and select the option 'Do not create line on invoice'.
30 """,
31 'author': 'Agile Business Group',
32 'website': 'http://www.agilebg.com',
33 'license': 'AGPL-3',
34 'depends': [
35 'delivery',
36 ],
37 'data': [
38 'delivery_view.xml',
39 ],
40 'test': [
41 'test/delivery_optional_invoice_line.yml',
42 ],
43 'installable': True
44}
045
=== added file 'delivery_optional_invoice_line/delivery.py'
--- delivery_optional_invoice_line/delivery.py 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/delivery.py 2014-04-07 10:40:18 +0000
@@ -0,0 +1,47 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2014 Agile Business Group sagl
5# (<http://www.agilebg.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import orm, fields
23
24
25class delivery_carrier(orm.Model):
26 _inherit = 'delivery.carrier'
27
28 _columns = {
29 'do_not_create_invoice_line': fields.boolean(
30 'Do not create line on invoice'),
31 }
32
33
34class stock_picking(orm.Model):
35 _inherit = "stock.picking"
36
37 def _prepare_shipping_invoice_line(
38 self, cr, uid, picking, invoice, context=None
39 ):
40 res = super(stock_picking, self)._prepare_shipping_invoice_line(
41 cr, uid, picking, invoice, context=context)
42 if (
43 picking.carrier_id
44 and picking.carrier_id.do_not_create_invoice_line
45 ):
46 res = None
47 return res
048
=== added file 'delivery_optional_invoice_line/delivery_view.xml'
--- delivery_optional_invoice_line/delivery_view.xml 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/delivery_view.xml 2014-04-07 10:40:18 +0000
@@ -0,0 +1,17 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_delivery_carrier_form" model="ir.ui.view">
6 <field name="name">delivery.carrier.form</field>
7 <field name="model">delivery.carrier</field>
8 <field name="inherit_id" ref="delivery.view_delivery_carrier_form"/>
9 <field name="arch" type="xml">
10 <xpath expr="/form[@string='Carrier']/group/group/field[@name='active']" position="after">
11 <field name="do_not_create_invoice_line"/>
12 </xpath>
13 </field>
14 </record>
15
16 </data>
17</openerp>
0\ No newline at end of file18\ No newline at end of file
119
=== added directory 'delivery_optional_invoice_line/i18n'
=== added file 'delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot'
--- delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/i18n/delivery_optional_invoice_line.pot 2014-04-07 10:40:18 +0000
@@ -0,0 +1,32 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * delivery_optional_invoice_line
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-03-31 14:00+0000\n"
10"PO-Revision-Date: 2014-03-31 14:00+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: delivery_optional_invoice_line
19#: model:ir.model,name:delivery_optional_invoice_line.model_delivery_carrier
20msgid "Carrier"
21msgstr ""
22
23#. module: delivery_optional_invoice_line
24#: model:ir.model,name:delivery_optional_invoice_line.model_stock_picking
25msgid "Picking List"
26msgstr ""
27
28#. module: delivery_optional_invoice_line
29#: field:delivery.carrier,do_not_create_invoice_line:0
30msgid "Do not create invoice line"
31msgstr ""
32
033
=== added file 'delivery_optional_invoice_line/i18n/it.po'
--- delivery_optional_invoice_line/i18n/it.po 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/i18n/it.po 2014-04-07 10:40:18 +0000
@@ -0,0 +1,32 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * delivery_optional_invoice_line
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-03-31 14:01+0000\n"
10"PO-Revision-Date: 2014-03-31 16:07+0100\n"
11"Last-Translator: Alex Comba <alex.comba@agilebg.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: delivery_optional_invoice_line
20#: model:ir.model,name:delivery_optional_invoice_line.model_delivery_carrier
21msgid "Carrier"
22msgstr "Trasportatore"
23
24#. module: delivery_optional_invoice_line
25#: model:ir.model,name:delivery_optional_invoice_line.model_stock_picking
26msgid "Picking List"
27msgstr "Picking List"
28
29#. module: delivery_optional_invoice_line
30#: field:delivery.carrier,do_not_create_invoice_line:0
31msgid "Do not create invoice line"
32msgstr "Non creare riga di fattura"
033
=== added directory 'delivery_optional_invoice_line/test'
=== added file 'delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml'
--- delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml 1970-01-01 00:00:00 +0000
+++ delivery_optional_invoice_line/test/delivery_optional_invoice_line.yml 2014-04-07 10:40:18 +0000
@@ -0,0 +1,50 @@
1
2-
3 In order to test process of the Delivery Optional Invoice Line,
4-
5 I set the do_not_create_invoice_line field as True on the free_delivery_carrier.
6-
7 !record {model: delivery.carrier, id: delivery.free_delivery_carrier}:
8 do_not_create_invoice_line: True
9-
10 I create sale order having picking as order_policy and free_delivery_carrier as carrier_id.
11-
12 !record {model: sale.order, id: sale_order_test}:
13 partner_id: base.res_partner_2
14 order_policy: picking
15 carrier_id: delivery.free_delivery_carrier
16 order_line:
17 - product_id: product.product_product_7
18 product_uom_qty: 8
19-
20 I confirm sale order.
21-
22 !workflow {model: sale.order, action: order_confirm, ref: sale_order_test}
23-
24 Now, I dispatch delivery order.
25-
26 !python {model: stock.partial.picking}: |
27 order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_test"))
28 for pick in order.picking_ids:
29 data = pick.force_assign()
30 if data == True:
31 partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
32 self.do_partial(cr, uid, [partial_id])
33-
34 I create invoice from delivery order.
35-
36 !python {model: stock.invoice.onshipping}: |
37 sale = self.pool.get('sale.order')
38 sale_order = sale.browse(cr, uid, ref("sale_order_test"))
39 ship_ids = [x.id for x in sale_order.picking_ids]
40 wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
41 {'active_ids': ship_ids, 'active_model': 'stock.picking'})
42 self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
43-
44 I check the invoice details after dispatched delivery.
45-
46 !python {model: sale.order}: |
47 order = self.browse(cr, uid, ref("sale_order_test"))
48 assert order.invoice_ids, "Invoice is not created."
49 for invoice in order.invoice_ids:
50 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