poc keep sequence from so to invoice when invoicing from picking
authorAntony Lesuisse <al@openerp.com>
Thu, 9 Feb 2012 01:48:38 +0000 (02:48 +0100)
committerAntony Lesuisse <al@openerp.com>
Thu, 9 Feb 2012 01:48:38 +0000 (02:48 +0100)
bzr revid: al@openerp.com-20120209014838-b6skk4g33t3gzw6c

addons/sale_layout/sale_layout.py

index ef63ad5..a7017a7 100644 (file)
@@ -161,4 +161,15 @@ class sale_order(osv.osv):
 
 sale_order()
 
+class stock_picking(osv.osv):
+    _inherit = "stock.picking"
+
+    def _prepare_invoice_line(self, cr, uid, group, picking, move_line, invoice_id, invoice_vals, context=None):
+        vals = super(stock_picking, self).__prepare_invoice_line(cr, uid, group, picking, move_line, invoice_id, invoice_vals, context)
+
+        if "sequence" in self.pool.get("account.invoice.line")._all_columns and move_line.sale_line_id:
+            vals['sequence'] == move_line.sale_line_id.sequence
+
+        return vals
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: