Merge lp:~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing into lp:stock-logistic-flows/6.1

Proposed by Sébastien BEAU - http://www.akretion.com
Status: Work in progress
Proposed branch: lp:~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing
Merge into: lp:stock-logistic-flows/6.1
Diff against target: 285 lines (+242/-0)
8 files modified
stock_picking_better_invoicing/__init__.py (+24/-0)
stock_picking_better_invoicing/__openerp__.py (+51/-0)
stock_picking_better_invoicing/invoice.py (+43/-0)
stock_picking_invoice_link/AUTHORS.txt (+1/-0)
stock_picking_invoice_link/__init__.py (+21/-0)
stock_picking_invoice_link/__openerp__.py (+43/-0)
stock_picking_invoice_link/stock.py (+34/-0)
stock_picking_invoice_link/stock_view.xml (+25/-0)
To merge this branch: bzr merge lp:~sebastien.beau/stock-logistic-flows/stock-logistic-flows-61-stock_picking_better_invoicing
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp Needs Resubmitting
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Needs Fixing
Review via email: mp+189182@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Hello Sébastien,

Few changes :

l21: from . import ...
l140: Move AUTHORS content in the module description.
l166: from . import ...

You need to add the pot files for both modules.

review: Needs Fixing (code review)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

The source code management for this project has been moved to https://github.com/OCA/stock-logistics-workflow

Could you resubmit this MP on the new site?

review: Needs Resubmitting

Unmerged revisions

30. By Sébastien BEAU - http://www.akretion.com

