Improve default_company to return (id, name) to prevent one rpc request.

This commit is contained in:
Cédric Krier committed 2008-05-22 10:45:33 +02:00
1 parent 24743e338f
commit d25a59a0ca
2 files changed
+10 -2

No files matched your search

+5 -1
View File
@@ -251,9 +251,13 @@ class Account(OSV):
return True
def default_company(self, cursor, user, context=None):
company_obj = self.pool.get('company.company')
if context is None:
context = {}
return context.get('company', False)
if context.get('company'):
return company_obj.name_get(cursor, user, context['company'],
context=context)[0]
return False
def default_type(self, cursor, user, context=None):
type_obj = self.pool.get('account.account.type')
+5 -1
View File
@@ -313,9 +313,13 @@ class Tax(OSV):
return 1
def default_company(self, cursor, user, context=None):
company_obj = self.pool.get('company.company')
if context is None:
context = {}
return context.get('company', False)
if context.get('company'):
return company_obj.name_get(cursor, user, context['company'],
context=context)[0]
return False
def _process_tax(self, cursor, user, tax, price_unit, context=None):
if tax.type == 'percentage':