diff --git a/addons/account/account.py b/addons/account/account.py
index 855cd42cd25..8e1dc4a403e 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -647,7 +647,7 @@ class account_journal(osv.osv):
'user_id': lambda self,cr,uid,context: uid,
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
-
+
def write(self, cr, uid, ids, vals, context=None):
obj=[]
if 'company_id' in vals:
@@ -673,21 +673,21 @@ class account_journal(osv.osv):
'purchase_refund':'seq_out_refund',
'sale_refund':'seq_in_refund'
}
-
+
seq_pool = self.pool.get('ir.sequence')
seq_typ_pool = self.pool.get('ir.sequence.type')
date_pool = self.pool.get('ir.model.data')
-
+
result = True
-
+
journal = self.browse(cr, uid, ids[0], context)
- code = journal.code.lower()
+ code = journal.code.lower()
types = {
'name':journal.name,
'code':code
}
type_id = seq_typ_pool.create(cr, uid, types)
-
+
seq = {
'name':journal.name,
'code':code,
@@ -697,7 +697,7 @@ class account_journal(osv.osv):
'number_increment':1
}
seq_id = seq_pool.create(cr, uid, seq)
-
+
res = {}
if not journal.sequence_id:
res.update({
@@ -711,11 +711,11 @@ class account_journal(osv.osv):
res.update({
'invoice_sequence_id':inv_seq_id
})
-
+
result = self.write(cr, uid, [journal.id], res)
-
+
return result
-
+
def create(self, cr, uid, vals, context={}):
journal_id = super(account_journal, self).create(cr, uid, vals, context)
self.create_sequence(cr, uid, [journal_id], context)
@@ -738,7 +738,7 @@ class account_journal(osv.osv):
if context.get('journal_type', False):
args += [('type','=',context.get('journal_type'))]
-
+
if name:
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit, context=context)
if not ids:
@@ -749,7 +749,7 @@ class account_journal(osv.osv):
def onchange_type(self, cr, uid, ids, type, currency):
data_pool = self.pool.get('ir.model.data')
user_pool = self.pool.get('res.users')
-
+
type_map = {
'sale':'account_sp_journal_view',
'sale_refund':'account_sp_refund_journal_view',
@@ -761,23 +761,23 @@ class account_journal(osv.osv):
'general':'account_journal_view',
'situation':'account_journal_view'
}
-
+
res = {}
-
+
view_id = type_map.get(type, 'general')
-
+
user = user_pool.browse(cr, uid, uid)
if type in ('cash', 'bank') and currency and user.company_id.currency_id.id != currency:
view_id = 'account_journal_bank_view_multi'
-
+
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=',view_id)])
data = data_pool.browse(cr, uid, data_id[0])
-
+
res.update({
'centralisation':type == 'situation',
'view_id':data.res_id,
})
-
+
return {
'value':res
}
@@ -1035,31 +1035,31 @@ class account_move(osv.osv):
"""
Returns a list of tupples containing id, name, as internally it is called {def name_get}
result format : {[(id, name), (id, name), ...]}
-
+
@param cr: A database cursor
@param user: ID of the user currently logged in
- @param name: name to search
+ @param name: name to search
@param args: other arguments
@param operator: default operator is 'ilike', it can be changed
@param context: context arguments, like lang, time zone
@param limit: Returns first 'n' ids of complete result, default is 80.
-
+
@return: Returns a list of tupples containing id and name
"""
-
+
if not args:
args=[]
if not context:
context={}
ids = []
-
+
if name:
ids += self.search(cr, user, [('name','=',name)], limit=limit)
if not ids:
ids += self.search(cr, user, [('id','=',name)], limit=limit)
-
+
return self.name_get(cr, user, ids, context=context)
-
+
def name_get(self, cursor, user, ids, context=None):
if not len(ids):
return []
@@ -1159,7 +1159,7 @@ class account_move(osv.osv):
'You cannot create entries on different periods/journals in the same move',
['line_id']),
]
-
+
def post(self, cr, uid, ids, context=None):
if self.validate(cr, uid, ids, context) and len(ids):
for move in self.browse(cr, uid, ids):
@@ -1218,7 +1218,7 @@ class account_move(osv.osv):
'balance':False,
'account_tax_id':False,
})
-
+
if 'journal_id' in vals and vals.get('journal_id', False):
for l in vals['line_id']:
if not l[0]:
@@ -1667,15 +1667,15 @@ class account_tax(osv.osv):
"""
Returns a list of tupples containing id, name, as internally it is called {def name_get}
result format : {[(id, name), (id, name), ...]}
-
+
@param cr: A database cursor
@param user: ID of the user currently logged in
- @param name: name to search
+ @param name: name to search
@param args: other arguments
@param operator: default operator is 'ilike', it can be changed
@param context: context arguments, like lang, time zone
@param limit: Returns first 'n' ids of complete result, default is 80.
-
+
@return: Returns a list of tupples containing id and name
"""
if not args:
@@ -1685,10 +1685,10 @@ class account_tax(osv.osv):
ids = []
ids = self.search(cr, user, args, limit=limit, context=context)
return self.name_get(cr, user, ids, context=context)
-
+
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
journal_pool = self.pool.get('account.journal')
-
+
if context and context.has_key('type'):
if context.get('type') in ('out_invoice','out_refund'):
args += [('type_tax_use','in',['sale','all'])]
@@ -1699,7 +1699,7 @@ class account_tax(osv.osv):
journal = journal_pool.browse(cr, uid, context.get('journal_id'))
if journal.type in ('sale', 'purchase'):
args += [('type_tax_use','in',[journal.type,'all'])]
-
+
return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count)
def name_get(self, cr, uid, ids, context={}):
@@ -1716,7 +1716,7 @@ class account_tax(osv.osv):
if user.company_id:
return user.company_id.id
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
-
+
_defaults = {
'python_compute': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or None\n# partner : res.partner object or None\n\nresult = price_unit * 0.10''',
'python_compute_inv': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''',
@@ -1836,11 +1836,11 @@ class account_tax(osv.osv):
tin = self.compute_inv(cr, uid, tin, price_unit, quantity, address_id=address_id, product=product, partner=partner)
for r in tin:
totalex -= r['amount']
- totlex_qty=0.0
+ totlex_qty=0.0
try:
totlex_qty=totalex/quantity
except:
- pass
+ pass
tex = self._compute(cr, uid, tex, totlex_qty, quantity, address_id=address_id, product=product, partner=partner)
for r in tex:
totalin += r['amount']
@@ -2146,11 +2146,10 @@ class account_subscription_line(osv.osv):
'date': fields.date('Date', required=True),
'move_id': fields.many2one('account.move', 'Entry'),
}
- _defaults = {
- }
- def move_create(self, cr, uid, ids, context={}):
+
+ def move_create(self, cr, uid, ids, context=None):
tocheck = {}
- for line in self.browse(cr, uid, ids, context):
+ for line in self.browse(cr, uid, ids, context=context):
datas = {
'date': line.date,
}
@@ -2159,7 +2158,8 @@ class account_subscription_line(osv.osv):
self.write(cr, uid, [line.id], {'move_id':ids[0]})
if tocheck:
self.pool.get('account.subscription').check(cr, uid, tocheck.keys(), context)
- return True
+ return ids
+
_rec_name = 'date'
account_subscription_line()
@@ -2623,7 +2623,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
data = data_pool.browse(cr, uid, data_id[0])
view_id = data.res_id
-
+
seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0]
if obj_multi.seq_journal:
@@ -2664,7 +2664,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
data = data_pool.browse(cr, uid, data_id[0])
view_id_cash = data.res_id
-
+
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view_multi')])
data = data_pool.browse(cr, uid, data_id[0])
ref_acc_bank = data.res_id
@@ -2739,7 +2739,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'fields_id': field[0],
'value': account and 'account.account,'+str(acc_template_ref[account.id]) or False,
}
-
+
if r:
#the property exist: modify it
property_obj.write(cr, uid, r, vals)
@@ -2776,7 +2776,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'position_id' : new_fp,
}
obj_ac_fp.create(cr, uid, vals_acc)
-
+
#fially inactive the demo chart of accounts
data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')])
if data_id:
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 5b612d187d3..30e40f56a7c 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -855,8 +855,8 @@ class account_move_line(osv.osv):
journal_list = journal_pool.name_search(cr, uid, '', [], context=context)
result['fields']['journal_id']['selection'] = journal_list
return result
-
- if not context.get('view_mode', False):
+
+ if context.get('view_mode', False):
return result
fld = []
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index e848de5cfd5..4eba06cb173 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -898,9 +898,9 @@
-
-
+
+
@@ -1094,7 +1094,6 @@
account.move.line
form
tree,form
-
@@ -1518,15 +1517,16 @@
-
-
+
+
+
+
/>