Merge lp:~akretion-team/stock-logistic-flows/61-invoice-link-updated into lp:stock-logistic-flows/6.1

Proposed by Alexis de Lattre
Status: Merged
Merged at revision: 29
Proposed branch: lp:~akretion-team/stock-logistic-flows/61-invoice-link-updated
Merge into: lp:stock-logistic-flows/6.1
Diff against target: 304 lines (+196/-18)
7 files modified
stock_picking_invoice_link/AUTHORS.txt (+1/-0)
stock_picking_invoice_link/__init__.py (+2/-2)
stock_picking_invoice_link/__openerp__.py (+6/-8)
stock_picking_invoice_link/account_invoice_view.xml (+40/-0)
stock_picking_invoice_link/i18n/stock_picking_invoice_link.pot (+99/-0)
stock_picking_invoice_link/stock.py (+46/-6)
stock_picking_invoice_link/stock_view.xml (+2/-2)
To merge this branch: bzr merge lp:~akretion-team/stock-logistic-flows/61-invoice-link-updated
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+204977@code.launchpad.net

Description of the change

Backport the enhancements of the stock_picking_invoice_link module from the 7.0 branch.
Add POT file.

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for backporting it. Seems OK for me reviewing code, but I didn't test it.

Regards.

review: Approve (code review)
30. By Alexis de Lattre

Display the appropriate form view.

31. By Alexis de Lattre

