if not line.partner_id:
raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \
"\nPlease define partner on it!")%(line.name, model.name))
- if line.partner_id.property_payment_term:
+
+ payment_term_id = False
+ if model.journal_id.type in ('purchase', 'purchase_refund') and line.partner_id.property_supplier_payment_term:
+ payment_term_id = line.partner_id.property_supplier_payment_term.id
+ elif line.partner_id.property_payment_term:
payment_term_id = line.partner_id.property_payment_term.id
+ if payment_term_id:
pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_maturity)
if pterm_list:
pterm_list = [l[0] for l in pterm_list]