openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #06891
[Merge] lp:~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7 into lp:account-invoicing
Alex Comba - Agile BG has proposed merging lp:~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7 into lp:account-invoicing.
Commit message:
[ADD] module invoice_line_no_picking_name
Requested reviews:
Account Core Editors (account-core-editors)
For more details, see:
https://code.launchpad.net/~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7/+merge/220289
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_picking_line.
This is possible by selecting the related option in the following menu:
Settings --> Configuration --> Warehouse --> Products
--
https://code.launchpad.net/~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7/+merge/220289
Your team Account Core Editors is requested to review the proposed merge of lp:~agilebg/account-invoicing/adding_invoice_line_no_picking_name_7 into lp:account-invoicing.
=== 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-20 15:15:24 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Alex Comba <alex.comba@xxxxxxxxxxx>
+# Copyright (C) 2014 Agile Business Group sagl
+# (<http://www.agilebg.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from . import res_config
+from . import stock
=== 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-20 15:15:24 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Alex Comba <alex.comba@xxxxxxxxxxx>
+# Copyright (C) 2014 Agile Business Group sagl
+# (<http://www.agilebg.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+ 'name': "Invoice line no picking name",
+ 'version': '0.1',
+ 'category': 'Generic Modules/Accounting',
+ 'description': """
+This module 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_picking_line.
+This is possible by selecting the related option in the following menu:
+
+Settings --> Configuration --> Warehouse --> Products
+ """,
+ 'author': 'Agile Business Group',
+ 'website': 'http://www.agilebg.com',
+ 'license': 'AGPL-3',
+ "depends": [
+ 'sale_stock',
+ ],
+ "data": [
+ 'security/stock_security.xml',
+ 'res_config_view.xml',
+ ],
+ 'test': [
+ 'test/invoice_line_no_picking_name.yml',
+ ],
+ "active": False,
+ "installable": True
+}
=== 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-20 15:15:24 +0000
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * invoice_line_no_picking_name
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-19 15:50+0000\n"
+"PO-Revision-Date: 2014-05-19 15:50+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: invoice_line_no_picking_name
+#: field:stock.config.settings,group_not_use_picking_name_per_picking_line:0
+msgid "Allow not using the picking name on the picking lines"
+msgstr ""
+
+#. module: invoice_line_no_picking_name
+#: model:res.groups,name:invoice_line_no_picking_name.group_not_use_picking_name_per_picking_line
+msgid "Not use picking name on picking lines"
+msgstr ""
+
+#. module: invoice_line_no_picking_name
+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_config_settings
+msgid "stock.config.settings"
+msgstr ""
+
+#. module: invoice_line_no_picking_name
+#: help:stock.config.settings,group_not_use_picking_name_per_picking_line:0
+msgid "Allows you to not use the picking name on the picking lines."
+msgstr ""
+
+#. module: invoice_line_no_picking_name
+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_picking
+msgid "Picking List"
+msgstr ""
+
=== 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-20 15:15:24 +0000
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * invoice_line_no_picking_name
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-19 15:51+0000\n"
+"PO-Revision-Date: 2014-05-19 15:51+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: invoice_line_no_picking_name
+#: field:stock.config.settings,group_not_use_picking_name_per_picking_line:0
+msgid "Allow not using the picking name on the picking lines"
+msgstr "Allow not using the picking name on the picking lines"
+
+#. module: invoice_line_no_picking_name
+#: model:res.groups,name:invoice_line_no_picking_name.group_not_use_picking_name_per_picking_line
+msgid "Not use picking name on picking lines"
+msgstr "Not use picking name on picking lines"
+
+#. module: invoice_line_no_picking_name
+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_config_settings
+msgid "stock.config.settings"
+msgstr "stock.config.settings"
+
+#. module: invoice_line_no_picking_name
+#: help:stock.config.settings,group_not_use_picking_name_per_picking_line:0
+msgid "Allows you to not use the picking name on the picking lines."
+msgstr "Allows you to not use the picking name on the picking lines."
+
+#. module: invoice_line_no_picking_name
+#: model:ir.model,name:invoice_line_no_picking_name.model_stock_picking
+msgid "Picking List"
+msgstr "Picking List"
+
=== 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-20 15:15:24 +0000
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Alex Comba <alex.comba@xxxxxxxxxxx>
+# Copyright (C) 2014 Agile Business Group sagl
+# (<http://www.agilebg.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import fields, osv
+
+
+class stock_config_settings(osv.TransientModel):
+ _inherit = 'stock.config.settings'
+
+ _columns = {
+ 'group_not_use_picking_name_per_picking_line': fields.boolean(
+ "Allow not using the picking name on the picking lines",
+ implied_group="invoice_line_no_picking_name."
+ "group_not_use_picking_name_per_picking_line",
+ help="Allows you to not use the picking name on the picking lines."
+ ),
+ }
=== 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-20 15:15:24 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="view_stock_config_settings" model="ir.ui.view">
+ <field name="name">stock settings</field>
+ <field name="model">stock.config.settings</field>
+ <field name="inherit_id" ref="stock.view_stock_config_settings"/>
+ <field name="arch" type="xml">
+ <xpath expr="//label[@for='group_uos']" position="after">
+ <div>
+ <field name="group_not_use_picking_name_per_picking_line" class="oe_inline"/>
+ <label for="group_not_use_picking_name_per_picking_line"/>
+ </div>
+ </xpath>
+ </field>
+ </record>
+
+ </data>
+</openerp>
\ No newline at end of file
=== added directory 'invoice_line_no_picking_name/security'
=== added file 'invoice_line_no_picking_name/security/stock_security.xml'
--- invoice_line_no_picking_name/security/stock_security.xml 1970-01-01 00:00:00 +0000
+++ invoice_line_no_picking_name/security/stock_security.xml 2014-05-20 15:15:24 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+
+ <data noupdate="0">
+
+ <record id="group_not_use_picking_name_per_picking_line" model="res.groups">
+ <field name="name">Not use picking name on picking lines</field>
+ <field name="category_id" ref="base.module_category_hidden"/>
+ </record>
+
+ </data>
+
+</openerp>
=== 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-20 15:15:24 +0000
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Alex Comba <alex.comba@xxxxxxxxxxx>
+# Copyright (C) 2014 Agile Business Group sagl
+# (<http://www.agilebg.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import orm
+
+
+class stock_picking(orm.Model):
+ _inherit = "stock.picking"
+
+ def _prepare_invoice_line(
+ self, cr, uid, group, picking, move_line,
+ invoice_id, invoice_vals, context=None
+ ):
+ res = super(stock_picking, self)._prepare_invoice_line(
+ cr, uid, group, picking, move_line,
+ invoice_id, invoice_vals, context=context
+ )
+ if move_line:
+ user = self.pool.get('res.users').browse(
+ cr, uid, uid, context=context)
+ user_groups = [g.id for g in user.groups_id]
+ ref = self.pool.get('ir.model.data').get_object_reference(
+ cr, uid, 'invoice_line_no_picking_name',
+ 'group_not_use_picking_name_per_picking_line'
+ )
+
+ if ref and len(ref) > 1 and ref[1]:
+ group_id = ref[1]
+ if group_id in user_groups:
+ res['name'] = move_line.name
+ return res
=== 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-20 15:15:24 +0000
@@ -0,0 +1,50 @@
+-
+ In order to test invoice_line_no_picking_name,
+ I assign group_use_product_description_per_picking_line group to the admin user.
+-
+ !record {model: res.users, id: base.user_root}:
+ groups_id:
+ - invoice_line_no_picking_name.group_not_use_picking_name_per_picking_line
+-
+ I create sale order having picking as order_policy.
+-
+ !record {model: sale.order, id: sale_order_test}:
+ partner_id: base.res_partner_2
+ order_policy: picking
+ order_line:
+ - product_id: product.product_product_7
+ product_uom_qty: 8
+-
+ I confirm sale order.
+-
+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_test}
+-
+ Now, I dispatch delivery order.
+-
+ !python {model: stock.partial.picking}: |
+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_test"))
+ for picking in order.picking_ids:
+ data = picking.force_assign()
+ if data == True:
+ partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [picking.id]})
+ self.do_partial(cr, uid, [partial_id])
+-
+ I create invoice from delivery order having group as True.
+-
+ !python {model: stock.invoice.onshipping}: |
+ sale = self.pool.get('sale.order')
+ sale_order = sale.browse(cr, uid, ref("sale_order_test"))
+ assert len(sale_order.picking_ids) == 1, "'There are more than one matching picking, while only one was expected."
+ picking_ids = [x.id for x in sale_order.picking_ids]
+ wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal'), 'group': True},
+ context={'active_ids': picking_ids, 'active_model': 'stock.picking'})
+ self.create_invoice(cr, uid, [wiz_id], {"active_ids": picking_ids, "active_id": picking_ids[0]})
+-
+ I check the invoice details after dispatched delivery.
+-
+ !python {model: sale.order}: |
+ order = self.browse(cr, uid, ref("sale_order_test"))
+ assert order.invoice_ids, "Invoice is not created."
+ assert len(order.invoice_ids) == 1, "'There are more than one matching invoice, while only one was expected."
+ assert len(order.invoice_ids[0].invoice_line) == 1, "'There are more than one matching invoice line, while only one was expected"
+ assert order.picking_ids[0].name not in order.invoice_ids[0].invoice_line[0].name, 'The invoice line description contains the picking name'
Follow ups