[MERGE] backport of addons v7 rev 9194: [FIX] sale_crm: add payment_term to sale...
authorMartin Trigaux <mat@openerp.com>
Tue, 4 Jun 2013 15:50:46 +0000 (17:50 +0200)
committerMartin Trigaux <mat@openerp.com>
Tue, 4 Jun 2013 15:50:46 +0000 (17:50 +0200)
bzr revid: mat@openerp.com-20130604155046-jf3m219ji71hmj9x

addons/sale_crm/wizard/crm_make_sale.py

index c3515cc..1bf421f 100644 (file)
@@ -76,11 +76,13 @@ class crm_make_sale(osv.osv_memory):
                     ['default', 'invoice', 'delivery', 'contact'])
             pricelist = partner.property_product_pricelist.id
             fpos = partner.property_account_position and partner.property_account_position.id or False
+            payment_term = partner.property_payment_term and partner.property_payment_term.id or False
             new_ids = []
             for case in case_obj.browse(cr, uid, data, context=context):
                 if not partner and case.partner_id:
                     partner = case.partner_id
                     fpos = partner.property_account_position and partner.property_account_position.id or False
+                    payment_term = partner.property_payment_term and partner.property_payment_term.id or False
                     partner_addr = partner_obj.address_get(cr, uid, [partner.id],
                             ['default', 'invoice', 'delivery', 'contact'])
                     pricelist = partner.property_product_pricelist.id
@@ -99,6 +101,7 @@ class crm_make_sale(osv.osv_memory):
                     'partner_shipping_id': partner_addr['delivery'],
                     'date_order': fields.date.context_today(self,cr,uid,context=context),
                     'fiscal_position': fpos,
+                    'payment_term':payment_term,
                 }
                 if partner.id:
                     vals['user_id'] = partner.user_id and partner.user_id.id or uid