openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #00301
lp:~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing into lp:stock-logistic-flows
Sébastien BEAU - http://www.akretion.com has proposed merging lp:~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing into lp:stock-logistic-flows.
Requested reviews:
Stock and Logistic Core Editors (stock-logistic-core-editors)
For more details, see:
https://code.launchpad.net/~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing/+merge/189182
Hi
As customer can do everything imaginable to corrupt the data.
I think it's really important to set back the state "2binvoice" when an invoice (generated for the picking) is deleted.
This module just add this small feature for now.
I didn't have a lot of idea for the name of this module (11:30pm here) so if you have a better one, propose it ;)
Thanks
This merge depend on this one before https://code.launchpad.net/~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-backport-stock_picking_invoice_link/+merge/189179
--
https://code.launchpad.net/~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing/+merge/189182
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing into lp:stock-logistic-flows.
=== added directory 'stock_picking_better_invoicing'
=== added file 'stock_picking_better_invoicing/__init__.py'
--- stock_picking_better_invoicing/__init__.py 1970-01-01 00:00:00 +0000
+++ stock_picking_better_invoicing/__init__.py 2013-10-03 21:43:34 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Module for OpenERP
+# Copyright (C) 2013 Akretion (http://www.akretion.com).
+# @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+# 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/>.
+#
+###############################################################################
+
+import invoice
+
=== added file 'stock_picking_better_invoicing/__openerp__.py'
--- stock_picking_better_invoicing/__openerp__.py 1970-01-01 00:00:00 +0000
+++ stock_picking_better_invoicing/__openerp__.py 2013-10-03 21:43:34 +0000
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Module for OpenERP
+# Copyright (C) 2013 Akretion (http://www.akretion.com).
+# @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+# 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': 'stock_picking_better_invoicing',
+ 'version': '0.0.1',
+ 'author': 'Akretion',
+ 'website': 'www.akretion.com',
+ 'license': 'AGPL-3',
+ 'category': 'Generic Modules',
+ 'description': """
+ Improve the invoicing flow from the picking.
+ List of improvement:
+ - if an draft invoice is deleted than the picking linked go back to the state to_be_invoice
+
+ Idea of improvement
+ - select the correct journal if the picking come from a sale order
+ (and so a shop, in e-commerce case shop are linked to a sale journal)
+ - raise a warning or forbid it when a user invoice a picking not sent
+ your idea and contribution are welcome ;)
+ """,
+ 'depends': [
+ 'stock_picking_invoice_link',
+ ],
+ 'update_xml': [
+ ],
+ 'installable': True,
+ 'application': True,
+}
+
+
+
=== added file 'stock_picking_better_invoicing/invoice.py'
--- stock_picking_better_invoicing/invoice.py 1970-01-01 00:00:00 +0000
+++ stock_picking_better_invoicing/invoice.py 2013-10-03 21:43:34 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+# Module for OpenERP
+# Copyright (C) 2013 Akretion (http://www.akretion.com).
+# @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+# 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, orm
+
+
+class account_invoice(orm.Model):
+ _inherit = 'account.invoice'
+
+ _columns = {
+ 'invoiced_picking_ids': fields.one2many('stock.picking', 'invoice_id',
+ 'Picking Invoiced',
+ help=('The current Invoice have been generated '
+ 'from the list of this picking')
+ ),
+ }
+
+ def unlink(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ for invoice in self.browse(cr, uid, ids, context=context):
+ for picking in invoice.invoiced_picking_ids:
+ picking.write({'invoice_state': '2binvoiced'})
+ return super(account_invoice, self).unlink(cr, uid, ids, context=context)
=== added directory 'stock_picking_invoice_link'
=== added file 'stock_picking_invoice_link/AUTHORS.txt'
--- stock_picking_invoice_link/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ stock_picking_invoice_link/AUTHORS.txt 2013-10-03 21:43:34 +0000
@@ -0,0 +1,1 @@
+Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxx>
=== added file 'stock_picking_invoice_link/__init__.py'
--- stock_picking_invoice_link/__init__.py 1970-01-01 00:00:00 +0000
+++ stock_picking_invoice_link/__init__.py 2013-10-03 21:43:34 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 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/>.
+#
+##############################################################################
+
+import stock
=== added file 'stock_picking_invoice_link/__openerp__.py'
--- stock_picking_invoice_link/__openerp__.py 1970-01-01 00:00:00 +0000
+++ stock_picking_invoice_link/__openerp__.py 2013-10-03 21:43:34 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 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': "Picking Invoice Link",
+ 'version': '0.1',
+ 'category': 'Warehouse Management',
+ 'description': """
+This module adds a link between pickings and generated invoices. So that user can easly reach the invoice related to the picking.
+
+""",
+ 'author': 'Agile Business Group',
+ 'website': 'http://www.agilebg.com',
+ 'license': 'AGPL-3',
+ "depends": ['stock'],
+ "init_xml": [],
+ "update_xml": [
+ "stock_view.xml",
+ ],
+ "demo_xml": [],
+ 'tests': [
+ ],
+ "installable": True,
+ "auto_install": False,
+ "application": False,
+}
=== added file 'stock_picking_invoice_link/stock.py'
--- stock_picking_invoice_link/stock.py 1970-01-01 00:00:00 +0000
+++ stock_picking_invoice_link/stock.py 2013-10-03 21:43:34 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 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, orm
+from openerp.tools.translate import _
+
+class stock_picking(orm.Model):
+ _inherit = "stock.picking"
+
+ _columns = {
+ 'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
+ }
+
+ def _invoice_hook(self, cr, uid, picking, invoice_id):
+ res = super(stock_picking,self)._invoice_hook(cr, uid, picking, invoice_id)
+ picking.write({'invoice_id': invoice_id})
+ return res
=== added file 'stock_picking_invoice_link/stock_view.xml'
--- stock_picking_invoice_link/stock_view.xml 1970-01-01 00:00:00 +0000
+++ stock_picking_invoice_link/stock_view.xml 2013-10-03 21:43:34 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+ <record id="view_picking_out_form" model="ir.ui.view">
+ <field name="name">stock.picking.out.form</field>
+ <field name="model">stock.picking</field>
+ <field name="inherit_id" ref="stock.view_picking_out_form"></field>
+ <field name="arch" type="xml">
+ <field name="invoice_state" position="after">
+ <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
+ </field>
+ </field>
+ </record>
+ <record id="view_picking_in_form" model="ir.ui.view">
+ <field name="name">stock.picking.in.form</field>
+ <field name="model">stock.picking</field>
+ <field name="inherit_id" ref="stock.view_picking_in_form"></field>
+ <field name="arch" type="xml">
+ <field name="invoice_state" position="after">
+ <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
+ </field>
+ </field>
+ </record>
+</data>
+</openerp>
=== added directory 'stock_picking_invoice_link/test'
Follow ups