~camptocamp/account-invoicing/correct_payment_term_balance_mdh

« back to all changes in this revision

Viewing changes to account_invoice_shipping_address/stock.py

  • Committer: Yannick Vaucher
  • Author(s): nicola.malcontenti at agilebg
  • Date: 2014-03-13 17:24:39 UTC
  • mfrom: (35.1.5 7.0-bug-1287179-hurrinico)
  • Revision ID: yannick.vaucher@camptocamp.com-20140313172439-q9c6i2e2yaxds5pj
[FIX] missing shipping address on invoice creation with order policy 'On Delivery Order'

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Copyright (C) 2014 Agile Business Group sagl (<http://www.agilebg.com>)
 
5
#    Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
 
6
#
 
7
#    This program is free software: you can redistribute it and/or modify
 
8
#    it under the terms of the GNU Affero General Public License as published
 
9
#    by the Free Software Foundation, either version 3 of the License, or
 
10
#    (at your option) any later version.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU Affero General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU Affero General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
##############################################################################
 
21
 
 
22
from openerp.osv import fields, orm
 
23
from openerp.tools.translate import _
 
24
 
 
25
 
 
26
class stock_picking(orm.Model):
 
27
    _inherit = "stock.picking"
 
28
 
 
29
    def _prepare_invoice(
 
30
            self, cr, uid, picking, partner,
 
31
            inv_type, journal_id, context=None):
 
32
        invoice_vals = super(stock_picking, self)._prepare_invoice(
 
33
            cr, uid, picking, partner, inv_type, journal_id, context=context)
 
34
        if picking and picking.partner_id:
 
35
            invoice_vals['address_shipping_id'] = picking.partner_id.id
 
36
        return invoice_vals