2
# -*- encoding: utf-8 -*-
3
###########################################################################
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
7
# Credits######################################################
8
# Coded by: Rodo(rodo@vauxoo.com)
9
#############################################################################
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU Affero General Public License as published by
12
# the Free Software Foundation, either version 3 of the License, or
13
# (at your option) any later version.
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU Affero General Public License for more details.
20
# You should have received a copy of the GNU Affero General Public License
21
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
##########################################################################
24
from openerp.osv import fields, osv
25
from openerp.tools.translate import _
26
from openerp import pooler, tools
27
from openerp import netsvc
28
from openerp import SUPERUSER_ID
32
class purchase_order(osv.Model):
33
_inherit = 'purchase.order'
37
'partner_address_dest_id': fields.many2one('res.partner', 'Customer Address Dest',
38
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
39
help="Put an address if you want to deliver directly from the supplier to the customer. " \
40
"Otherwise, keep empty to deliver to your own company."
44
class procurement_order(osv.Model):
45
_inherit = 'procurement.order'
47
def make_po(self, cr, uid, ids, context=None):
48
purchase_obj = self.pool.get('purchase.order')
49
res= super(procurement_order, self).make_po(cr, uid, ids=ids, context=context)
50
for procurement in self.browse(cr, uid, ids, context=context):
51
purchase_obj.write(cr,uid,res[procurement.id], {'partner_address_dest_id':procurement.partner_address_dest_id.id}, context=context)
54
def _prepare_orderpoint_procurement(self, cr, uid, orderpoint, product_qty, context=None):
55
res=super(procurement_order, self)._prepare_orderpoint_procurement(cr, uid, orderpoint=orderpoint, product_qty=product_qty, context=context)
56
res['partner_address_dest_id']=orderpoint.partner_shipping_id.id
60
'partner_address_dest_id': fields.many2one('res.partner', 'Customer Address Dest'),
63
class sale_order(osv.Model):
64
_inherit = 'sale.order'
66
def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
67
res=super(sale_order, self)._prepare_order_line_procurement( cr, uid, order=order, line=line, move_id=move_id, date_planned=date_planned,context=context)
68
res['partner_address_dest_id']=order.partner_shipping_id.id