← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~agilebg/stock-logistic-flows/imp_stock_picking_invoice_link into lp:stock-logistic-flows/7.0

 

Lorenzo Battistini - Agile BG has proposed merging lp:~agilebg/stock-logistic-flows/imp_stock_picking_invoice_link into lp:stock-logistic-flows/7.0.

Requested reviews:
  Stock and Logistic Core Editors (stock-logistic-core-editors)

For more details, see:
https://code.launchpad.net/~agilebg/stock-logistic-flows/imp_stock_picking_invoice_link/+merge/191175
-- 
https://code.launchpad.net/~agilebg/stock-logistic-flows/imp_stock_picking_invoice_link/+merge/191175
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~agilebg/stock-logistic-flows/imp_stock_picking_invoice_link into lp:stock-logistic-flows/7.0.
=== modified file 'stock_picking_invoice_link/__init__.py'
--- stock_picking_invoice_link/__init__.py	2013-06-03 14:50:36 +0000
+++ stock_picking_invoice_link/__init__.py	2013-10-15 12:48:46 +0000
@@ -1,6 +1,6 @@
 # -*- 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

=== modified file 'stock_picking_invoice_link/__openerp__.py'
--- stock_picking_invoice_link/__openerp__.py	2013-09-02 14:04:48 +0000
+++ stock_picking_invoice_link/__openerp__.py	2013-10-15 12:48:46 +0000
@@ -24,7 +24,8 @@
     'category': 'Warehouse Management',
     'summary': 'Adds link between pickings and generated invoices',
     'description': """
-This module adds a link between pickings and generated invoices. So that user can easly reach the invoice related to the picking.
+This module adds a link between pickings and generated invoices.
+So that user can easly reach the invoice related to the picking.
 
 Probably to be modified according to bug 1169998 (when solution will come)
 https://bugs.launchpad.net/openobject-addons/+bug/1169998

=== modified file 'stock_picking_invoice_link/stock.py'
--- stock_picking_invoice_link/stock.py	2013-06-03 14:50:36 +0000
+++ stock_picking_invoice_link/stock.py	2013-10-15 12:48:46 +0000
@@ -1,6 +1,6 @@
 # -*- 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
@@ -21,28 +21,50 @@
 from openerp.osv import fields, orm
 from openerp.tools.translate import _
 
+
+class stock_move(orm.Model):
+    _inherit = "stock.move"
+
+    _columns = {
+        'invoice_line_id': fields.many2one(
+            'account.invoice.line', 'Invoice line', readonly=True),
+    }
+
+
 class stock_picking(orm.Model):
     _inherit = "stock.picking"
-    
+
     _columns = {
-        'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
-        }
-        
+        '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)
+        res = super(stock_picking, self)._invoice_hook(
+            cr, uid, picking, invoice_id)
         picking.write({'invoice_id': invoice_id})
         return res
 
+    def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
+        res = super(stock_picking, self)._invoice_line_hook(
+            cr, uid, move_line, invoice_line_id)
+        move_line.write({'invoice_line_id': invoice_line_id})
+        return res
+
+
 class stock_picking_out(orm.Model):
     _inherit = "stock.picking.out"
-    
+
     _columns = {
-        'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
-        }
+        'invoice_id': fields.many2one(
+            'account.invoice', 'Invoice', readonly=True),
+    }
+
 
 class stock_picking_in(orm.Model):
     _inherit = "stock.picking.in"
-    
+
     _columns = {
-        'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
-        }
+        'invoice_id': fields.many2one(
+            'account.invoice', 'Invoice', readonly=True),
+    }

=== modified file 'stock_picking_invoice_link/stock_view.xml'
--- stock_picking_invoice_link/stock_view.xml	2013-06-03 14:59:40 +0000
+++ stock_picking_invoice_link/stock_view.xml	2013-10-15 12:48:46 +0000
@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
 <data>
+    
+        <!-- stock.picking -->
+        
         <record id="view_picking_out_form" model="ir.ui.view">
             <field name="name">stock.picking.out.form</field>
             <field name="model">stock.picking.out</field>
@@ -21,5 +24,36 @@
                 </field>
             </field>
         </record>
+        
+        <!-- stock.move -->
+        
+        <record id="view_move_form" model="ir.ui.view">
+            <field name="name">stock.move.form</field>
+            <field name="model">stock.move</field>
+            <field name="inherit_id" ref="stock.view_move_form"></field>
+            <field name="arch" type="xml">
+                <group string="Traceability" position="inside">
+                    <label for="invoice_line_id" groups="account.group_account_invoice"/>
+                    <div groups="account.group_account_invoice">
+                        <field name="invoice_line_id" class="oe_inline"/>
+                    </div>
+                </group>
+            </field>
+        </record>
+        
+        <record id="view_move_picking_form" model="ir.ui.view">
+            <field name="name">stock.move.form</field>
+            <field name="model">stock.move</field>
+            <field name="inherit_id" ref="stock.view_move_picking_form"></field>
+            <field name="arch" type="xml">
+                <group string="Traceability" position="inside">
+                    <label for="invoice_line_id" groups="account.group_account_invoice"/>
+                    <div groups="account.group_account_invoice">
+                        <field name="invoice_line_id" class="oe_inline"/>
+                    </div>
+                </group>
+            </field>
+        </record>
+        
 </data>
 </openerp>


Follow ups