From eb51ff1c702f851140bcc07a7e55ee042bf06c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 1 Aug 2008 16:36:54 +0200 Subject: [PATCH] Add default value for payment_term if there is only one --- invoice.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/invoice.py b/invoice.py index bbc1851b72..fabdef5bc5 100644 --- a/invoice.py +++ b/invoice.py @@ -364,6 +364,15 @@ class Invoice(OSV): context=context)[0] return False + def default_payment_term(self, cursor, user, context=None): + payment_term_obj = self.pool.get('account.invoice.payment_term') + payment_term_ids = payment_term_obj.search(cursor, user, + self.payment_term._domain, context=context) + if len(payment_term_ids) == 1: + return payment_term_obj.name_get(cursor, user, payment_term_ids, + context=context)[0] + return False + def on_change_type(self, cursor, user, ids, vals, context=None): journal_obj = self.pool.get('account.journal') res = {}