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
=== added directory 'invoice_line_no_picking_name'
=== added file 'invoice_line_no_picking_name/__init__.py'
--- invoice_line_no_picking_name/__init__.py 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/__init__.py 2014-05-23 08:09:09 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.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##############################################################################
22from . import res_config
23from . import stock
024
=== added file 'invoice_line_no_picking_name/__openerp__.py'
--- invoice_line_no_picking_name/__openerp__.py 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/__openerp__.py 2014-05-23 08:09:09 +0000
@@ -0,0 +1,48 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.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': "Invoice line no picking name",
24 'version': '0.1',
25 'category': 'Generic Modules/Accounting',
26 'description': """
27This module allows to not use the picking name on the invoice lines.
28To do so, the user has to belong to
29group_not_use_picking_name_per_invoice_line.
30This is possible by selecting the related option in the following menu:
31
32Settings --> Configuration --> Warehouse --> Products
33 """,
34 'author': 'Agile Business Group',
35 'website': 'http://www.agilebg.com',
36 'license': 'AGPL-3',
37 "depends": [
38 'sale_stock',
39 ],
40 "data": [
41 'security/invoice_security.xml',
42 'res_config_view.xml',
43 ],
44 'test': [
45 'test/invoice_line_no_picking_name.yml',
46 ],
47 "installable": True
48}
049
=== added directory 'invoice_line_no_picking_name/i18n'
=== added file 'invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot'
--- invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/i18n/invoice_line_no_picking_name.pot 2014-05-23 08:09:09 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * invoice_line_no_picking_name
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-05-20 15:27+0000\n"
10"PO-Revision-Date: 2014-05-20 15:27+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: invoice_line_no_picking_name
19#: field:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
20msgid "Allow not using the picking name on the invoice lines"
21msgstr ""
22
23#. module: invoice_line_no_picking_name
24#: model:res.groups,name:invoice_line_no_picking_name.group_not_use_picking_name_per_invoice_line
25msgid "Not use picking name on invoice lines"
26msgstr ""
27
28#. module: invoice_line_no_picking_name
29#: model:ir.model,name:invoice_line_no_picking_name.model_stock_config_settings
30msgid "stock.config.settings"
31msgstr ""
32
33#. module: invoice_line_no_picking_name
34#: help:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
35msgid "Allows you to not use the picking name on the invoice lines."
36msgstr ""
37
38#. module: invoice_line_no_picking_name
39#: model:ir.model,name:invoice_line_no_picking_name.model_stock_picking
40msgid "Picking List"
41msgstr ""
42
043
=== added file 'invoice_line_no_picking_name/i18n/it.po'
--- invoice_line_no_picking_name/i18n/it.po 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/i18n/it.po 2014-05-23 08:09:09 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * invoice_line_no_picking_name
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-05-20 15:28+0000\n"
10"PO-Revision-Date: 2014-05-20 17:35+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: invoice_line_no_picking_name
20#: field:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
21msgid "Allow not using the picking name on the invoice lines"
22msgstr "Permette di non usare il nome del picking sulle righe della fattura"
23
24#. module: invoice_line_no_picking_name
25#: model:res.groups,name:invoice_line_no_picking_name.group_not_use_picking_name_per_invoice_line
26msgid "Not use picking name on invoice lines"
27msgstr "Non usare il nome del picking sulle righe della fattura"
28
29#. module: invoice_line_no_picking_name
30#: model:ir.model,name:invoice_line_no_picking_name.model_stock_config_settings
31msgid "stock.config.settings"
32msgstr "stock.config.settings"
33
34#. module: invoice_line_no_picking_name
35#: help:stock.config.settings,group_not_use_picking_name_per_invoice_line:0
36msgid "Allows you to not use the picking name on the invoice lines."
37msgstr "Permette di non usare il nome del picking sulle righe della fattura."
38
39#. module: invoice_line_no_picking_name
40#: model:ir.model,name:invoice_line_no_picking_name.model_stock_picking
41msgid "Picking List"
42msgstr "Picking List"
043
=== added file 'invoice_line_no_picking_name/res_config.py'
--- invoice_line_no_picking_name/res_config.py 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/res_config.py 2014-05-23 08:09:09 +0000
@@ -0,0 +1,36 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.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
23from openerp.osv import fields, osv
24
25
26class stock_config_settings(osv.TransientModel):
27 _inherit = 'stock.config.settings'
28
29 _columns = {
30 'group_not_use_picking_name_per_invoice_line': fields.boolean(
31 "Allow not using the picking name on the invoice lines",
32 implied_group="invoice_line_no_picking_name."
33 "group_not_use_picking_name_per_invoice_line",
34 help="Allows you to not use the picking name on the invoice lines."
35 ),
36 }
037
=== added file 'invoice_line_no_picking_name/res_config_view.xml'
--- invoice_line_no_picking_name/res_config_view.xml 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/res_config_view.xml 2014-05-23 08:09:09 +0000
@@ -0,0 +1,20 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_stock_config_settings" model="ir.ui.view">
6 <field name="name">stock settings</field>
7 <field name="model">stock.config.settings</field>
8 <field name="inherit_id" ref="stock.view_stock_config_settings"/>
9 <field name="arch" type="xml">
10 <xpath expr="//label[@for='group_uos']" position="after">
11 <div>
12 <field name="group_not_use_picking_name_per_invoice_line" class="oe_inline"/>
13 <label for="group_not_use_picking_name_per_invoice_line"/>
14 </div>
15 </xpath>
16 </field>
17 </record>
18
19 </data>
20</openerp>
0\ No newline at end of file21\ No newline at end of file
122
=== added directory 'invoice_line_no_picking_name/security'
=== added file 'invoice_line_no_picking_name/security/invoice_security.xml'
--- invoice_line_no_picking_name/security/invoice_security.xml 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/security/invoice_security.xml 2014-05-23 08:09:09 +0000
@@ -0,0 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3
4 <data noupdate="0">
5
6 <record id="group_not_use_picking_name_per_invoice_line" model="res.groups">
7 <field name="name">Not use picking name on invoice lines</field>
8 <field name="category_id" ref="base.module_category_hidden"/>
9 </record>
10
11 </data>
12
13</openerp>
014
=== added file 'invoice_line_no_picking_name/stock.py'
--- invoice_line_no_picking_name/stock.py 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/stock.py 2014-05-23 08:09:09 +0000
@@ -0,0 +1,50 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.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
23from openerp.osv import orm
24
25
26class stock_picking(orm.Model):
27 _inherit = "stock.picking"
28
29 def _prepare_invoice_line(
30 self, cr, uid, group, picking, move_line,
31 invoice_id, invoice_vals, context=None
32 ):
33 res = super(stock_picking, self)._prepare_invoice_line(
34 cr, uid, group, picking, move_line,
35 invoice_id, invoice_vals, context=context
36 )
37 if move_line:
38 user = self.pool.get('res.users').browse(
39 cr, uid, uid, context=context)
40 user_groups = [g.id for g in user.groups_id]
41 ref = self.pool.get('ir.model.data').get_object_reference(
42 cr, uid, 'invoice_line_no_picking_name',
43 'group_not_use_picking_name_per_invoice_line'
44 )
45
46 if ref and len(ref) > 1 and ref[1]:
47 group_id = ref[1]
48 if group_id in user_groups:
49 res['name'] = move_line.name
50 return res
051
=== added directory 'invoice_line_no_picking_name/test'
=== added file 'invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml'
--- invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/test/invoice_line_no_picking_name.yml 2014-05-23 08:09:09 +0000
@@ -0,0 +1,50 @@
1-
2 In order to test invoice_line_no_picking_name,
3 I assign group_not_use_picking_name_per_invoice_line group to the admin user.
4-
5 !record {model: res.users, id: base.user_root}:
6 groups_id:
7 - invoice_line_no_picking_name.group_not_use_picking_name_per_invoice_line
8-
9 I create sale order having picking as order_policy.
10-
11 !record {model: sale.order, id: sale_order_test}:
12 partner_id: base.res_partner_2
13 order_policy: picking
14 order_line:
15 - product_id: product.product_product_7
16 product_uom_qty: 8
17-
18 I confirm sale order.
19-
20 !workflow {model: sale.order, action: order_confirm, ref: sale_order_test}
21-
22 Now, I dispatch delivery order.
23-
24 !python {model: stock.partial.picking}: |
25 order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_test"))
26 for picking in order.picking_ids:
27 data = picking.force_assign()
28 if data == True:
29 partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [picking.id]})
30 self.do_partial(cr, uid, [partial_id])
31-
32 I create invoice from delivery order having group as True.
33-
34 !python {model: stock.invoice.onshipping}: |
35 sale = self.pool.get('sale.order')
36 sale_order = sale.browse(cr, uid, ref("sale_order_test"))
37 assert len(sale_order.picking_ids) == 1, "'There are more than one matching picking, while only one was expected."
38 picking_ids = [x.id for x in sale_order.picking_ids]
39 wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal'), 'group': True},
40 context={'active_ids': picking_ids, 'active_model': 'stock.picking'})
41 self.create_invoice(cr, uid, [wiz_id], {"active_ids": picking_ids, "active_id": picking_ids[0]})
42-
43 I check the invoice details after dispatched delivery.
44-
45 !python {model: sale.order}: |
46 order = self.browse(cr, uid, ref("sale_order_test"))
47 assert order.invoice_ids, "Invoice is not created."
48 assert len(order.invoice_ids) == 1, "'There are more than one matching invoice, while only one was expected."
49 assert len(order.invoice_ids[0].invoice_line) == 1, "'There are more than one matching invoice line, while only one was expected"
50 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