diff --git a/addons/account/account.py b/addons/account/account.py
index b0271a4fee1..ac50c25cd6b 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -278,7 +278,7 @@ class account_account(osv.osv):
# ON l.account_id = tmp.id
# or make _get_children_and_consol return a query and join on that
request = ("SELECT l.account_id as id, " +\
- ' , '.join(map(mapping.__getitem__, field_names)) +
+ ', '.join(map(mapping.__getitem__, field_names)) +
" FROM account_move_line l" \
" WHERE l.account_id IN %s " \
+ filters +
@@ -1538,7 +1538,7 @@ class account_tax_code(osv.osv):
if context is None:
context = {}
move_state = ('posted', )
- if context.get('state', False) == 'all':
+ if context.get('state', 'all') == 'all':
move_state = ('draft', 'posted', )
if context.get('fiscalyear_id', False):
fiscalyear_id = context['fiscalyear_id']
diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py
index e579f76f0ed..a982ca51182 100644
--- a/addons/account/account_analytic_line.py
+++ b/addons/account/account_analytic_line.py
@@ -31,12 +31,12 @@ class account_analytic_line(osv.osv):
_inherit = 'account.analytic.line'
_description = 'Analytic Line'
_columns = {
- 'product_uom_id' : fields.many2one('product.uom', 'UoM'),
- 'product_id' : fields.many2one('product.product', 'Product'),
- 'general_account_id' : fields.many2one('account.account', 'General Account', required=True, ondelete='cascade'),
- 'move_id' : fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True),
- 'journal_id' : fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='cascade', select=True),
- 'code' : fields.char('Code', size=8),
+ 'product_uom_id': fields.many2one('product.uom', 'UoM'),
+ 'product_id': fields.many2one('product.product', 'Product'),
+ 'general_account_id': fields.many2one('account.account', 'General Account', required=True, ondelete='cascade'),
+ 'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True),
+ 'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='cascade', select=True),
+ 'code': fields.char('Code', size=8),
'ref': fields.char('Ref.', size=64),
'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account currency', store=True, help="The related account currency if not equal to the company one.", readonly=True),
'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
@@ -88,7 +88,7 @@ class account_analytic_line(osv.osv):
company_id = j_id.company_id.id
result = 0.0
is_purchase = False
-
+
if j_id.type <> 'sale':
a = prod.product_tmpl_id.property_account_expense.id
if not a:
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index a7b6b66d2c1..0b240663943 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -21,9 +21,7 @@
import time
-import netsvc
from osv import fields, osv
-from tools.misc import currency
from tools.translate import _
import decimal_precision as dp
diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py
index 86690b204b9..6431454b715 100644
--- a/addons/account/account_cash_statement.py
+++ b/addons/account/account_cash_statement.py
@@ -151,15 +151,14 @@ class account_cash_statement(osv.osv):
res[r] = round(res[r], 2)
return res
- def _get_company(self, cr, uid, context={}):
+ def _get_company(self, cr, uid, context=None):
user_pool = self.pool.get('res.users')
company_pool = self.pool.get('res.company')
- user = user_pool.browse(cr, uid, uid, context)
- company_id = user.company_id and user.company_id.id
+ user = user_pool.browse(cr, uid, uid, context=context)
+ company_id = user.company_id
if not company_id:
- company_id = company_pool.search(cr, uid, [])[0]
-
- return company_id
+ company_id = company_pool.search(cr, uid, [])
+ return company_id and company_id[0] or False
def _get_cash_open_box_lines(self, cr, uid, context={}):
res = []
@@ -229,7 +228,7 @@ class account_cash_statement(osv.osv):
'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"),
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
- 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then / , its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'),
+ 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'),
'user_id':fields.many2one('res.users', 'Responsible', required=False),
}
_defaults = {
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index ba6f4110ec1..d9b78795998 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -349,7 +349,7 @@ class account_move_line(osv.osv):
return res
def name_get(self, cr, uid, ids, context={}):
- if not len(ids):
+ if not ids:
return []
result = []
for line in self.browse(cr, uid, ids, context):
@@ -363,18 +363,18 @@ class account_move_line(osv.osv):
if context is None:
context = {}
- if not len(args):
+ if not args:
return []
where = ' and '.join(map(lambda x: '(abs(sum(debit-credit))'+x[1]+str(x[2])+')',args))
cursor.execute('select id, sum(debit-credit) from account_move_line \
group by id, debit, credit having '+where)
res = cursor.fetchall()
- if not len(res):
+ if not res:
return [('id', '=', '0')]
return [('id', 'in', [x[0] for x in res])]
def _invoice_search(self, cursor, user, obj, name, args, context):
- if not len(args):
+ if not args:
return []
invoice_obj = self.pool.get('account.invoice')
@@ -407,7 +407,7 @@ class account_move_line(osv.osv):
qu2 += x[2]
else:
qu1.append(' (False)')
- if len(qu1):
+ if qu1:
qu1 = ' AND' + ' AND'.join(qu1)
else:
qu1 = ''
@@ -415,7 +415,7 @@ class account_move_line(osv.osv):
'FROM account_move_line l, account_invoice i ' \
'WHERE l.move_id = i.move_id ' + qu1, qu2)
res = cursor.fetchall()
- if not len(res):
+ if not res:
return [('id', '=', '0')]
return [('id', 'in', [x[0] for x in res])]
@@ -989,7 +989,7 @@ class account_move_line(osv.osv):
part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs]
unlink_ids += rec_ids
unlink_ids += part_rec_ids
- if len(unlink_ids):
+ if unlink_ids:
obj_move_rec.unlink(cr, uid, unlink_ids)
return True
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index ba1bd98fc04..27fd0d65b14 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1640,7 +1640,7 @@
-
+
@@ -2590,7 +2590,7 @@
- Cash Register
+ Cash Registers
ir.actions.act_window
account.bank.statement
form
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 0c83814c15d..4cdaeab9a49 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -302,7 +302,7 @@ class account_invoice(osv.osv):
}, help="The Journal Entry of the invoice have been totally reconciled with one or several Journal Entries of payment."),
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
- 'move_lines':fields.function(_get_lines , method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
+ 'move_lines':fields.function(_get_lines, method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 50),
@@ -585,7 +585,7 @@ class account_invoice(osv.osv):
else:
val['currency_id'] = company.currency_id.id
- return {'value' : val, 'domain': dom }
+ return {'value': val, 'domain': dom }
# go from canceled state to draft state
def action_cancel_draft(self, cr, uid, ids, *args):
@@ -898,7 +898,7 @@ class account_invoice(osv.osv):
'name': name,
'price': total,
'account_id': acc_id,
- 'date_maturity' : inv.date_due or False,
+ 'date_maturity': inv.date_due or False,
'amount_currency': diff_currency_p \
and total_currency or False,
'currency_id': diff_currency_p \
@@ -909,7 +909,7 @@ class account_invoice(osv.osv):
date = inv.date_invoice or time.strftime('%Y-%m-%d')
part = inv.partner_id.id
- line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})) ,iml)
+ line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})),iml)
line = self.group_lines(cr, uid, iml, line, inv)
@@ -932,7 +932,7 @@ class account_invoice(osv.osv):
period_id = inv.period_id and inv.period_id.id or False
if not period_id:
period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
- if len(period_ids):
+ if period_ids:
period_id = period_ids[0]
if period_id:
move['period_id'] = period_id
@@ -1018,7 +1018,7 @@ class account_invoice(osv.osv):
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
if i['payment_ids']:
account_move_line_obj = self.pool.get('account.move.line')
- pay_ids = account_move_line_obj.browse(cr, uid , i['payment_ids'])
+ pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids'])
for move_line in pay_ids:
if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids:
raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!'))
@@ -1043,7 +1043,7 @@ class account_invoice(osv.osv):
return True
def name_get(self, cr, uid, ids, context=None):
- if not len(ids):
+ if not ids:
return []
types = {
'out_invoice': 'CI: ',
@@ -1078,7 +1078,9 @@ class account_invoice(osv.osv):
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None):
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id'])
-
+ obj_invoice_line = self.pool.get('account.invoice.line')
+ obj_invoice_tax = self.pool.get('account.invoice.tax')
+ obj_journal = self.pool.get('account.journal')
new_ids = []
for invoice in invoices:
del invoice['id']
@@ -1090,20 +1092,20 @@ class account_invoice(osv.osv):
'in_refund': 'in_invoice', # Supplier Refund
}
- invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
+ invoice_lines = obj_invoice_line.read(cr, uid, invoice['invoice_line'])
invoice_lines = self._refund_cleanup_lines(cr, uid, invoice_lines)
- tax_lines = self.pool.get('account.invoice.tax').read(cr, uid, invoice['tax_line'])
+ tax_lines = obj_invoice_tax.read(cr, uid, invoice['tax_line'])
tax_lines = filter(lambda l: l['manual'], tax_lines)
tax_lines = self._refund_cleanup_lines(cr, uid, tax_lines)
if journal_id:
refund_journal_ids = [journal_id]
elif invoice['type'] == 'in_invoice':
- refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase_refund')])
+ refund_journal_ids = obj_journal.search(cr, uid, [('type','=','purchase_refund')])
else:
- refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')])
+ refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')])
- if not date :
+ if not date:
date = time.strftime('%Y-%m-%d')
invoice.update({
'type': type_dict[invoice['type']],
@@ -1114,11 +1116,11 @@ class account_invoice(osv.osv):
'tax_line': tax_lines,
'journal_id': refund_journal_ids
})
- if period_id :
+ if period_id:
invoice.update({
'period_id': period_id,
})
- if description :
+ if description:
invoice.update({
'name': description,
})
@@ -1406,7 +1408,7 @@ class account_invoice_line(osv.osv):
result['uos_id'] = res.uom_id.id or uom or False
if result['uos_id']:
res2 = res.uom_id.category_id.id
- if res2 :
+ if res2:
domain = {'uos_id':[('category_id','=',res2 )]}
result['categ_id'] = res.categ_id.id
@@ -1537,8 +1539,8 @@ class account_invoice_tax(osv.osv):
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')),
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
- 'factor_base' : fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
- 'factor_tax' : fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
+ 'factor_base': fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
+ 'factor_tax': fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
}
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False):
diff --git a/addons/account/partner.py b/addons/account/partner.py
index 8b0f1057c52..6b88f759c21 100644
--- a/addons/account/partner.py
+++ b/addons/account/partner.py
@@ -51,7 +51,7 @@ class account_fiscal_position(osv.osv):
return result
def map_account(self, cr, uid, fposition_id, account_id, context={}):
- if not fposition_id :
+ if not fposition_id:
return account_id
for pos in fposition_id.account_ids:
if pos.account_src_id.id == account_id:
@@ -111,7 +111,7 @@ class res_partner(osv.osv):
return res
def _asset_difference_search(self, cr, uid, obj, name, type, args, context=None):
- if not len(args):
+ if not args:
return []
having_values = tuple(map(itemgetter(2), args))
where = ' AND '.join(
@@ -128,7 +128,7 @@ class res_partner(osv.osv):
'GROUP BY partner_id HAVING '+where),
(type,) + having_values)
res = cr.fetchall()
- if not len(res):
+ if not res:
return [('id','=','0')]
return [('id','in',map(itemgetter(0), res))]
diff --git a/addons/account/project/analytic_account_demo.xml b/addons/account/project/analytic_account_demo.xml
index 3727f7741bf..8f33f70f856 100644
--- a/addons/account/project/analytic_account_demo.xml
+++ b/addons/account/project/analytic_account_demo.xml
@@ -198,7 +198,7 @@
- Administratif
+ Administrative
1
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
index fd52619fb10..809f69673fe 100644
--- a/addons/account/project/project_view.xml
+++ b/addons/account/project/project_view.xml
@@ -182,6 +182,7 @@
+
@@ -430,13 +431,13 @@
-
diff --git a/addons/account/project/report/analytic_balance.py b/addons/account/project/report/analytic_balance.py
index 01cefdd03c8..42e36744cb8 100644
--- a/addons/account/project/report/analytic_balance.py
+++ b/addons/account/project/report/analytic_balance.py
@@ -119,12 +119,12 @@ class account_analytic_balance(report_sxw.rml_parse):
return (debit-credit)
def _sum_all(self, accounts, date1, date2, option):
+ account_analytic_obj = self.pool.get('account.analytic.account')
ids = map(lambda x: x['id'], accounts)
if not ids:
return 0.0
if not self.acc_sum_list:
- account_analytic_obj = self.pool.get('account.analytic.account')
ids2 = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', ids)])
self.acc_sum_list = ids2
else:
diff --git a/addons/account/project/report/cost_ledger.py b/addons/account/project/report/cost_ledger.py
index c711eeb2b30..225a85d2ee1 100644
--- a/addons/account/project/report/cost_ledger.py
+++ b/addons/account/project/report/cost_ledger.py
@@ -91,14 +91,14 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
def _sum_debit(self, accounts, date1, date2):
ids = map(lambda x: x.id, accounts)
- if not len(ids):
+ if not ids:
return 0.0
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids), date1, date2,))
return self.cr.fetchone()[0] or 0.0
def _sum_credit(self, accounts, date1, date2):
ids = map(lambda x: x.id, accounts)
- if not len(ids):
+ if not ids:
return 0.0
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
return self.cr.fetchone()[0] or 0.0
diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py
index c593d05566e..4d874fe50ee 100644
--- a/addons/account/project/report/quantity_cost_ledger.py
+++ b/addons/account/project/report/quantity_cost_ledger.py
@@ -102,7 +102,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
def _sum_quantity(self, accounts, date1, date2, journals):
ids = map(lambda x: x.id, accounts)
- if not len(ids):
+ if not ids:
return 0.0
if not journals:
self.cr.execute("SELECT sum(unit_amount) \
diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py
index 5936e29fe29..457ce7bb27f 100644
--- a/addons/account/report/account_aged_partner_balance.py
+++ b/addons/account/report/account_aged_partner_balance.py
@@ -70,7 +70,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
AND (l.partner_id=res_partner.id)\
AND ' + self.query + ' \
- ORDER BY res_partner.name' , (self.date_from,))
+ ORDER BY res_partner.name', (self.date_from,))
partners = self.cr.dictfetchall()
## mise a 0 du total
for i in range(7):
@@ -96,7 +96,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
AND ' + self.query + '\
AND account_account.active\
- GROUP BY partner_id ' , (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from))
+ GROUP BY partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from))
t = self.cr.fetchall()
for i in t:
totals[i[0]] = i[1]
@@ -131,7 +131,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
AND '+ self.query + '\
AND account_account.active\
- GROUP BY l.partner_id' , (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from))
+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from))
t = self.cr.fetchall()
for i in t:
future_past[i[0]] = i[1]
@@ -140,7 +140,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
# Each history will contain : history[1] = {'': }
history = []
for i in range(5):
- args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids) ,self.date_from,)
+ args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids),self.date_from,)
dates_query = '(COALESCE(l.date_maturity,l.date)'
if form[str(i)]['start'] and form[str(i)]['stop']:
dates_query += ' BETWEEN %s AND %s)'
@@ -153,7 +153,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
args_list += (form[str(i)]['stop'],)
self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit)\
- FROM account_move_line AS l, account_account , account_move am \
+ FROM account_move_line AS l, account_account, account_move am \
WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
AND (am.state IN %s)\
AND (account_account.type IN %s)\
@@ -163,7 +163,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
AND '+ self.query + '\
AND account_account.active\
AND ' + dates_query + '\
- GROUP BY l.partner_id' , args_list)
+ GROUP BY l.partner_id', args_list)
t = self.cr.fetchall()
d = {}
for i in t:
@@ -227,7 +227,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
self.total_account.append(0)
totals = {}
self.cr.execute('SELECT SUM(l.debit-l.credit) \
- FROM account_move_line AS l, account_account , account_move am \
+ FROM account_move_line AS l, account_account, account_move am \
WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
AND (am.state IN %s)\
AND (l.partner_id IS NULL)\
@@ -235,7 +235,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
AND ((l.reconcile_id IS NULL) \
OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
AND ' + self.query + '\
- AND account_account.active ' ,(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from))
+ AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from))
t = self.cr.fetchall()
for i in t:
totals['Unknown Partner'] = i[0]
@@ -266,7 +266,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
AND ((l.reconcile_id IS NULL)\
OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
AND '+ self.query + '\
- AND account_account.active ' , (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
+ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
t = self.cr.fetchall()
for i in t:
future_past['Unknown Partner'] = i[0]
@@ -286,7 +286,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
args_list += (form[str(i)]['stop'],)
self.cr.execute('SELECT SUM(l.debit-l.credit)\
- FROM account_move_line AS l, account_account , account_move am \
+ FROM account_move_line AS l, account_account, account_move am \
WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
AND (am.state IN %s)\
AND (account_account.type IN %s)\
@@ -296,7 +296,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
AND '+ self.query + '\
AND account_account.active\
AND ' + dates_query + '\
- GROUP BY l.partner_id' , args_list)
+ GROUP BY l.partner_id', args_list)
t = self.cr.fetchall()
d = {}
for i in t:
diff --git a/addons/account/report/account_analytic_entries_report.py b/addons/account/report/account_analytic_entries_report.py
index aa0c5b3ba99..a53e19721dd 100644
--- a/addons/account/report/account_analytic_entries_report.py
+++ b/addons/account/report/account_analytic_entries_report.py
@@ -33,7 +33,7 @@ class analytic_entries_report(osv.osv):
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
- 'user_id' : fields.many2one('res.users', 'User',readonly=True),
+ 'user_id': fields.many2one('res.users', 'User',readonly=True),
'name': fields.char('Description', size=64, readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner'),
'company_id': fields.many2one('res.company', 'Company', required=True),
diff --git a/addons/account/report/account_analytic_entries_report_view.xml b/addons/account/report/account_analytic_entries_report_view.xml
index 34d23826e80..6f1094599b5 100644
--- a/addons/account/report/account_analytic_entries_report_view.xml
+++ b/addons/account/report/account_analytic_entries_report_view.xml
@@ -56,18 +56,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -83,6 +72,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 236433819c5..5a6c7700b9d 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -86,7 +86,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
self.sum_debit += account_rec['debit']
self.sum_credit += account_rec['credit']
if disp_acc == 'bal_movement':
- if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
+ if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0:
self.result_acc.append(res)
elif disp_acc == 'bal_solde':
if res['balance'] != 0:
diff --git a/addons/account/report/account_balance_landscape.py b/addons/account/report/account_balance_landscape.py
index 04f7cc8ec7f..6ec7ec7c10e 100644
--- a/addons/account/report/account_balance_landscape.py
+++ b/addons/account/report/account_balance_landscape.py
@@ -139,7 +139,7 @@ class account_balance_landscape(rml_parse.rml_parse):
ctx['state'] = form['context'].get('state','all')
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
- if len(tmp):
+ if tmp:
accounts.append(tmp)
merged_accounts=zip(*accounts)
@@ -198,7 +198,7 @@ class account_balance_landscape(rml_parse.rml_parse):
ctx['state'] = form['context'].get('state','all')
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
- if len(tmp1):
+ if tmp1:
accounts.append(tmp1)
if level==1: #if parent is called,done is not empty when called again.
diff --git a/addons/account/report/account_central_journal.py b/addons/account/report/account_central_journal.py
index bf5164253cc..35f1e666c6f 100644
--- a/addons/account/report/account_central_journal.py
+++ b/addons/account/report/account_central_journal.py
@@ -71,11 +71,12 @@ class journal_print(report_sxw.rml_parse, common_report_header):
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted']
- self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code,l.currency_id ,l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit \
+
+ self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code, l.currency_id, l.amount_currency, SUM(debit) AS debit, SUM(credit) AS credit \
from account_move_line l \
LEFT JOIN account_move am ON (l.move_id=am.id) \
LEFT JOIN account_account a ON (l.account_id=a.id) \
- LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code , a.currency_id,l.currency_id', (tuple(move_state), period_id, journal_id))
+ LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code, a.currency_id,l.currency_id', (tuple(move_state), period_id, journal_id))
return self.cr.dictfetchall()
def _set_get_account_currency_code(self, account_id):
@@ -91,12 +92,12 @@ class journal_print(report_sxw.rml_parse, common_report_header):
def _get_account(self, data):
if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
- return super(journal_print ,self)._get_account(data)
+ return super(journal_print,self)._get_account(data)
def _get_fiscalyear(self, data):
if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
- return super(journal_print ,self)._get_fiscalyear(data)
+ return super(journal_print,self)._get_fiscalyear(data)
def _display_currency(self, data):
if data['model'] == 'account.journal.period':
diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py
index ae0b3e47b04..942ca8c4fb8 100644
--- a/addons/account/report/account_entries_report.py
+++ b/addons/account/report/account_entries_report.py
@@ -55,7 +55,7 @@ class account_entries_report(osv.osv):
'move_line_state': fields.selection([('draft','Unbalanced'), ('valid','Valid')], 'State of Move Line', readonly=True),
'reconcile_id': fields.many2one('account.move.reconcile', readonly=True),
'partner_id': fields.many2one('res.partner','Partner', readonly=True),
- 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
+ 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True),
'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True),
'type': fields.selection([
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index d35f0603ded..e13604c4219 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -117,15 +117,15 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
sold_account = self._sum_balance_account(child_account)
self.sold_accounts[child_account.id] = sold_account
if self.display_account == 'bal_movement':
- if child_account.type != 'view' and num_entry <> 0 :
+ if child_account.type != 'view' and num_entry <> 0:
res.append(child_account)
elif self.display_account == 'bal_solde':
- if child_account.type != 'view' and num_entry <> 0 :
+ if child_account.type != 'view' and num_entry <> 0:
if ( sold_account <> 0.0):
res.append(child_account)
else:
res.append(child_account)
- if not len(res):
+ if not res:
return [account]
return res
diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py
index 4f6ad99792d..ab7b6211064 100644
--- a/addons/account/report/account_journal.py
+++ b/addons/account/report/account_journal.py
@@ -84,7 +84,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
if self.target_move == 'posted':
move_state = ['posted']
- self.cr.execute('SELECT SUM(debit) FROM account_move_line l , account_move am '
+ self.cr.execute('SELECT SUM(debit) FROM account_move_line l, account_move am '
'WHERE l.move_id=am.id AND am.state IN %s AND l.period_id IN %s AND l.journal_id IN %s ' + self.query_get_clause + ' ',
(tuple(move_state), tuple(period_id), tuple(journal_id)))
return self.cr.fetchone()[0] or 0.0
@@ -121,7 +121,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
if self.target_move == 'posted':
move_state = ['posted']
- self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '' ,(tuple(move_state), period_id, tuple(journal_id) ))
+ self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) ))
ids = map(lambda x: x[0], self.cr.fetchall())
return obj_mline.browse(self.cr, self.uid, ids)
@@ -138,12 +138,12 @@ class journal_print(report_sxw.rml_parse, common_report_header):
def _get_fiscalyear(self, data):
if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
- return super(journal_print ,self)._get_fiscalyear(data)
+ return super(journal_print, self)._get_fiscalyear(data)
def _get_account(self, data):
if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
- return super(journal_print ,self)._get_account(data)
+ return super(journal_print, self)._get_account(data)
def _display_currency(self, data):
if data['model'] == 'account.journal.period':
diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py
index 06baa4639eb..c17de597e1c 100644
--- a/addons/account/report/account_partner_balance.py
+++ b/addons/account/report/account_partner_balance.py
@@ -83,7 +83,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
full_account = []
result_tmp = 0.0
self.cr.execute(
- "SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code ,p.name, sum(debit) AS debit, sum(credit) AS credit, " \
+ "SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code,p.name, sum(debit) AS debit, sum(credit) AS credit, " \
"CASE WHEN sum(debit) > sum(credit) " \
"THEN sum(debit) - sum(credit) " \
"ELSE 0 " \
@@ -254,7 +254,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"JOIN account_move am ON (am.id = l.move_id)" \
"WHERE l.account_id IN %s" \
"AND am.state IN %s" \
- "AND " + self.query + "" ,
+ "AND " + self.query + "",
(tuple(self.account_ids), tuple(move_state)))
temp_res = float(self.cr.fetchone()[0] or 0.0)
return temp_res
@@ -273,7 +273,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"JOIN account_move am ON (am.id = l.move_id)" \
"WHERE l.account_id IN %s" \
"AND am.state IN %s" \
- "AND " + self.query + "" ,
+ "AND " + self.query + "",
(tuple(self.account_ids), tuple(move_state)))
temp_res = float(self.cr.fetchone()[0] or 0.0)
return temp_res
diff --git a/addons/account/report/account_print_overdue.py b/addons/account/report/account_print_overdue.py
index c59dd56a02f..3e1f0b54de1 100644
--- a/addons/account/report/account_print_overdue.py
+++ b/addons/account/report/account_print_overdue.py
@@ -30,11 +30,11 @@ class Overdue(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(Overdue, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
- 'time' : time,
- 'adr_get' : self._adr_get,
- 'getLines' : self._lines_get,
- 'tel_get' : self._tel_get,
- 'message' : self._message,
+ 'time': time,
+ 'adr_get': self._adr_get,
+ 'getLines': self._lines_get,
+ 'tel_get': self._tel_get,
+ 'message': self._message,
})
self.context = context
def _adr_get(self, partner, type):
@@ -47,10 +47,10 @@ class Overdue(report_sxw.rml_parse):
'name': False,
'street': False,
'street2': False,
- 'city' : False,
- 'zip' : False,
+ 'city': False,
+ 'zip': False,
'state_id':False,
- 'country_id' : False,
+ 'country_id': False,
}
if adr_id:
result = res_partner_address.read(self.cr, self.uid, [adr_id], context=self.context.copy())
diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py
index 0c7018ae290..1d3cc629cfa 100644
--- a/addons/account/report/rml_parse.py
+++ b/addons/account/report/rml_parse.py
@@ -34,17 +34,17 @@ class rml_parse(report_sxw.rml_parse):
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
- 'strip_name' : self._strip_name,
- 'explode_name' : self._explode_name,
+ 'strip_name': self._strip_name,
+ 'explode_name': self._explode_name,
})
def comma_me(self,amount):
#print "#" + str(amount) + "#"
if not amount:
amount = 0.0
- if type(amount) is float :
+ if type(amount) is float:
amount = str('%.2f'%amount)
- else :
+ else:
amount = str(amount)
if (amount == '0'):
return ' '
diff --git a/addons/account/sequence.py b/addons/account/sequence.py
index b75e7f3e34e..52c1f5df8c4 100644
--- a/addons/account/sequence.py
+++ b/addons/account/sequence.py
@@ -43,13 +43,13 @@ ir_sequence_fiscalyear()
class ir_sequence(osv.osv):
_inherit = 'ir.sequence'
_columns = {
- 'fiscal_ids' : fields.one2many('account.sequence.fiscalyear',
+ 'fiscal_ids': fields.one2many('account.sequence.fiscalyear',
'sequence_main_id', 'Sequences')
}
def get_id(self, cr, uid, sequence_id, test='id', context=None):
if context is None:
context = {}
- cr.execute('select id from ir_sequence where '
+ cr.execute('select id from ir_sequence where '
+ test + '=%s and active=%s', (sequence_id, True,))
res = cr.dictfetchone()
if res:
diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml
index 4bc3b807d28..0aae9dbe3d0 100644
--- a/addons/account/test/account_report.yml
+++ b/addons/account/test/account_report.yml
@@ -67,6 +67,8 @@
import netsvc, tools, os, time
import datetime
from mx.DateTime import *
+ import warnings
+ warnings.filterwarnings('ignore',".*struct integer overflow masking is deprecated*")
start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
start = DateTime(int(start.year), int(start.month), int(start.day))
res = {}
diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py
index 6a1afc45bcf..5939437ce1d 100644
--- a/addons/account/wizard/account_automatic_reconcile.py
+++ b/addons/account/wizard/account_automatic_reconcile.py
@@ -170,7 +170,7 @@ class account_automatic_reconcile(osv.osv_memory):
"AND reconcile_id IS NULL",
(account_id, partner_id))
line_ids = [id for (id,) in cr.fetchall()]
- if len(line_ids):
+ if line_ids:
reconciled += len(line_ids)
if allow_write_off:
move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py
index 9355691369e..ebc11e1dabf 100644
--- a/addons/account/wizard/account_change_currency.py
+++ b/addons/account/wizard/account_change_currency.py
@@ -71,8 +71,8 @@ class account_change_currency(osv.osv_memory):
if old_rate <= 0:
raise osv.except_osv(_('Error'), _('Current currency is not confirured properly !'))
new_price = (line.price_unit / old_rate ) * rate
- obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price})
- obj_inv.write(cr, uid, [invoice.id], {'currency_id' : new_currency}, context=context)
+ obj_inv_line.write(cr, uid, [line.id], {'price_unit': new_price})
+ obj_inv.write(cr, uid, [invoice.id], {'currency_id': new_currency}, context=context)
return {}
account_change_currency()
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index d6d3b67c10e..e3d115ae30a 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -65,9 +65,9 @@ class account_fiscalyear_close(osv.osv_memory):
context = {}
fy_id = data[0]['fy_id']
- cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)" , (str(data[0]['fy2_id']),))
+ cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)", (str(data[0]['fy2_id']),))
fy_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
- cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)" , (str(fy_id),))
+ cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)", (str(fy_id),))
fy2_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
period = obj_acc_period.browse(cr, uid, data[0]['period_id'], context=context)
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
index c7e75f205f8..29d67859ca5 100644
--- a/addons/account/wizard/account_invoice_refund.py
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -100,7 +100,7 @@ class account_invoice_refund(osv.osv_memory):
raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
if inv.reconciled and mode in ('cancel', 'modify'):
raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode))
- if form['period'] :
+ if form['period']:
period = form['period']
else:
period = inv.period_id and inv.period_id.id or False
@@ -108,9 +108,9 @@ class account_invoice_refund(osv.osv_memory):
if not journal_id:
journal_id = inv.journal_id.id
- if form['date'] :
+ if form['date']:
date = form['date']
- if not form['period'] :
+ if not form['period']:
cr.execute("select name from ir_model_fields \
where model = 'account.period' \
and name = 'company_id'")
@@ -128,7 +128,7 @@ class account_invoice_refund(osv.osv_memory):
period = res[0]
else:
date = inv.date_invoice
- if form['description'] :
+ if form['description']:
description = form['description']
else:
description = inv.name
@@ -147,18 +147,18 @@ class account_invoice_refund(osv.osv_memory):
if mode in ('cancel', 'modify'):
movelines = inv.move_id.line_id
to_reconcile_ids = {}
- for line in movelines :
- if line.account_id.id == inv.account_id.id :
+ for line in movelines:
+ if line.account_id.id == inv.account_id.id:
to_reconcile_ids[line.account_id.id] = [line.id]
- if type(line.reconcile_id) != osv.orm.browse_null :
+ if type(line.reconcile_id) != osv.orm.browse_null:
reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
wf_service.trg_validate(uid, 'account.invoice', \
refund.id, 'invoice_open', cr)
refund = inv_obj.browse(cr, uid, refund_id[0], context=context)
- for tmpline in refund.move_id.line_id :
- if tmpline.account_id.id == inv.account_id.id :
+ for tmpline in refund.move_id.line_id:
+ if tmpline.account_id.id == inv.account_id.id:
to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
- for account in to_reconcile_ids :
+ for account in to_reconcile_ids:
account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
writeoff_period_id=period,
writeoff_journal_id = inv.journal_id.id,
@@ -214,7 +214,7 @@ class account_invoice_refund(osv.osv_memory):
return result
def invoice_refund(self, cr, uid, ids, context=None):
- data_refund = self.read(cr, uid, ids, [] ,context=context)[0]['filter_refund']
+ data_refund = self.read(cr, uid, ids, [],context=context)[0]['filter_refund']
return self.compute_refund(cr, uid, ids, data_refund, context=context)
account_invoice_refund()
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
index c03176a0536..02cd614ee5d 100644
--- a/addons/account/wizard/account_move_journal.py
+++ b/addons/account/wizard/account_move_journal.py
@@ -33,7 +33,7 @@ class account_move_journal(osv.osv_memory):
"""
ids = self.pool.get('account.period').find(cr, uid, context=context)
period_id = False
- if len(ids):
+ if ids:
period_id = ids[0]
return period_id
@@ -91,9 +91,9 @@ class account_move_journal(osv.osv_memory):
diff --git a/addons/account_payment/__init__.py b/addons/account_payment/__init__.py
index 82a05aa73e9..6188de6a9da 100644
--- a/addons/account_payment/__init__.py
+++ b/addons/account_payment/__init__.py
@@ -29,4 +29,4 @@ import account_move_line
import account_invoice
import report
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py
index be0ca2a127b..7ccafd90eb4 100644
--- a/addons/account_payment/__openerp__.py
+++ b/addons/account_payment/__openerp__.py
@@ -28,9 +28,9 @@
"depends": ["account"],
"init_xml": [],
"description": """
- This module provides :
- * a more efficient way to manage invoice payment.
- * a basic mechanism to easily plug various automated payment.
+This module provides :
+* a more efficient way to manage invoice payment.
+* a basic mechanism to easily plug various automated payment.
""",
'author': 'OpenERP SA',
'depends': ['account_voucher'],
diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py
index 3f9b6c4b094..2b9ea22d824 100644
--- a/addons/account_payment/account_move_line.py
+++ b/addons/account_payment/account_move_line.py
@@ -47,7 +47,7 @@ class account_move_line(osv.osv):
return r
def _to_pay_search(self, cr, uid, obj, name, args, context):
- if not len(args):
+ if not args:
return []
line_obj = self.pool.get('account.move.line')
query = line_obj._query_get(cr, uid, context={})
@@ -63,17 +63,17 @@ class account_move_line(osv.osv):
) %(operator)s %%s ''' % {'operator': x[1]}, args))
sql_args = tuple(map(itemgetter(2), args))
- cr.execute(('''select id
- from account_move_line l
- where account_id in (select id
- from account_account
- where type=%s and active)
- and reconcile_id is null
- and credit > 0
- and ''' + where + ' and ' + query), ('payable',)+sql_args )
+ cr.execute(('''SELECT id
+ FROM account_move_line l
+ WHERE account_id IN (select id
+ FROM account_account
+ WHERE type=%s AND active)
+ AND reconcile_id IS null
+ AND credit > 0
+ AND ''' + where + ' and ' + query), ('payable',)+sql_args )
res = cr.fetchall()
- if not len(res):
+ if not res:
return [('id','=','0')]
return [('id','in',map(lambda x:x[0], res))]
@@ -110,7 +110,7 @@ class account_move_line(osv.osv):
return line2bank
_columns = {
- 'amount_to_pay' : fields.function(amount_to_pay, method=True,
+ 'amount_to_pay': fields.function(amount_to_pay, method=True,
type='float', string='Amount to pay', fnct_search=_to_pay_search),
}
diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py
index 1c0596ddf96..a70e8fb75c3 100644
--- a/addons/account_payment/account_payment.py
+++ b/addons/account_payment/account_payment.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
import time
from osv import osv, fields
@@ -118,11 +119,10 @@ class payment_order(osv.osv):
self.write(cr, uid, order['id'],{'reference':reference})
return True
- def set_done(self, cr, uid, id, *args):
- self.write(cr,uid,id,{'date_done': time.strftime('%Y-%m-%d'),
- 'state': 'done',})
+ def set_done(self, cr, uid, ids, *args):
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'payment.order', id, 'done', cr)
+ self.write(cr, uid, ids, {'date_done': time.strftime('%Y-%m-%d')})
+ wf_service.trg_validate(uid, 'payment.order', ids[0], 'done', cr)
return True
def copy(self, cr, uid, id, default={}, context=None):
@@ -162,7 +162,6 @@ class payment_line(osv.osv):
_name = 'payment.line'
_description = 'Payment Line'
-
def translate(self, orig):
return {
"due_date": "date_maturity",
@@ -330,14 +329,14 @@ class payment_line(osv.osv):
'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text", help='Address of the Main Partner'),
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'),
'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"),
- 'create_date': fields.datetime('Created' , readonly=True),
+ 'create_date': fields.datetime('Created', readonly=True),
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True),
'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line')
}
_defaults = {
'name': lambda obj, cursor, user, context: obj.pool.get('ir.sequence'
).get(cursor, user, 'payment.line'),
- 'state': lambda *args: 'normal',
+ 'state': 'normal',
'currency': _get_currency,
'company_currency': _get_currency,
'date': _get_date,
@@ -438,5 +437,4 @@ class payment_line(osv.osv):
payment_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_payment/account_payment_view.xml b/addons/account_payment/account_payment_view.xml
index e9238ec62f9..915da5c0f27 100644
--- a/addons/account_payment/account_payment_view.xml
+++ b/addons/account_payment/account_payment_view.xml
@@ -40,6 +40,23 @@
+
+ payment.mode.search
+ payment.mode
+ search
+
+
+
+
+
payment.mode.tree
payment.mode
@@ -52,6 +69,7 @@
+
payment.mode.form
payment.mode
@@ -69,7 +87,8 @@
Payment Mode
payment.mode
form
- tree,form
+ tree,form,search
+
@@ -142,7 +161,7 @@
-
+
@@ -165,7 +184,7 @@
-
+
@@ -241,7 +260,6 @@
-
diff --git a/addons/account_payment/account_payment_workflow.xml b/addons/account_payment/account_payment_workflow.xml
index dd7aa2d4933..06ba7b83f70 100644
--- a/addons/account_payment/account_payment_workflow.xml
+++ b/addons/account_payment/account_payment_workflow.xml
@@ -24,6 +24,8 @@ write({'state':'open'})
done
+ write({'state':'done'})
+ function
True
@@ -33,14 +35,14 @@ write({'state':'open'})
function
True
-
+
open
-
+
@@ -56,6 +58,6 @@ write({'state':'open'})
cancel
-
+
diff --git a/addons/account_payment/report/__init__.py b/addons/account_payment/report/__init__.py
index 5a5c1dab1f2..e9d7f4013ac 100644
--- a/addons/account_payment/report/__init__.py
+++ b/addons/account_payment/report/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,9 +15,9 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
import payment_order
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py
index a00c7a7871b..e0b0713c614 100644
--- a/addons/account_payment/report/payment_order.py
+++ b/addons/account_payment/report/payment_order.py
@@ -31,11 +31,11 @@ class payment_order(report_sxw.rml_parse):
self.localcontext.update( {
'time': time,
'get_invoice_name': self._get_invoice_name,
- 'get_company_currency' : self._get_company_currency,
- 'get_company_currency_symbol': self._get_company_currency_symbol,
- 'get_amount_total_in_currency' : self._get_amount_total_in_currency,
- 'get_amount_total' : self._get_amount_total,
- 'get_account_name' : self._get_account_name,
+ 'get_company_currency': self._get_company_currency,
+ 'get_company_currency_symbol': self._get_company_currency_symbol,
+ 'get_amount_total_in_currency': self._get_amount_total_in_currency,
+ 'get_amount_total': self._get_amount_total,
+ 'get_account_name': self._get_account_name,
})
def _get_invoice_name(self, invoice_id):
@@ -87,4 +87,4 @@ class payment_order(report_sxw.rml_parse):
report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order, header="external")
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py
index 97a66e937ca..4a070f05a27 100644
--- a/addons/account_payment/wizard/account_payment_order.py
+++ b/addons/account_payment/wizard/account_payment_order.py
@@ -28,7 +28,7 @@ class payment_order_create(osv.osv_memory):
Create a payment object with lines corresponding to the account move line
to pay according to the date and the mode provided by the user.
Hypothesis:
- - Small number of non-reconcilied move line , payment mode and bank account type,
+ - Small number of non-reconcilied move line, payment mode and bank account type,
- Big number of partner and bank account.
If a type is given, unsuitable account Entry lines are ignored.
diff --git a/addons/account_payment/wizard/account_payment_pay.py b/addons/account_payment/wizard/account_payment_pay.py
index 49858151670..09ea68e7d30 100644
--- a/addons/account_payment/wizard/account_payment_pay.py
+++ b/addons/account_payment/wizard/account_payment_pay.py
@@ -21,8 +21,8 @@
from osv import fields, osv
class account_payment_make_payment(osv.osv_memory):
- _name = 'account.payment.make.payment'
- _description = 'Account make payment'
+ _name = "account.payment.make.payment"
+ _description = "Account make payment"
def launch_wizard(self, cr, uid, ids, context=None):
"""
@@ -33,10 +33,10 @@ class account_payment_make_payment(osv.osv_memory):
# obj_model = self.pool.get('ir.model.data')
# obj_act = self.pool.get('ir.actions.act_window')
# order = obj_payment_order.browse(cr, uid, context['active_id'], context)
- obj_payment_order.set_done(cr, uid, context['active_id'], context)
+ obj_payment_order.set_done(cr, uid, [context['active_id']], context)
return {}
# t = order.mode and order.mode.type.code or 'manual'
-# if t == 'manual' :
+# if t == 'manual':
# obj_payment_order.set_done(cr,uid,context['active_id'],context)
# return {}
#
diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py
index 53c9f14b6e8..7697d4eea6d 100644
--- a/addons/account_payment/wizard/account_payment_populate_statement.py
+++ b/addons/account_payment/wizard/account_payment_populate_statement.py
@@ -77,13 +77,13 @@ class account_payment_populate_statement(osv.osv_memory):
if line.partner_id:
# line['partner_id'] = mv.partner_id.id
- if amount < 0 :
+ if amount < 0:
account = line.partner_id.property_account_payable.id
- else :
+ else:
account = line.partner_id.property_account_receivable.id
if line.move_line_id:
- voucher_res = { 'type': 'payment' ,
+ voucher_res = { 'type': 'payment',
'name': line.name,
'partner_id': line.partner_id.id,
'journal_id': statement.journal_id.id,
diff --git a/addons/account_report/account.py b/addons/account_report/account.py
index 6e5fbc94026..d95306403a6 100644
--- a/addons/account_report/account.py
+++ b/addons/account_report/account.py
@@ -32,18 +32,18 @@ class account_report(osv.osv):
_description = "Account Reporting"
def _amount_get(self, cr, uid, ids, field_name, arg, context={}):
- obj_fy=self.pool.get('account.fiscalyear')
- obj_period=self.pool.get('account.period')
+ obj_fy = self.pool.get('account.fiscalyear')
+ obj_period = self.pool.get('account.period')
- def _calc_context(key,obj):
- if key==0:
+ def _calc_context(key, obj):
+ if key == 0:
return obj.find(cr, uid, exception=False)
else:
- obj_key=obj.browse(cr, uid, obj.find(cr, uid, exception=False))
- if isinstance(obj_key,list):
- obj_key=obj_key[0]
- key_ids=obj.search(cr,uid,[('date_stop','<',obj_key.date_start)])
- if len(key_ids)=',date)])
+ pids = period_pool.search(cr, user, [('date_start', '<=', date), ('date_stop', '>=', date)])
if not pids:
return {}
return {
@@ -685,13 +688,13 @@ class account_voucher(osv.osv):
if not self.pool.get('res.currency').is_zero(cr, uid, inv.currency_id, line_total):
diff = line_total
move_line = {
- 'name':name,
- 'account_id':False,
- 'move_id':move_id ,
- 'partner_id':inv.partner_id.id,
- 'date':inv.date,
- 'credit':diff>0 and diff or 0.0,
- 'debit':diff<0 and -diff or 0.0,
+ 'name': name,
+ 'account_id': False,
+ 'move_id': move_id ,
+ 'partner_id': inv.partner_id.id,
+ 'date': inv.date,
+ 'credit': diff > 0 and diff or 0.0,
+ 'debit': diff < 0 and -diff or 0.0,
}
account_id = False
if inv.type in ('sale', 'receipt'):
@@ -792,10 +795,10 @@ class account_voucher_line(osv.osv):
if move_line_id:
move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
if move_line.credit:
- ttype='dr'
+ ttype = 'dr'
amount = move_line.credit
else:
- ttype='cr'
+ ttype = 'cr'
account_id = move_line.account_id.id
res.update({
'account_id':account_id,
@@ -909,4 +912,4 @@ class account_bank_statement_line(osv.osv):
self.pool.get('account.voucher').unlink(cr, uid, unlink_ids, context=context)
return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
-account_bank_statement_line()
+account_bank_statement_line()
\ No newline at end of file
diff --git a/addons/account_voucher/report/account_voucher.py b/addons/account_voucher/report/account_voucher.py
index 7655f294bf9..c37d921ecbc 100644
--- a/addons/account_voucher/report/account_voucher.py
+++ b/addons/account_voucher/report/account_voucher.py
@@ -36,7 +36,7 @@ class report_voucher(report_sxw.rml_parse):
})
def convert(self, amount, cur):
- amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
return amt_en
def get_title(self, type):
@@ -48,17 +48,17 @@ class report_voucher(report_sxw.rml_parse):
def debit(self, move_ids):
debit = 0.0
for move in move_ids:
- debit +=move.debit
+ debit += move.debit
return debit
def credit(self, move_ids):
credit = 0.0
for move in move_ids:
- credit +=move.credit
+ credit += move.credit
return credit
def _get_ref(self, voucher_id, move_ids):
- voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)])
+ voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)])
if voucher_line:
voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0]
return voucher.name
@@ -69,4 +69,4 @@ report_sxw.report_sxw(
'account.voucher',
'addons/account_voucher/report/account_voucher.rml',
parser=report_voucher,header="external"
-)
+)
\ No newline at end of file
diff --git a/addons/account_voucher/report/account_voucher_print.py b/addons/account_voucher/report/account_voucher_print.py
index 0da644c6e4f..d39b77d8374 100644
--- a/addons/account_voucher/report/account_voucher_print.py
+++ b/addons/account_voucher/report/account_voucher_print.py
@@ -35,10 +35,10 @@ class report_voucher_print(report_sxw.rml_parse):
})
def convert(self, amount, cur):
- amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
return amt_en
- def get_lines(self,voucher):
+ def get_lines(self, voucher):
result = []
if voucher.type in ('payment','receipt'):
type = voucher.line_ids and voucher.line_ids[0].type or False
diff --git a/addons/account_voucher/report/rml_parse.py b/addons/account_voucher/report/rml_parse.py
index e23d8c52947..d59a5f0551a 100644
--- a/addons/account_voucher/report/rml_parse.py
+++ b/addons/account_voucher/report/rml_parse.py
@@ -20,15 +20,9 @@
##############################################################################
from report import report_sxw
-import xml.dom.minidom
-import os, time
-import osv
-import re
-import tools
-import pooler
-import re
-import sys
+from datetime import datetime
+import re
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -40,7 +34,7 @@ class rml_parse(report_sxw.rml_parse):
'explode_name' : self._explode_name,
})
- def comma_me(self,amount):
+ def comma_me(self, amount):
if not amount:
amount = 0.0
if type(amount) is float :
@@ -48,7 +42,7 @@ class rml_parse(report_sxw.rml_parse):
else :
amount = str(amount)
if (amount == '0'):
- return ' '
+ return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
@@ -60,19 +54,19 @@ class rml_parse(report_sxw.rml_parse):
ellipsis = ellipsis or ''
try:
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
- except Exception, e:
+ except:
return False
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, '...')
- def _get_and_change_date_format_for_swiss (self,date_to_format):
- date_formatted=''
+ def _get_and_change_date_format_for_swiss (self, date_to_format):
+ date_formatted = ''
if date_to_format:
- date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
+ date_formatted = datetime.strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
return date_formatted
- def _explode_name(self,chaine,length):
+ def _explode_name(self, chaine, length):
# We will test if the size is less then account
full_string = ''
if (len(str(chaine)) <= length):
@@ -92,7 +86,7 @@ class rml_parse(report_sxw.rml_parse):
return full_string
- def makeAscii(self,str):
+ def makeAscii(self, str):
try:
Stringer = str.encode("utf-8")
except UnicodeDecodeError:
@@ -106,7 +100,7 @@ class rml_parse(report_sxw.rml_parse):
return Stringer
return Stringer
- def explode_this(self,chaine,length):
+ def explode_this(self, chaine, length):
chaine = rstrip(chaine)
ast = list(chaine)
i = length
@@ -116,7 +110,7 @@ class rml_parse(report_sxw.rml_parse):
chaine = str("".join(ast))
return chaine
- def repair_string(self,chaine):
+ def repair_string(self, chaine):
ast = list(chaine)
UnicodeAst = []
_previouslyfound = False
@@ -135,7 +129,7 @@ class rml_parse(report_sxw.rml_parse):
i += i + 1
return "".join(UnicodeAst)
- def ReencodeAscii(self,str):
+ def ReencodeAscii(self, str):
try:
Stringer = str.decode("ascii")
except UnicodeEncodeError:
@@ -146,7 +140,7 @@ class rml_parse(report_sxw.rml_parse):
return Stringer
def _add_header(self, node, header=1):
- if header==2:
+ if header == 2:
rml_head = self.rml_header2
else:
rml_head = self.rml_header
diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py
index 2c5553488d0..16d05f3f62c 100644
--- a/addons/account_voucher/wizard/account_statement_from_invoice.py
+++ b/addons/account_voucher/wizard/account_statement_from_invoice.py
@@ -86,7 +86,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
'period_id':statement.period_id.id}
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
- voucher_line_dict = False
+ voucher_line_dict = {}
if result['value']['line_ids']:
for line_dict in result['value']['line_ids']:
move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context)
@@ -94,7 +94,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
voucher_line_dict = line_dict
if voucher_line_dict:
- voucher_line_dict.update({'voucher_id':voucher_id})
+ voucher_line_dict.update({'voucher_id': voucher_id})
voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
if line.journal_id.type == 'sale':
type = 'customer'
@@ -147,11 +147,11 @@ class account_statement_from_invoice(osv.osv_memory):
# Creating a group that is unique for importing move lines(move lines, once imported into statement lines, should not appear again)
for st_line in statement.line_ids:
args_move_line = []
- args_move_line.append(('name','=', st_line.name))
- args_move_line.append(('ref','=',st_line.ref))
+ args_move_line.append(('name', '=', st_line.name))
+ args_move_line.append(('ref', '=', st_line.ref))
if st_line.partner_id:
- args_move_line.append(('partner_id','=',st_line.partner_id.id))
- args_move_line.append(('account_id','=',st_line.account_id.id))
+ args_move_line.append(('partner_id', '=', st_line.partner_id.id))
+ args_move_line.append(('account_id', '=', st_line.account_id.id))
move_line_id = line_obj.search(cr, uid, args_move_line, context=context)
if move_line_id:
@@ -159,7 +159,7 @@ class account_statement_from_invoice(osv.osv_memory):
journal_ids = data['journal_ids']
if journal_ids == []:
- journal_ids = journal_obj.search(cr, uid, [('type', 'in', ('sale','cash','purchase'))], context=context)
+ journal_ids = journal_obj.search(cr, uid, [('type', 'in', ('sale', 'cash', 'purchase'))], context=context)
args = [
('reconcile_id', '=', False),
@@ -167,12 +167,12 @@ class account_statement_from_invoice(osv.osv_memory):
('account_id.reconcile', '=', True)]
if repeated_move_line_ids:
- args.append(('id','not in',repeated_move_line_ids))
+ args.append(('id', 'not in', repeated_move_line_ids))
line_ids = line_obj.search(cr, uid, args,
context=context)
- model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice_lines')], context=context)
+ model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_account_statement_from_invoice_lines')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'domain': "[('id','in', ["+','.join([str(x) for x in line_ids])+"])]",
@@ -187,4 +187,4 @@ class account_statement_from_invoice(osv.osv_memory):
}
account_statement_from_invoice()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_voucher/wizard/account_voucher_unreconcile.py b/addons/account_voucher/wizard/account_voucher_unreconcile.py
index 30cda8958d5..71b4fbc8fb5 100644
--- a/addons/account_voucher/wizard/account_voucher_unreconcile.py
+++ b/addons/account_voucher/wizard/account_voucher_unreconcile.py
@@ -19,7 +19,6 @@
#
##############################################################################
-import netsvc
from osv import osv
from osv import fields
@@ -32,11 +31,11 @@ class account_voucher_unreconcile(osv.osv_memory):
}
_defaults = {
- 'remove': lambda *a: True,
+ 'remove': True,
}
def trans_unrec(self, cr, uid, ids, context=None):
- res = self.browse(cr, uid, ids[0])
+# res = self.browse(cr, uid, ids[0])
if context is None:
context = {}
voucher_pool = self.pool.get('account.voucher')
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 66c74a72bc9..5f68cf98c1a 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -156,7 +156,7 @@ class account_analytic_account(osv.osv):
return dict([(i, res[i]) for i in ids])
def name_get(self, cr, uid, ids, context=None):
- if not len(ids):
+ if not ids:
return []
res = []
for account in self.browse(cr, uid, ids, context=context):
@@ -174,7 +174,7 @@ class account_analytic_account(osv.osv):
return dict(res)
_columns = {
- 'name' : fields.char('Account Name', size=128, required=True),
+ 'name': fields.char('Account Name', size=128, required=True),
'complete_name': fields.function(_complete_name_calc, method=True, type='char', string='Full Account Name'),
'code': fields.char('Account Code', size=24),
'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type', help='If you select the View Type, it means you won\'t allow to create journal entries using that account.'),
@@ -182,14 +182,14 @@ class account_analytic_account(osv.osv):
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'),
- 'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance'),
- 'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit'),
- 'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit'),
+ 'balance': fields.function(_balance_calc, method=True, type='float', string='Balance'),
+ 'debit': fields.function(_debit_calc, method=True, type='float', string='Debit'),
+ 'credit': fields.function(_credit_calc, method=True, type='float', string='Credit'),
'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity'),
'quantity_max': fields.float('Maximum Quantity', help='Sets the higher limit of quantity of hours.'),
- 'partner_id' : fields.many2one('res.partner', 'Associated Partner'),
- 'contact_id' : fields.many2one('res.partner.address', 'Contact'),
- 'user_id' : fields.many2one('res.users', 'Account Manager'),
+ 'partner_id': fields.many2one('res.partner', 'Associated Partner'),
+ 'contact_id': fields.many2one('res.partner.address', 'Contact'),
+ 'user_id': fields.many2one('res.users', 'Account Manager'),
'date_start': fields.date('Date Start'),
'date': fields.date('Date End'),
'company_id': fields.many2one('res.company', 'Company', required=True),
@@ -210,10 +210,10 @@ class account_analytic_account(osv.osv):
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
_defaults = {
- 'type' : 'normal',
+ 'type': 'normal',
'company_id': _default_company,
- 'state' : 'open',
- 'user_id' : lambda self, cr, uid, ctx : uid,
+ 'state': 'open',
+ 'user_id': lambda self, cr, uid, ctx: uid,
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
'date_start': time.strftime('%Y-%m-%d')
@@ -244,7 +244,7 @@ class account_analytic_account(osv.osv):
partner = parent['partner_id'][0]
else:
partner = False
- res = {'value' : {}}
+ res = {'value': {}}
if partner:
res['value']['partner_id'] = partner
return res
@@ -271,19 +271,19 @@ class account_analytic_line(osv.osv):
_description = 'Analytic Line'
_columns = {
- 'name' : fields.char('Description', size=256, required=True),
- 'date' : fields.date('Date', required=True, select=1),
- 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
- 'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'),
- 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
- 'user_id' : fields.many2one('res.users', 'User'),
+ 'name': fields.char('Description', size=256, required=True),
+ 'date': fields.date('Date', required=True, select=1),
+ 'amount': fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
+ 'unit_amount': fields.float('Quantity', help='Specifies the amount of quantity to count.'),
+ 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
+ 'user_id': fields.many2one('res.users', 'User'),
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
- 'amount' : 0.00
+ 'amount': 0.00
}
_order = 'date desc'
diff --git a/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py b/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py
index 609d1cad7d9..5718a9fdaa7 100644
--- a/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py
+++ b/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -38,7 +38,7 @@ class account_analytic_account(osv.osv):
_inherit = "account.analytic.account"
_columns = {
- 'journal_rate_ids' : fields.one2many('analytic_journal_rate_grid', 'account_id', 'Invoicing Rate per Journal'),
+ 'journal_rate_ids': fields.one2many('analytic_journal_rate_grid', 'account_id', 'Invoicing Rate per Journal'),
}
account_analytic_account()
@@ -92,7 +92,7 @@ class hr_analytic_timesheet(osv.osv):
if to_invoice:
res.setdefault('value',{})
res['value']['to_invoice'] = to_invoice[0]
-
+
return res
hr_analytic_timesheet()
diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py
index 21fe0a7da29..04f66fb8daa 100644
--- a/addons/analytic_user_function/analytic_user_function.py
+++ b/addons/analytic_user_function/analytic_user_function.py
@@ -40,7 +40,7 @@ class account_analytic_account(osv.osv):
_inherit = "account.analytic.account"
_columns = {
- 'user_product_ids' : fields.one2many('analytic_user_funct_grid', 'account_id', 'Users/Products Rel.'),
+ 'user_product_ids': fields.one2many('analytic_user_funct_grid', 'account_id', 'Users/Products Rel.'),
}
account_analytic_account()
diff --git a/addons/crm/board_crm_view.xml b/addons/crm/board_crm_view.xml
index c299741280a..1f4853b4446 100644
--- a/addons/crm/board_crm_view.xml
+++ b/addons/crm/board_crm_view.xml
@@ -158,6 +158,5 @@
action="open_board_crm"
sequence="1"
id="menu_board_crm" icon="terp-graph"/>
-
-
\ No newline at end of file
+
diff --git a/addons/event/event.py b/addons/event/event.py
index 6682a703ea5..5c510ede613 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -88,10 +88,10 @@ class event_event(osv.osv):
#send reminder that will confirm the event for all the people that were already confirmed
reg_ids = register_pool.search(cr, uid, [
('event_id', '=', event.id),
- ('state', 'not in', ['draft', 'cancel'])])
+ ('state', 'not in', ['draft', 'cancel'])], context=context)
register_pool.mail_user_confirm(cr, uid, reg_ids)
- return self.write(cr, uid, ids, {'state': 'confirm'})
+ return self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
def button_confirm(self, cr, uid, ids, context=None):
"""This Function Confirm Event.
@@ -114,7 +114,7 @@ class event_event(osv.osv):
unconfirmed_ids.append(event.id)
if unconfirmed_ids:
view_id = data_pool._get_id(cr, uid, 'event', 'view_event_confirm')
- view_data = data_pool.browse(cr, uid, view_id)
+ view_data = data_pool.browse(cr, uid, view_id, context=context)
view_id = view_data.res_id
context['event_ids'] = unconfirmed_ids
return {
@@ -141,7 +141,7 @@ class event_event(osv.osv):
"""
register_pool = self.pool.get('event.registration')
res = {}
- for event in self.browse(cr, uid, ids, context):
+ for event in self.browse(cr, uid, ids, context=context):
res[event.id] = {}
for field in fields:
res[event.id][field] = False
@@ -153,12 +153,17 @@ class event_event(osv.osv):
reg_ids = register_pool.search(cr, uid, [
('event_id', '=', event.id),
- ('state', 'in', state)])
+ ('state', 'in', state)], context=context)
+
+ number = 0.0
+ if reg_ids:
+ cr.execute('SELECT SUM(nb_register) FROM event_registration WHERE id IN %s', (tuple(reg_ids),))
+ number = cr.fetchone()
if 'register_current' in fields:
- res[event.id]['register_current'] = len(reg_ids)
+ res[event.id]['register_current'] = number and number[0] or 0.0
if 'register_prospect' in fields:
- res[event.id]['register_prospect'] = len(reg_ids)
+ res[event.id]['register_prospect'] = number and number[0] or 0.0
return res
@@ -189,8 +194,8 @@ class event_event(osv.osv):
register_values['description'] = vals['mail_confirm']
if register_values:
- reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)])
- register_pool.write(cr, uid, reg_ids, register_values)
+ reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)], context=context)
+ register_pool.write(cr, uid, reg_ids, register_values, context=context)
return res
_columns = {
@@ -226,15 +231,14 @@ class event_event(osv.osv):
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."),
'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to", digits_compute=dp.get_precision('Sale Price')),
'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who are giving speech on event."),
- 'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
+ 'speaker_ids': fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}),
'speaker_confirmed': fields.boolean('Speaker Confirmed', readonly=False, states={'done': [('readonly', True)]}),
'country_id': fields.related('address_id', 'country_id',
type='many2one', relation='res.country', string='Country', readonly=False, states={'done': [('readonly', True)]}),
'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}),
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
- 'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
-
+ 'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
}
_defaults = {
@@ -250,7 +254,7 @@ class event_event(osv.osv):
level = 100
while len(ids):
- cr.execute('select distinct parent_id from event_event where id IN %s', (tuple(ids),))
+ cr.execute('SELECT DISTINCT parent_id FROM event_event WHERE id IN %s', (tuple(ids),))
ids = filter(None, map(lambda x: x[0], cr.fetchall()))
if not level:
return False
@@ -359,7 +363,7 @@ class event_registration(osv.osv):
'comment': "",
'date_invoice': context.get('date_inv', False)
})
- inv_id = inv_pool.create(cr, uid, val_invoice['value'])
+ inv_id = inv_pool.create(cr, uid, val_invoice['value'], context=context)
inv_pool.button_compute(cr, uid, [inv_id])
self.history(cr, uid, [reg], _('Invoiced'))
return inv_id
@@ -460,12 +464,12 @@ class event_registration(osv.osv):
for registration in self.browse(cr, uid, ids, context=context):
total_confirmed = registration.event_id.register_current + registration.nb_register
if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0:
- self.do_open(cr, uid, [registration.id], context)
+ self.do_open(cr, uid, [registration.id], context=context)
else:
unconfirmed_ids.append(registration.id)
if unconfirmed_ids:
view_id = data_pool._get_id(cr, uid, 'event', 'view_event_confirm_registration')
- view_data = data_pool.browse(cr, uid, view_id)
+ view_data = data_pool.browse(cr, uid, view_id, context=context)
view_id = view_data.res_id
context['registration_ids'] = unconfirmed_ids
return {
@@ -493,10 +497,10 @@ class event_registration(osv.osv):
if registration.tobe_invoiced and not registration.invoice_id:
unclosed_ids.append(registration.id)
else:
- self.do_close(cr, uid, [registration.id])
+ self.do_close(cr, uid, [registration.id], context=context)
if unclosed_ids:
view_id = data_pool._get_id(cr, uid, 'event', 'view_event_make_invoice')
- view_data = data_pool.browse(cr, uid, view_id)
+ view_data = data_pool.browse(cr, uid, view_id, context=context)
view_id = view_data.res_id
context['active_ids'] = unclosed_ids
return {
@@ -552,10 +556,10 @@ class event_registration(osv.osv):
body = regestration.event_id.mail_confirm
if subject or body:
tools.email_send(src, email_to, subject, body, email_cc = email_cc, openobject_id = regestration.id)
- self.history(cr, uid, [regestration], subject, history=True, \
- email=email_to, details=body, \
- subject=subject, email_from=src, \
- email_cc=', '.join(email_cc))
+ self.history(cr, uid, [regestration], subject, history = True, \
+ email = email_to, details = body, \
+ subject = subject, email_from = src, \
+ email_cc = ', '.join(email_cc))
return True
@@ -612,12 +616,17 @@ class event_registration(osv.osv):
res_obj = self.pool.get('res.partner')
data_event = event_obj.browse(cr, uid, event_id)
- res = {'value': {'unit_price': False, 'event_product': False, 'user_id': False,
- 'date': data_event.date_begin, 'date_deadline': data_event.date_end, 'description': data_event.note, 'name': data_event.name,
- 'section_id': data_event.section_id and data_event.section_id.id or False,
+ res = {'value': {'unit_price': False,
+ 'event_product': False,
+ 'user_id': False,
+ 'date': data_event.date_begin,
+ 'date_deadline': data_event.date_end,
+ 'description': data_event.note,
+ 'name': data_event.name,
+ 'section_id': data_event.section_id and data_event.section_id.id or False,
}}
if data_event.user_id.id:
- res['value'].update({'user_id':data_event.user_id.id})
+ res['value'].update({'user_id': data_event.user_id.id})
if data_event.product_id:
pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False
if partner_invoice_id:
@@ -645,7 +654,7 @@ class event_registration(osv.osv):
data['contact_id'], data['partner_invoice_id'], data['email_from'] = (False, False, False)
if not part:
return {'value': data}
- data['partner_invoice_id']=part
+ data['partner_invoice_id'] = part
# this calls onchange_partner_invoice_id
d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part)
# this updates the dictionary
@@ -670,8 +679,8 @@ class event_registration(osv.osv):
@param event_id: Event ID
@param partner_invoice_id: Partner Invoice ID
"""
- data={}
- context={}
+ data = {}
+ context = {}
event_obj = self.pool.get('event.event')
prod_obj = self.pool.get('product.product')
res_obj = self.pool.get('res.partner')
@@ -679,7 +688,7 @@ class event_registration(osv.osv):
data['unit_price']=False
if not event_id:
return {'value': data}
- data_event = event_obj.browse(cr, uid, event_id)
+ data_event = event_obj.browse(cr, uid, event_id, context=context)
if data_event.product_id:
data['event_product'] = data_event.product_id.name
pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False
diff --git a/addons/event/report/report_event_registration.py b/addons/event/report/report_event_registration.py
index f74b7d31567..1aa0af9ee2b 100644
--- a/addons/event/report/report_event_registration.py
+++ b/addons/event/report/report_event_registration.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -23,7 +23,7 @@ from osv import fields, osv
import tools
class report_event_registration(osv.osv):
-
+
_name = "report.event.registration"
_description = "Events on registrations and Events on type"
_auto = False
@@ -31,19 +31,19 @@ class report_event_registration(osv.osv):
_columns = {
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
- 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
+ 'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
- 'day': fields.char('Day', size=128, readonly=True),
- 'event_id': fields.many2one('event.event', 'Event Related', required=True),
- 'draft_state': fields.integer(' # No of draft Registration.', size=20),
- 'confirm_state': fields.integer(' # No of Confirm Registration', size=20),
- 'register_max': fields.integer('Maximum Registrations'),
- 'nbevent': fields.integer('Number Of Events'),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'event_id': fields.many2one('event.event', 'Event Related', required=True),
+ 'draft_state': fields.integer(' # No of draft Registration.', size=20),
+ 'confirm_state': fields.integer(' # No of Confirm Registration', size=20),
+ 'register_max': fields.integer('Maximum Registrations'),
+ 'nbevent': fields.integer('Number Of Events'),
'type': fields.many2one('event.type', 'Event Type'),
'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True),
- 'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
- 'speaker_id':fields.many2one('res.partner', 'Speaker', readonly=True),
+ 'user_id': fields.many2one('res.users', 'Responsible', readonly=True),
+ 'speaker_id': fields.many2one('res.partner', 'Speaker', readonly=True),
}
_order = 'date desc'
def init(self, cr):
@@ -53,32 +53,32 @@ class report_event_registration(osv.osv):
"""
tools.drop_view_if_exists(cr, 'report_event_registration')
cr.execute("""
- create or replace view report_event_registration as (
- select
- e.id as id,
- c.event_id as event_id,
- e.date_begin as date,
- e.user_id as user_id,
- e.main_speaker_id as speaker_id,
- to_char(e.date_begin, 'YYYY') as year,
- to_char(e.date_begin, 'MM') as month,
- to_char(e.date_begin, 'YYYY-MM-DD') as day,
- count(t.id) as nbevent,
- t.id as type,
- (SELECT sum(c.nb_register) FROM event_registration c WHERE c.event_id=e.id and t.id=e.type and state in ('draft')) as draft_state,
- (SELECT sum(c.nb_register) FROM event_registration c WHERE c.event_id=e.id and t.id=e.type and state in ('open')) as confirm_state,
- e.register_max as register_max,
- e.state as state
- from
+ CREATE OR REPLACE view report_event_registration AS (
+ SELECT
+ e.id AS id,
+ c.event_id AS event_id,
+ e.date_begin AS date,
+ e.user_id AS user_id,
+ e.main_speaker_id AS speaker_id,
+ to_char(e.date_begin, 'YYYY') AS year,
+ to_char(e.date_begin, 'MM') AS month,
+ to_char(e.date_begin, 'YYYY-MM-DD') AS day,
+ count(t.id) AS nbevent,
+ t.id AS type,
+ (SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND state IN ('draft')) AS draft_state,
+ (SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND state IN ('open')) AS confirm_state,
+ e.register_max AS register_max,
+ e.state AS state
+ FROM
event_event e
- inner join
- event_registration c on (e.id=c.event_id)
- inner join
- event_type t on (e.type=t.id)
- group by
+ INNER JOIN
+ event_registration c ON (e.id=c.event_id)
+ INNER JOIN
+ event_type t ON (e.type=t.id)
+ GROUP BY
to_char(e.date_begin, 'YYYY'),
to_char(e.date_begin, 'MM'),
- t.id, e.id, e.date_begin,e.main_speaker_id,
+ t.id, e.id, e.date_begin, e.main_speaker_id,
e.register_max, e.type, e.state, c.event_id, e.user_id,
to_char(e.date_begin, 'YYYY-MM-DD')
)""")
diff --git a/addons/event/wizard/event_confirm_registration.py b/addons/event/wizard/event_confirm_registration.py
index 92f94474cb8..7b6cd7ee3f3 100644
--- a/addons/event/wizard/event_confirm_registration.py
+++ b/addons/event/wizard/event_confirm_registration.py
@@ -40,6 +40,8 @@ class event_confirm_registration(osv.osv_memory):
"""
This function gets default values
"""
+ if context is None:
+ context = {}
registration_pool = self.pool.get('event.registration')
registration_ids = context.get('registration_ids', [])
res = super(event_confirm_registration, self).default_get(cr, uid, fields, context=context)
@@ -56,7 +58,9 @@ class event_confirm_registration(osv.osv_memory):
res.update({'msg': msg})
return res
- def confirm(self, cr, uid, ids, context):
+ def confirm(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
registration_pool = self.pool.get('event.registration')
registration_ids = context.get('registration_ids', [])
registration_pool.do_open(cr, uid, registration_ids, context=context)
diff --git a/addons/event/wizard/event_make_invoice.py b/addons/event/wizard/event_make_invoice.py
index 12ad2cf0d68..f22db18a78a 100644
--- a/addons/event/wizard/event_make_invoice.py
+++ b/addons/event/wizard/event_make_invoice.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
+
from osv import fields, osv
from tools.translate import _
@@ -29,7 +30,7 @@ class event_make_invoice(osv.osv_memory):
_description = "Event Make Invoice"
_columns = {
'grouped': fields.boolean('Group the invoices'),
- 'invoice_date':fields.date('Invoice Date'),
+ 'invoice_date': fields.date('Invoice Date'),
}
def view_init(self, cr, uid, fields, context=None):
@@ -61,7 +62,7 @@ class event_make_invoice(osv.osv_memory):
_("Registration doesn't have any partner to invoice."))
def default_get(self, cr, uid, fields_list, context=None):
- return super(event_make_invoice, self).default_get(cr, uid, fields_list, context)
+ return super(event_make_invoice, self).default_get(cr, uid, fields_list, context=context)
def make_invoice(self, cr, uid, ids, context=None):
reg_obj = self.pool.get('event.registration')
@@ -70,7 +71,7 @@ class event_make_invoice(osv.osv_memory):
if context is None:
context = {}
- for data in self.browse(cr, uid, ids):
+ for data in self.browse(cr, uid, ids, context=context):
res = reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date)
form_id = mod_obj._get_id(cr, uid, 'account', 'invoice_form')
diff --git a/addons/event/wizard/partner_event_registration.py b/addons/event/wizard/partner_event_registration.py
index 00f106ab8ae..33ed6e60cdb 100644
--- a/addons/event/wizard/partner_event_registration.py
+++ b/addons/event/wizard/partner_event_registration.py
@@ -19,7 +19,6 @@
#
##############################################################################
-import wizard
import netsvc
import tools
from osv import fields, osv
@@ -53,7 +52,6 @@ class partner_event_registration(osv.osv_memory):
value = {}
res_obj = self.pool.get('res.partner')
job_obj = self.pool.get('res.partner.job')
- event_obj = self.pool.get('event.event')
reg_obj = self.pool.get('event.registration')
mod_obj = self.pool.get('ir.model.data')
@@ -62,9 +60,9 @@ class partner_event_registration(osv.osv_memory):
contact_id = False
email = False
if addr.has_key('default'):
- job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])])
+ job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])], context=context)
if job_ids:
- contact = job_obj.browse(cr, uid, job_ids[0])
+ contact = job_obj.browse(cr, uid, job_ids[0], context=context)
if contact:
contact_id = contact.contact_id.id
email = contact.email
@@ -72,14 +70,13 @@ class partner_event_registration(osv.osv_memory):
result = mod_obj._get_id(cr, uid, 'event', 'view_registration_search')
res = mod_obj.read(cr, uid, result, ['res_id'])
- data_obj = self.pool.get('ir.model.data')
# Select the view
- id2 = data_obj._get_id(cr, uid, 'event', 'view_event_registration_form')
- id3 = data_obj._get_id(cr, uid, 'event', 'view_event_registration_tree')
+ id2 = mod_obj._get_id(cr, uid, 'event', 'view_event_registration_form')
+ id3 = mod_obj._get_id(cr, uid, 'event', 'view_event_registration_tree')
if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ id2 = mod_obj.browse(cr, uid, id2, context=context).res_id
if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+ id3 = mod_obj.browse(cr, uid, id3, context=context).res_id
for current in self.browse(cr, uid, ids, context=context):
for partner in res_obj.browse(cr, uid, record_ids, context=context):
@@ -105,7 +102,7 @@ class partner_event_registration(osv.osv_memory):
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
- }
+ }
return value
def name_get(self, cr, uid, ids, context=None):
@@ -118,7 +115,7 @@ class partner_event_registration(osv.osv_memory):
res = []
if not ids:
return res
- reads = self.read(cr, uid, ids, ['event_type', 'event_id'], context)
+ reads = self.read(cr, uid, ids, ['event_type', 'event_id'], context=context)
for record in reads:
event_id = record['event_id'][1]
if record['event_type']:
@@ -135,13 +132,13 @@ class partner_event_registration(osv.osv_memory):
context = {}
partner_id = context.get('active_id', False)
if event_id:
- event = event_obj.browse(cr, uid, event_id)
+ event = event_obj.browse(cr, uid, event_id, context=context)
pricelist_id = event.pricelist_id and event.pricelist_id.id or False
if partner_id:
partner = partner_obj.browse(cr, uid, partner_id, context=context)
pricelist_id = pricelist_id or partner.property_product_pricelist.id
unit_price = product_obj._product_price(cr, uid, [event.product_id.id], False, False, {'pricelist': pricelist_id})[event.product_id.id]
-
+
res['value'] = {
'event_type': event.type and event.type.id or False,
'start_date': event.date_begin,
diff --git a/addons/hr_payroll/report/report_emp_salary_structure.rml b/addons/hr_payroll/report/report_emp_salary_structure.rml
index e5505eb5b02..5f81a0942ae 100644
--- a/addons/hr_payroll/report/report_emp_salary_structure.rml
+++ b/addons/hr_payroll/report/report_emp_salary_structure.rml
@@ -302,7 +302,7 @@
Other No.
- [[ employee.pan_no or '' ]]
+ [[ employee.otherid or '' ]]
Address
@@ -436,6 +436,9 @@
+
+
+
@@ -477,7 +480,13 @@
+
+
+
+
+
+
@@ -490,6 +499,9 @@
+
+
+
@@ -510,6 +522,9 @@
+
+
+
[[repeatIn(employee.line_ids,'line1')]]
@@ -532,6 +547,12 @@
+
+
+
+
+
+
diff --git a/addons/hr_payroll/report/report_employees_detail.py b/addons/hr_payroll/report/report_employees_detail.py
index 5c3eff3370b..efa4c1ee236 100644
--- a/addons/hr_payroll/report/report_employees_detail.py
+++ b/addons/hr_payroll/report/report_employees_detail.py
@@ -48,10 +48,14 @@ class employees_salary_report(rml_parse.rml_parse):
m = datetime.date(cy, cm, 1).strftime('%b')
mnth_name.append(m)
self.mnths.append(str(cm)+'-'+str(cy))
+
if cm == 12:
cm = 0
cy = ly
cm = cm +1
+ for c in range(0,(12-no_months)):
+ mnth_name.append('None')
+ self.mnths.append('None')
return [mnth_name]
def get_employee(self,form):
@@ -134,11 +138,14 @@ class employees_salary_report(rml_parse.rml_parse):
category_name = self.pool.get('hr.allounce.deduction.categoty').read(self.cr, self.uid, [category],['name','type'])[0]
result.append(category_name['name'])
for mnth in self.mnths:
- if len(mnth) != 7:
- mnth = '0' + str(mnth)
- query = "select id from hr_payslip where employee_id = "+str(emp_id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' "
- self.cr.execute(query)
- payslip_id = self.cr.dictfetchone()
+ if mnth <> 'None':
+ if len(mnth) != 7:
+ mnth = '0' + str(mnth)
+ query = "select id from hr_payslip where employee_id = "+str(emp_id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' "
+ self.cr.execute(query)
+ payslip_id = self.cr.dictfetchone()
+ else:
+ payslip_id = False
if payslip_id:
payslip_obj = self.pool.get('hr.payslip').browse(self.cr, self.uid, payslip_id['id'])
if not category:
diff --git a/addons/hr_payroll/report/report_employees_detail.rml b/addons/hr_payroll/report/report_employees_detail.rml
index 9ddad713046..542e370eb34 100644
--- a/addons/hr_payroll/report/report_employees_detail.rml
+++ b/addons/hr_payroll/report/report_employees_detail.rml
@@ -86,19 +86,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -108,20 +122,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -130,20 +144,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -152,20 +166,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -292,7 +306,7 @@
Other No.
- [[ o.pan_no or ' ']]
+ [[ o.otherid or '' ]]
Address
@@ -329,52 +343,55 @@
[[ repeatIn(get_periods(data['form']),'m') ]] [[ get_employee_detail(o) ]]
-
+
Title
- [[ m[0] ]]
+ [[ m[0] != 'None' and m[0] or '' ]]
- [[ m[1] ]]
+ [[ m[1] != 'None' and m[1] or '' ]]
- [[ m[2] ]]
+ [[ m[2] != 'None' and m[2] or '' ]]
- [[ m[3] ]]
+ [[ m[3] != 'None' and m[3] or '' ]]
- [[ m[4] ]]
+ [[ m[4] != 'None' and m[4] or '' ]]
- [[ m[5] ]]
+ [[ m[5] != 'None' and m[5] or '' ]]
- [[ m[6] ]]
+ [[ m[6] != 'None' and m[6] or '' ]]
- [[ m[7] ]]
+ [[ m[7] != 'None' and m[7] or '' ]]
- [[ m[8] ]]
+ [[ m[8] != 'None' and m[8] or '' ]]
- [[ m[9] ]]
+ [[ m[9] != 'None' and m[9] or '' ]]
- [[ m[10] ]]
+ [[ m[10] != 'None' and m[10] or '' ]]
- [[ m[11] ]]
+ [[ m[11] != 'None' and m[11] or '' ]]
Total
+
+
+
@@ -384,8 +401,8 @@
- [[ repeatIn(get_allow(),'e1') ]]
-
+ [[ repeatIn(get_allow(),'e1') ]]
+
[[ e1[0] ]]
@@ -440,9 +457,8 @@
-
- [[ repeatIn(get_deduct(),'e2') ]]
-
+ [[ repeatIn(get_deduct(),'e2') ]]
+
[[ e2[0] ]]
@@ -497,8 +513,8 @@
- [[ repeatIn(get_other(),'e3') ]]
-
+ [[ repeatIn(get_other(),'e3') ]]
+
[[ e3[0] ]]
@@ -546,49 +562,49 @@
-
+
[[ get_monthly_total()[0] ]]
- [[ formatLang(get_monthly_total()[1]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[1]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[2]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[2]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[3]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[3]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[4]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[4]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[5]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[5]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[6]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[6]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[7]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[7]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[8]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[8]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[9]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[9]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[10]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[10]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[11]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[11]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_monthly_total()[12]) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_monthly_total()[12]) ]][[ company.currency_id.symbol ]]
- [[ formatLang(get_total()) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(get_total()) ]][[ company.currency_id.symbol ]]
diff --git a/addons/hr_payroll/report/report_year_report.rml b/addons/hr_payroll/report/report_year_report.rml
index e191b5108f2..212bb59e7b3 100755
--- a/addons/hr_payroll/report/report_year_report.rml
+++ b/addons/hr_payroll/report/report_year_report.rml
@@ -146,58 +146,55 @@
- [[ repeatIn(get_periods(data['form']),'m') ]]
+ [[ repeatIn(get_periods(data['form']),'m') ]]
Name
- [[ m[0] ]]
+ [[ m[0] != 'None' and m[0] or '' ]]
- [[ m[1] ]]
+ [[ m[1] != 'None' and m[1] or '' ]]
- [[ m[2] ]]
+ [[ m[2] != 'None' and m[2] or '' ]]
- [[ m[3] ]]
+ [[ m[3] != 'None' and m[3] or '' ]]
- [[ m[4] ]]
+ [[ m[4] != 'None' and m[4] or '' ]]
- [[ m[5] ]]
+ [[ m[5] != 'None' and m[5] or '' ]]
- [[ m[6] ]]
+ [[ m[6] != 'None' and m[6] or '' ]]
- [[ m[7] ]]
+ [[ m[7] != 'None' and m[7] or '' ]]
- [[ m[8] ]]
+ [[ m[8] != 'None' and m[8] or '' ]]
- [[ m[9] ]]
+ [[ m[9] != 'None' and m[9] or '' ]]
- [[ m[10] ]]
+ [[ m[10] != 'None' and m[10] or '' ]]
- [[ m[11] ]]
+ [[ m[11] != 'None' and m[11] or '' ]]
Total
-
-
-
- [[ repeatIn(get_employee(data['form']),'e') ]]
+ [[ repeatIn(get_employee(data['form']),'e') ]]
@@ -247,7 +244,7 @@
- [[ repeatIn(get_months_tol(),'t') ]]
+ [[ repeatIn(get_months_tol(),'t') ]]
@@ -298,8 +295,5 @@
-
-
-
\ No newline at end of file
diff --git a/addons/hr_payroll/report/report_year_salary.py b/addons/hr_payroll/report/report_year_salary.py
index 4d0e0aa670c..0a7857582d4 100755
--- a/addons/hr_payroll/report/report_year_salary.py
+++ b/addons/hr_payroll/report/report_year_salary.py
@@ -43,6 +43,9 @@ class year_salary_report(rml_parse.rml_parse):
cm = 0
cy = ly
cm = cm +1
+ for c in range(0,(12-no_months)):
+ mnth_name.append('None')
+ self.mnths.append('None')
return [mnth_name]
def get_employee(self,form):
@@ -58,11 +61,14 @@ class year_salary_report(rml_parse.rml_parse):
ls1.append(emp_id.name)
tol = 0.0
for mnth in self.mnths:
- if len(mnth) != 7:
- mnth = '0' + str(mnth)
- query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' "
- self.cr.execute(query)
- sal = self.cr.fetchall()
+ if mnth <> 'None':
+ if len(mnth) != 7:
+ mnth = '0' + str(mnth)
+ query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' "
+ self.cr.execute(query)
+ sal = self.cr.fetchall()
+ else:
+ sal = [(0.0,)]
try:
ls1.append(sal[0][0])
except:
diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml
index ad9c3bcf772..afa1ee9bebe 100644
--- a/addons/membership/membership_view.xml
+++ b/addons/membership/membership_view.xml
@@ -140,7 +140,8 @@
parent="menu_membership"
id="menu_membership_products"
action="action_membership_products"
- sequence="1"/>
+ sequence="1"
+ groups="base.group_partner_manager"/>
diff --git a/addons/membership/report/report_membership_view.xml b/addons/membership/report/report_membership_view.xml
index abe8b44bcba..291efee4834 100644
--- a/addons/membership/report/report_membership_view.xml
+++ b/addons/membership/report/report_membership_view.xml
@@ -116,7 +116,8 @@
+ id="menu_report_membership"
+ groups="base.group_partner_manager"/>
diff --git a/addons/membership/security/ir.model.access.csv b/addons/membership/security/ir.model.access.csv
index 6cf3eb755c2..f3d91646c44 100644
--- a/addons/membership/security/ir.model.access.csv
+++ b/addons/membership/security/ir.model.access.csv
@@ -1,4 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_membership_membership_line_partner_manager","membership.membership_line partner_manager","model_membership_membership_line","base.group_partner_manager",1,0,0,0
+"access_membership_membership_line_partner_manager","membership.membership_line partner_manager","model_membership_membership_line","base.group_partner_manager",1,1,1,1
"access_membership_membership_line","membership.membership_line","model_membership_membership_line",,1,0,0,0
"access_report_membership","report.membership","model_report_membership","base.group_partner_manager",1,0,0,0
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 5872e325715..a9409e62aa8 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -197,7 +197,6 @@
In OpenERP, a product is something you can buy and sell. It can be a raw material, a stockable product, a consumable or a service. The product form contains a detailed information on the products like procurement logistic, sales price, product category, suppliers, etc.
-
diff --git a/addons/project/project.py b/addons/project/project.py
index 27bbb2f8c7f..c0f9be5394e 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -315,7 +315,7 @@ class project(osv.osv):
if child_ids:
self.setActive(cr, uid, child_ids, value, context=None)
return True
-
+
project()
class users(osv.osv):
@@ -418,7 +418,7 @@ class task(osv.osv):
'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
'name': fields.char('Task Summary', size=128, required=True),
'description': fields.text('Description'),
- 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'),
+ 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of tasks."),
'type_id': fields.many2one('project.task.type', 'Stage',),
'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
@@ -526,7 +526,7 @@ class task(osv.osv):
if not project_id: return False
task = self.browse(cr, uid, project_id, context=context)
project = task.project_id
- res = self.do_close(cr, uid, [project_id], context=context)
+ res = self.do_close(cr, uid, [project_id], context=context)
if project.warn_manager or project.warn_customer:
return {
'name': _('Send Email after close task'),
@@ -537,7 +537,7 @@ class task(osv.osv):
'target': 'new',
'nodestroy': True,
'context': {'active_id': task.id}
- }
+ }
return res
def do_close(self, cr, uid, ids, context=None):
@@ -678,7 +678,7 @@ class task(osv.osv):
if types:
if not typeid:
self.write(cr, uid, task.id, {'type_id': types[0]})
- elif typeid and typeid in types and types.index(typeid) != len(types)-1 :
+ elif typeid and typeid in types and types.index(typeid) != len(types)-1:
index = types.index(typeid)
self.write(cr, uid, task.id, {'type_id': types[index+1]})
return True
diff --git a/addons/sale/board_sale_view.xml b/addons/sale/board_sale_view.xml
index 39ce39eee9d..0aa1a9d238d 100644
--- a/addons/sale/board_sale_view.xml
+++ b/addons/sale/board_sale_view.xml
@@ -33,8 +33,7 @@
form
-
+
-
-
\ No newline at end of file
+
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 6f62e074ad1..0c7da4cad2d 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -2,7 +2,8 @@
-
+
@@ -518,7 +519,7 @@ to your configuration: from the sales order, from the pickings, etc.
groups="base.group_extended"/>
+ groups="base.group_extended"/>