Add nolabel="1"

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LTGM Thanks

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock_picking_invoice_link/AUTHORS.txt'
2--- stock_picking_invoice_link/AUTHORS.txt 2013-06-03 14:50:36 +0000
3+++ stock_picking_invoice_link/AUTHORS.txt 2014-02-06 22:48:31 +0000
4@@ -1,1 +1,2 @@
5 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
6+Alexis de Lattre <alexis.delattre@akretion.com>
7
8=== modified file 'stock_picking_invoice_link/__init__.py'
9--- stock_picking_invoice_link/__init__.py 2013-06-03 14:50:36 +0000
10+++ stock_picking_invoice_link/__init__.py 2014-02-06 22:48:31 +0000
11@@ -1,6 +1,6 @@
12 # -*- coding: utf-8 -*-
13 ##############################################################################
14-#
15+#
16 # Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
17 #
18 # This program is free software: you can redistribute it and/or modify
19@@ -18,4 +18,4 @@
20 #
21 ##############################################################################
22
23-import stock
24+from . import stock
25
26=== modified file 'stock_picking_invoice_link/__openerp__.py'
27--- stock_picking_invoice_link/__openerp__.py 2013-10-03 20:54:30 +0000
28+++ stock_picking_invoice_link/__openerp__.py 2014-02-06 22:48:31 +0000
29@@ -20,23 +20,21 @@
30
31 {
32 'name': "Picking Invoice Link",
33- 'version': '0.1',
34+ 'version': '0.2',
35 'category': 'Warehouse Management',
36 'description': """
37-This module adds a link between pickings and generated invoices. So that user can easly reach the invoice related to the picking.
38+This module adds a link between pickings and generated invoices, so that user can easly reach the invoice related to the picking. It also adds a link between stock moves and invoice lines.
39
40 """,
41 'author': 'Agile Business Group',
42 'website': 'http://www.agilebg.com',
43 'license': 'AGPL-3',
44 "depends": ['stock'],
45- "init_xml": [],
46- "update_xml": [
47+ "data": [
48 "stock_view.xml",
49- ],
50- "demo_xml": [],
51- 'tests': [
52- ],
53+ "account_invoice_view.xml",
54+ ],
55+ 'tests': [],
56 "installable": True,
57 "auto_install": False,
58 "application": False,
59
60=== added file 'stock_picking_invoice_link/account_invoice_view.xml'
61--- stock_picking_invoice_link/account_invoice_view.xml 1970-01-01 00:00:00 +0000
62+++ stock_picking_invoice_link/account_invoice_view.xml 2014-02-06 22:48:31 +0000
63@@ -0,0 +1,40 @@
64+<?xml version="1.0" encoding="utf-8"?>
65+<openerp>
66+<data>
67+
68+<!--
69+ Stock Picking Invoice Link module for OpenERP
70+ Copyright (C) 2013 Akretion (http://www.akretion.com/)
71+ @author: Alexis de Lattre <alexis.delattre@akretion.com>
72+ The licence is in the file __openerp__.py
73+-->
74+
75+<record id="invoice_form" model="ir.ui.view">
76+ <field name="name">related.pickings.account.invoice.form</field>
77+ <field name="model">account.invoice</field>
78+ <field name="inherit_id" ref="account.invoice_form"/>
79+ <field name="arch" type="xml">
80+ <notebook position="inside">
81+ <page string="Delivery Orders" name="pickings">
82+ <field name="picking_ids" nolabel="1"/>
83+ </page>
84+ </notebook>
85+ </field>
86+</record>
87+
88+<record id="invoice_supplier_form" model="ir.ui.view">
89+ <field name="name">related.pickings.account.invoice.supplier.form</field>
90+ <field name="model">account.invoice</field>
91+ <field name="inherit_id" ref="account.invoice_supplier_form"/>
92+ <field name="arch" type="xml">
93+ <notebook position="inside">
94+ <page string="Incoming Shipments" name="pickings">
95+ <field name="picking_ids" nolabel="1"/>
96+ </page>
97+ </notebook>
98+ </field>
99+</record>
100+
101+
102+</data>
103+</openerp>
104
105=== added directory 'stock_picking_invoice_link/i18n'
106=== added file 'stock_picking_invoice_link/i18n/stock_picking_invoice_link.pot'
107--- stock_picking_invoice_link/i18n/stock_picking_invoice_link.pot 1970-01-01 00:00:00 +0000
108+++ stock_picking_invoice_link/i18n/stock_picking_invoice_link.pot 2014-02-06 22:48:31 +0000
109@@ -0,0 +1,99 @@
110+# Translation of OpenERP Server.
111+# This file contains the translation of the following modules:
112+# * stock_picking_invoice_link
113+#
114+msgid ""
115+msgstr ""
116+"Project-Id-Version: OpenERP Server 6.1\n"
117+"Report-Msgid-Bugs-To: \n"
118+"POT-Creation-Date: 2014-02-05 15:08+0000\n"
119+"PO-Revision-Date: 2014-02-05 15:08+0000\n"
120+"Last-Translator: <>\n"
121+"Language-Team: \n"
122+"MIME-Version: 1.0\n"
123+"Content-Type: text/plain; charset=UTF-8\n"
124+"Content-Transfer-Encoding: \n"
125+"Plural-Forms: \n"
126+
127+#. module: stock_picking_invoice_link
128+#: sql_constraint:account.invoice:0
129+msgid "Invoice Number must be unique per Company!"
130+msgstr ""
131+
132+#. module: stock_picking_invoice_link
133+#: sql_constraint:stock.picking:0
134+msgid "Reference must be unique per Company!"
135+msgstr ""
136+
137+#. module: stock_picking_invoice_link
138+#: view:account.invoice:0
139+msgid "Incoming Shipments"
140+msgstr ""
141+
142+#. module: stock_picking_invoice_link
143+#: model:ir.model,name:stock_picking_invoice_link.model_stock_move
144+msgid "Stock Move"
145+msgstr ""
146+
147+#. module: stock_picking_invoice_link
148+#: constraint:stock.move:0
149+msgid "You can not move products from or to a location of the type view."
150+msgstr ""
151+
152+#. module: stock_picking_invoice_link
153+#: constraint:stock.move:0
154+msgid "You must assign a production lot for this product"
155+msgstr ""
156+
157+#. module: stock_picking_invoice_link
158+#: field:account.invoice,picking_ids:0
159+msgid "Related Pickings"
160+msgstr ""
161+
162+#. module: stock_picking_invoice_link
163+#: help:account.invoice,picking_ids:0
164+msgid "Related pickings (only when the invoice has been generated from the picking)."
165+msgstr ""
166+
167+#. module: stock_picking_invoice_link
168+#: field:stock.move,invoice_line_id:0
169+msgid "Invoice line"
170+msgstr ""
171+
172+#. module: stock_picking_invoice_link
173+#: model:ir.model,name:stock_picking_invoice_link.model_account_invoice_line
174+msgid "Invoice Line"
175+msgstr ""
176+
177+#. module: stock_picking_invoice_link
178+#: constraint:stock.move:0
179+msgid "You try to assign a lot which is not from the same product"
180+msgstr ""
181+
182+#. module: stock_picking_invoice_link
183+#: field:account.invoice.line,move_line_ids:0
184+msgid "Related Stock Moves"
185+msgstr ""
186+
187+#. module: stock_picking_invoice_link
188+#: model:ir.model,name:stock_picking_invoice_link.model_account_invoice
189+#: view:stock.picking:0
190+#: field:stock.picking,invoice_id:0
191+msgid "Invoice"
192+msgstr ""
193+
194+#. module: stock_picking_invoice_link
195+#: model:ir.model,name:stock_picking_invoice_link.model_stock_picking
196+msgid "Picking List"
197+msgstr ""
198+
199+#. module: stock_picking_invoice_link
200+#: help:account.invoice.line,move_line_ids:0
201+msgid "Related stock moves (only when the invoice has been generated from the picking)."
202+msgstr ""
203+
204+#. module: stock_picking_invoice_link
205+#: view:account.invoice:0
206+msgid "Delivery Orders"
207+msgstr ""
208+
209
210=== modified file 'stock_picking_invoice_link/stock.py'
211--- stock_picking_invoice_link/stock.py 2013-10-03 20:54:30 +0000
212+++ stock_picking_invoice_link/stock.py 2014-02-06 22:48:31 +0000
213@@ -1,6 +1,6 @@
214 # -*- coding: utf-8 -*-
215 ##############################################################################
216-#
217+#
218 # Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
219 #
220 # This program is free software: you can redistribute it and/or modify
221@@ -19,16 +19,56 @@
222 ##############################################################################
223
224 from openerp.osv import fields, orm
225-from openerp.tools.translate import _
226+
227+
228+class stock_move(orm.Model):
229+ _inherit = "stock.move"
230+
231+ _columns = {
232+ 'invoice_line_id': fields.many2one(
233+ 'account.invoice.line', 'Invoice Line', readonly=True),
234+ }
235+
236
237 class stock_picking(orm.Model):
238 _inherit = "stock.picking"
239-
240+
241 _columns = {
242- 'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
243+ 'invoice_id': fields.many2one(
244+ 'account.invoice', 'Invoice', readonly=True),
245 }
246-
247+
248 def _invoice_hook(self, cr, uid, picking, invoice_id):
249- res = super(stock_picking,self)._invoice_hook(cr, uid, picking, invoice_id)
250+ res = super(stock_picking, self)._invoice_hook(
251+ cr, uid, picking, invoice_id)
252 picking.write({'invoice_id': invoice_id})
253 return res
254+
255+ def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
256+ res = super(stock_picking, self)._invoice_line_hook(
257+ cr, uid, move_line, invoice_line_id)
258+ move_line.write({'invoice_line_id': invoice_line_id})
259+ return res
260+
261+
262+class account_invoice(orm.Model):
263+ _inherit = "account.invoice"
264+
265+ _columns = {
266+ 'picking_ids': fields.one2many(
267+ 'stock.picking', 'invoice_id', 'Related Pickings', readonly=True,
268+ help="Related pickings (only when the invoice has been generated "
269+ "from the picking)."),
270+ }
271+
272+
273+class account_invoice_line(orm.Model):
274+ _inherit = "account.invoice.line"
275+
276+ _columns = {
277+ 'move_line_ids': fields.one2many(
278+ 'stock.move', 'invoice_line_id', 'Related Stock Moves',
279+ readonly=True,
280+ help="Related stock moves (only when the invoice has been "
281+ "generated from the picking)."),
282+ }
283
284=== modified file 'stock_picking_invoice_link/stock_view.xml'
285--- stock_picking_invoice_link/stock_view.xml 2013-10-03 20:54:30 +0000
286+++ stock_picking_invoice_link/stock_view.xml 2014-02-06 22:48:31 +0000
287@@ -7,7 +7,7 @@
288 <field name="inherit_id" ref="stock.view_picking_out_form"></field>
289 <field name="arch" type="xml">
290 <field name="invoice_state" position="after">
291- <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
292+ <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}" context="{'form_view_ref': 'account.invoice_form'}"/>
293 </field>
294 </field>
295 </record>
296@@ -17,7 +17,7 @@
297 <field name="inherit_id" ref="stock.view_picking_in_form"></field>
298 <field name="arch" type="xml">
299 <field name="invoice_state" position="after">
300- <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
301+ <field name="invoice_id" string="Invoice" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}" context="{'form_view_ref': 'account.invoice_supplier_form'}"/>
302 </field>
303 </field>
304 </record>

Subscribers

People subscribed via source and target branches