~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to procurement_so2po_shiping_address/procurement_so2po_shiping_address.py

  • Committer: Openerp User
  • Author(s): Vauxoo
  • Date: 2012-07-26 20:13:13 UTC
  • Revision ID: openerp@ingelub-erp-20120726201313-cgffyvd3zmqhn2w4

[FIX] bug a la hora de confirmar una orden de venta cuando el producto es de tipo servicio 
tomaba dicho porducto como si este fuera almacenable y tuviera stock cosa que no es asi 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
# -*- encoding: utf-8 -*-
3
 
###########################################################################
4
 
#    Module Writen to OpenERP, Open Source Management Solution
5
 
#    Copyright (C) 2013 Vauxoo (<http://vauxoo.com>).
6
 
#    All Rights Reserved
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.
14
 
#
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.
19
 
#
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
 
##########################################################################
23
 
 
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
29
 
 
30
 
import time
31
 
 
32
 
class purchase_order(osv.Model):
33
 
    _inherit = 'purchase.order'
34
 
            
35
 
    
36
 
    _columns={
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."
41
 
        ),
42
 
    }
43
 
 
44
 
class procurement_order(osv.Model):
45
 
    _inherit = 'procurement.order'
46
 
    
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)
52
 
        return res
53
 
        
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
57
 
        return res
58
 
        
59
 
    _columns={
60
 
        'partner_address_dest_id': fields.many2one('res.partner', 'Customer Address Dest'),
61
 
    }
62
 
 
63
 
class sale_order(osv.Model):
64
 
    _inherit = 'sale.order'
65
 
 
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
69
 
        return res
70
 
        
71
 
        
72