Add default value for payment_term if there is only one
This commit is contained in:
1 parent
f245f42387
commit
eb51ff1c70
1 file changed
+9
@@ -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 = {}
|
||||
|
||||
Reference in new issue
Block a user