1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# Copyright (C) 2010 Associazione OpenERP Italia
5
# (<http://www.openerp-italia.org>).
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.
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 General Public License for more details.
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/>.
20
##############################################################################
25
from osv import fields, osv
26
from tools.translate import _
28
class account_invoice(osv.osv):
30
_inherit = 'account.invoice'
33
# 'order_id':fields.many2one('sale.order','Sale Order'),
34
'carriage_condition_id': fields.many2one('stock.picking.carriage_condition', 'Carriage condition'),
35
'goods_description_id': fields.many2one('stock.picking.goods_description', 'Description of goods'),
36
'transportation_reason_id': fields.many2one('stock.picking.transportation_reason', 'Reason for transportation'),
39
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
40
date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False):
41
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
42
date_invoice, payment_term, partner_bank_id, company_id)
44
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
45
result['value']['carriage_condition_id'] = partner.carriage_condition_id.id
46
result['value']['goods_description_id'] = partner.goods_description_id.id
47
result['value']['transportation_reason_id'] = partner.transportation_reason_id.id