~enlightx-deactivatedaccount/openobject-italia/7.0-fix-1271907

« back to all changes in this revision

Viewing changes to l10n_it_sale/account/invoice.py

  • Committer: Andrea Cometa
  • Date: 2013-03-13 08:21:42 UTC
  • mto: This revision was merged to the branch mainline in revision 208.
  • Revision ID: info@andreacometa.it-20130313082142-2j9ownwi3ekxrqdx
[add] l10n_it_sale per openerp7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#    
 
4
#    Copyright (C) 2010 Associazione OpenERP Italia
 
5
#    (<http://www.openerp-italia.org>).
 
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 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
import netsvc
 
23
import pooler, tools
 
24
 
 
25
from osv import fields, osv
 
26
from tools.translate import _
 
27
 
 
28
class account_invoice(osv.osv):
 
29
    
 
30
    _inherit = 'account.invoice'
 
31
        
 
32
    _columns = {
 
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'),
 
37
        }
 
38
 
 
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)
 
43
        if partner_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
 
48
        return result
 
49
    
 
50
account_invoice()
 
51