[ADD] add module stock_picking_better_invoicing to imporve the invoicing flow from picking, for now the module only set back the picking to "2binvoiced" if the invoice is deleted

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'stock_picking_better_invoicing'
2=== added file 'stock_picking_better_invoicing/__init__.py'
3--- stock_picking_better_invoicing/__init__.py 1970-01-01 00:00:00 +0000
4+++ stock_picking_better_invoicing/__init__.py 2013-10-03 21:43:34 +0000
5@@ -0,0 +1,24 @@
6+# -*- coding: utf-8 -*-
7+###############################################################################
8+#
9+# Module for OpenERP
10+# Copyright (C) 2013 Akretion (http://www.akretion.com).
11+# @author Sébastien BEAU <sebastien.beau@akretion.com>
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+###############################################################################
27+
28+import invoice
29+
30
31=== added file 'stock_picking_better_invoicing/__openerp__.py'
32--- stock_picking_better_invoicing/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ stock_picking_better_invoicing/__openerp__.py 2013-10-03 21:43:34 +0000
34@@ -0,0 +1,51 @@
35+# -*- coding: utf-8 -*-
36+###############################################################################
37+#
38+# Module for OpenERP
39+# Copyright (C) 2013 Akretion (http://www.akretion.com).
40+# @author Sébastien BEAU <sebastien.beau@akretion.com>
41+#
42+# This program is free software: you can redistribute it and/or modify
43+# it under the terms of the GNU Affero General Public License as
44+# published by the Free Software Foundation, either version 3 of the
45+# License, or (at your option) any later version.
46+#
47+# This program is distributed in the hope that it will be useful,
48+# but WITHOUT ANY WARRANTY; without even the implied warranty of
49+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+# GNU Affero General Public License for more details.
51+#
52+# You should have received a copy of the GNU Affero General Public License
53+# along with this program. If not, see <http://www.gnu.org/licenses/>.
54+#
55+###############################################################################
56+
57+
58+{'name': 'stock_picking_better_invoicing',
59+ 'version': '0.0.1',
60+ 'author': 'Akretion',
61+ 'website': 'www.akretion.com',
62+ 'license': 'AGPL-3',
63+ 'category': 'Generic Modules',
64+ 'description': """
65+ Improve the invoicing flow from the picking.
66+ List of improvement:
67+ - if an draft invoice is deleted than the picking linked go back to the state to_be_invoice
68+
69+ Idea of improvement
70+ - select the correct journal if the picking come from a sale order
71+ (and so a shop, in e-commerce case shop are linked to a sale journal)
72+ - raise a warning or forbid it when a user invoice a picking not sent
73+ your idea and contribution are welcome ;)
74+ """,
75+ 'depends': [
76+ 'stock_picking_invoice_link',
77+ ],
78+ 'update_xml': [
79+ ],
80+ 'installable': True,
81+ 'application': True,
82+}
83+
84+
85+
86
87=== added file 'stock_picking_better_invoicing/invoice.py'
88--- stock_picking_better_invoicing/invoice.py 1970-01-01 00:00:00 +0000
89+++ stock_picking_better_invoicing/invoice.py 2013-10-03 21:43:34 +0000
90@@ -0,0 +1,43 @@
91+# -*- coding: utf-8 -*-
92+###############################################################################
93+#
94+# Module for OpenERP
95+# Copyright (C) 2013 Akretion (http://www.akretion.com).
96+# @author Sébastien BEAU <sebastien.beau@akretion.com>
97+#
98+# This program is free software: you can redistribute it and/or modify
99+# it under the terms of the GNU Affero General Public License as
100+# published by the Free Software Foundation, either version 3 of the
101+# License, or (at your option) any later version.
102+#
103+# This program is distributed in the hope that it will be useful,
104+# but WITHOUT ANY WARRANTY; without even the implied warranty of
105+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106+# GNU Affero General Public License for more details.
107+#
108+# You should have received a copy of the GNU Affero General Public License
109+# along with this program. If not, see <http://www.gnu.org/licenses/>.
110+#
111+###############################################################################
112+
113+from openerp.osv import fields, orm
114+
115+
116+class account_invoice(orm.Model):
117+ _inherit = 'account.invoice'
118+
119+ _columns = {
120+ 'invoiced_picking_ids': fields.one2many('stock.picking', 'invoice_id',
121+ 'Picking Invoiced',
122+ help=('The current Invoice have been generated '
123+ 'from the list of this picking')
124+ ),
125+ }
126+
127+ def unlink(self, cr, uid, ids, context=None):
128+ if context is None:
129+ context = {}
130+ for invoice in self.browse(cr, uid, ids, context=context):
131+ for picking in invoice.invoiced_picking_ids:
132+ picking.write({'invoice_state': '2binvoiced'})
133+ return super(account_invoice, self).unlink(cr, uid, ids, context=context)
134
135=== added directory 'stock_picking_invoice_link'
136=== added file 'stock_picking_invoice_link/AUTHORS.txt'
137--- stock_picking_invoice_link/AUTHORS.txt 1970-01-01 00:00:00 +0000
138+++ stock_picking_invoice_link/AUTHORS.txt 2013-10-03 21:43:34 +0000
139@@ -0,0 +1,1 @@
140+Lorenzo Battistini <lorenzo.battistini@agilebg.com>
141
142=== added file 'stock_picking_invoice_link/__init__.py'
143--- stock_picking_invoice_link/__init__.py 1970-01-01 00:00:00 +0000
144+++ stock_picking_invoice_link/__init__.py 2013-10-03 21:43:34 +0000
145@@ -0,0 +1,21 @@
146+# -*- coding: utf-8 -*-
147+##############################################################################
148+#
149+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
150+#
151+# This program is free software: you can redistribute it and/or modify
152+# it under the terms of the GNU Affero General Public License as published
153+# by the Free Software Foundation, either version 3 of the License, or
154+# (at your option) any later version.
155+#
156+# This program is distributed in the hope that it will be useful,
157+# but WITHOUT ANY WARRANTY; without even the implied warranty of
158+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
159+# GNU Affero General Public License for more details.
160+#
161+# You should have received a copy of the GNU Affero General Public License
162+# along with this program. If not, see <http://www.gnu.org/licenses/>.
163+#
164+##############################################################################
165+
166+import stock
167
168=== added file 'stock_picking_invoice_link/__openerp__.py'
169--- stock_picking_invoice_link/__openerp__.py 1970-01-01 00:00:00 +0000
170+++ stock_picking_invoice_link/__openerp__.py 2013-10-03 21:43:34 +0000
171@@ -0,0 +1,43 @@
172+# -*- coding: utf-8 -*-
173+##############################################################################
174+#
175+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
176+#
177+# This program is free software: you can redistribute it and/or modify
178+# it under the terms of the GNU Affero General Public License as published
179+# by the Free Software Foundation, either version 3 of the License, or
180+# (at your option) any later version.
181+#
182+# This program is distributed in the hope that it will be useful,
183+# but WITHOUT ANY WARRANTY; without even the implied warranty of
184+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185+# GNU Affero General Public License for more details.
186+#
187+# You should have received a copy of the GNU Affero General Public License
188+# along with this program. If not, see <http://www.gnu.org/licenses/>.
189+#
190+##############################################################################
191+
192+{
193+ 'name': "Picking Invoice Link",
194+ 'version': '0.1',
195+ 'category': 'Warehouse Management',
196+ 'description': """
197+This module adds a link between pickings and generated invoices. So that user can easly reach the invoice related to the picking.
198+
199+""",
200+ 'author': 'Agile Business Group',
201+ 'website': 'http://www.agilebg.com',
202+ 'license': 'AGPL-3',
203+ "depends": ['stock'],
204+ "init_xml": [],
205+ "update_xml": [
206+ "stock_view.xml",
207+ ],
208+ "demo_xml": [],
209+ 'tests': [
210+ ],
211+ "installable": True,
212+ "auto_install": False,
213+ "application": False,
214+}
215
216=== added file 'stock_picking_invoice_link/stock.py'
217--- stock_picking_invoice_link/stock.py 1970-01-01 00:00:00 +0000
218+++ stock_picking_invoice_link/stock.py 2013-10-03 21:43:34 +0000
219@@ -0,0 +1,34 @@
220+# -*- coding: utf-8 -*-
221+##############################################################################
222+#
223+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
224+#
225+# This program is free software: you can redistribute it and/or modify
226+# it under the terms of the GNU Affero General Public License as published
227+# by the Free Software Foundation, either version 3 of the License, or
228+# (at your option) any later version.
229+#
230+# This program is distributed in the hope that it will be useful,
231+# but WITHOUT ANY WARRANTY; without even the implied warranty of
232+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
233+# GNU Affero General Public License for more details.
234+#
235+# You should have received a copy of the GNU Affero General Public License
236+# along with this program. If not, see <http://www.gnu.org/licenses/>.
237+#
238+##############################################################################
239+
240+from openerp.osv import fields, orm
241+from openerp.tools.translate import _
242+
243+class stock_picking(orm.Model):
244+ _inherit = "stock.picking"
245+
246+ _columns = {
247+ 'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
248+ }
249+
250+ def _invoice_hook(self, cr, uid, picking, invoice_id):
251+ res = super(stock_picking,self)._invoice_hook(cr, uid, picking, invoice_id)
252+ picking.write({'invoice_id': invoice_id})
253+ return res
254
255=== added file 'stock_picking_invoice_link/stock_view.xml'
256--- stock_picking_invoice_link/stock_view.xml 1970-01-01 00:00:00 +0000
257+++ stock_picking_invoice_link/stock_view.xml 2013-10-03 21:43:34 +0000
258@@ -0,0 +1,25 @@
259+<?xml version="1.0" encoding="utf-8"?>
260+<openerp>
261+<data>
262+ <record id="view_picking_out_form" model="ir.ui.view">
263+ <field name="name">stock.picking.out.form</field>
264+ <field name="model">stock.picking</field>
265+ <field name="inherit_id" ref="stock.view_picking_out_form"></field>
266+ <field name="arch" type="xml">
267+ <field name="invoice_state" position="after">
268+ <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
269+ </field>
270+ </field>
271+ </record>
272+ <record id="view_picking_in_form" model="ir.ui.view">
273+ <field name="name">stock.picking.in.form</field>
274+ <field name="model">stock.picking</field>
275+ <field name="inherit_id" ref="stock.view_picking_in_form"></field>
276+ <field name="arch" type="xml">
277+ <field name="invoice_state" position="after">
278+ <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
279+ </field>
280+ </field>
281+ </record>
282+</data>
283+</openerp>
284
285=== added directory 'stock_picking_invoice_link/test'

Subscribers

People subscribed via source and target branches