diff --git a/addons/account/account.py b/addons/account/account.py index b0271a4fee1..bf5e25a6f69 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 + @@ -838,7 +838,7 @@ class account_period(osv.osv): 'date_start': fields.date('Start of Period', required=True, states={'done':[('readonly',True)]}), 'date_stop': fields.date('End of Period', required=True, states={'done':[('readonly',True)]}), 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True), - 'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', readonly=True, + 'state': fields.selection([('draft','Open'), ('done','Closed')], 'State', readonly=True, help='When monthly periods are created. The state is \'Draft\'. At the end of monthly period it is in \'Done\' state.'), 'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True) } @@ -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_end_fy.xml b/addons/account/account_end_fy.xml index a33544ffacc..76d40bc89dc 100644 --- a/addons/account/account_end_fy.xml +++ b/addons/account/account_end_fy.xml @@ -6,8 +6,8 @@ Close a Period account.period form - [('state','=','draft')] + {'search_default_draft': 1} After closing a period, you will no longer be able to post entries to the period once it has been closed. - + @@ -1641,7 +1641,7 @@ - + @@ -2589,7 +2589,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_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index fe635a080c7..be353220e99 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -61,12 +61,12 @@ class account_followup_print(osv.osv_memory): 'views': [(resource_id,'form')], 'type': 'ir.actions.act_window', 'target': 'new', - } + } _defaults = { 'date': time.strftime('%Y-%m-%d'), 'followup_id': _get_followup, - } + } account_followup_print() @@ -80,7 +80,7 @@ class account_followup_print_all(osv.osv_memory): 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), 'summary': fields.text('Summary', required=True, readonly=True) - } + } def _get_summary(self, cr, uid, context=None): if context is None: context = {} @@ -285,14 +285,14 @@ class account_followup_print_all(osv.osv_memory): 'ids': [], 'model': 'account_followup.followup', 'form': data - } + } return { 'type': 'ir.actions.report.xml', 'report_name': 'account_followup.followup.print', 'datas': datas, - } + } account_followup_print_all() -# 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_invoice_layout/account_invoice_layout_view.xml b/addons/account_invoice_layout/account_invoice_layout_view.xml index fdd4fa0781f..c9d3e32e892 100644 --- a/addons/account_invoice_layout/account_invoice_layout_view.xml +++ b/addons/account_invoice_layout/account_invoice_layout_view.xml @@ -75,7 +75,8 @@ - + + 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 @@