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 bb13f1a5776..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: @@ -112,13 +112,29 @@ class account_analytic_line(osv.osv): (prod.name, prod_id,)) amount_unit = prod.price_get('list_price', context)[prod_id] - prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') - amount = amount_unit * quantity or 1.0 - result = round(amount, prec) - if is_purchase: - result *= -1 - return { - 'value': { + if not company_id: + company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) + flag = False + # Compute based on pricetype + product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context) + pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] + if journal_id: + journal = analytic_journal_obj.browse(cr, uid, journal_id) + if journal.type == 'sale': + product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) + if product_price_type_ids: + pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] + # Take the company currency as the reference one + if pricetype.field == 'list_price': + flag = True + amount_unit = prod.price_get(pricetype.field, context)[prod.id] + amount = amount_unit*unit_amount or 1.0 + prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') + amount = amount_unit*unit_amount or 1.0 + result = round(amount, prec) + if not flag: + result *= -1 + return {'value': { 'amount': result, 'general_account_id': 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_unit_test.xml b/addons/account/account_unit_test.xml index 97fba380214..e4178517361 100644 --- a/addons/account/account_unit_test.xml +++ b/addons/account/account_unit_test.xml @@ -14,6 +14,13 @@ Test invoice 1 + + Test Tax + 5.00 + 100.00 + + + Basic computer with Dvorak keyboard and left-handed mouse @@ -27,7 +34,7 @@ 800 2 - + EUR diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 36ee5255523..27fd0d65b14 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -236,6 +236,17 @@ + + account.treasory.graph + account.account + graph + + + + + + + Accounts account.account @@ -1629,7 +1640,7 @@ - + @@ -2337,7 +2348,7 @@ - + @@ -2579,7 +2590,7 @@ - Cash Register + Cash Registers ir.actions.act_window account.bank.statement form diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index 5ae2890fd20..89767eb1507 100644 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -20,7 +20,22 @@ graph,tree [('type','=','income')] - + + Company Analysis + account.entries.report + form + tree,graph + {'group_by':['user_type'], 'group_by_no_leaf':1} + + + + Treasory + account.account + form + graph,tree + [('type','=','liquidity')] + + board.account.form board.board @@ -30,10 +45,12 @@ + + - + @@ -51,6 +68,6 @@ - + diff --git a/addons/account/i18n/de.po b/addons/account/i18n/de.po index 2f8b6aad6ae..94f0c92c017 100644 --- a/addons/account/i18n/de.po +++ b/addons/account/i18n/de.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-10-10 10:37+0000\n" -"Last-Translator: Ferdinand @ ChriCar \n" +"PO-Revision-Date: 2010-10-11 07:18+0000\n" +"Last-Translator: Ferdinand-chricar \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-10-11 04:45+0000\n" +"X-Launchpad-Export-Date: 2010-10-12 04:51+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/i18n/mn.po b/addons/account/i18n/mn.po index ae02ec22007..82262de0ce2 100644 --- a/addons/account/i18n/mn.po +++ b/addons/account/i18n/mn.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-10-11 04:27+0000\n" -"Last-Translator: sugi \n" +"PO-Revision-Date: 2010-10-11 07:18+0000\n" +"Last-Translator: OpenERP Administrators \n" "Language-Team: Mongolian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-10-11 04:45+0000\n" +"X-Launchpad-Export-Date: 2010-10-12 04:51+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account @@ -1983,7 +1983,7 @@ msgstr "Шилжүүлэлт" #. module: account #: rml:account.overdue:0 msgid "Li." -msgstr "" +msgstr "Ли." #. module: account #: wizard_view:account.chart,init:0 @@ -2262,7 +2262,7 @@ msgstr "Дансны мод" #. module: account #: model:account.journal,name:account.check_journal msgid "x Checks Journal" -msgstr "" +msgstr "x Чекийн журнал" #. module: account #: model:ir.actions.wizard,name:account.wizard_generate_subscription @@ -4413,7 +4413,7 @@ msgstr "Батлагдсан" #: view:account.tax:0 #: view:account.tax.template:0 msgid "Credit Notes" -msgstr "" +msgstr "Орлогын тэмдэглэл" #. module: account #: field:account.config.wizard,date2:0 @@ -4430,12 +4430,12 @@ msgstr "Нээлтийн бичилтийг цуцлах" #. module: account #: model:process.transition,name:account.process_transition_invoicemanually0 msgid "Manually statement" -msgstr "" +msgstr "Гараар үүсгэсэн тайлан" #. module: account #: field:account.payment.term.line,days2:0 msgid "Day of the Month" -msgstr "" +msgstr "Сарын өдөр" #. module: account #: field:account.analytic.journal,line_ids:0 @@ -4493,12 +4493,12 @@ msgstr "" #. module: account #: wizard_view:account.wizard_paid_open,init:0 msgid "Open Invoice" -msgstr "" +msgstr "Нэхэмжлэл нээх" #. module: account #: model:process.node,note:account.process_node_draftstatement0 msgid "Set starting and ending balance for control" -msgstr "" +msgstr "Балансын удирдлагын эхлэл төгсгөлийг тохируулах" #. module: account #: wizard_view:account.wizard_paid_open,init:0 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/product_view.xml b/addons/account/product_view.xml index cc9351d55f4..67352fd1120 100644 --- a/addons/account/product_view.xml +++ b/addons/account/product_view.xml @@ -9,7 +9,7 @@ - + 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/cost_ledger.rml b/addons/account/project/report/cost_ledger.rml index 4f495891378..a59e95724d0 100644 --- a/addons/account/project/report/cost_ledger.rml +++ b/addons/account/project/report/cost_ledger.rml @@ -181,13 +181,10 @@ Credit - Balance + Balance - - - @@ -199,21 +196,18 @@ - [[ formatLang (sum_debit(objects,data['form']['date1'],data['form']['date2'])) ]] + [[ formatLang (sum_debit(objects,data['form']['date1'],data['form']['date2'])) ]] - [[ formatLang (sum_credit(objects,data['form']['date1'],data['form']['date2'])) ]] + [[ formatLang (sum_credit(objects,data['form']['date1'],data['form']['date2'])) ]] [[ formatLang (sum_balance(objects,data['form']['date1'],data['form']['date2'])) ]] [[ company.currency_id.symbol ]] - - -
- [[ repeatIn(objects,'o') ]] + [[ repeatIn(objects,'o') ]] @@ -223,21 +217,18 @@ [[ o.complete_name ]] - [[ formatLang (account_sum_debit(o.id,data['form']['date1'],data['form']['date2'])) ]] + [[ formatLang (account_sum_debit(o.id,data['form']['date1'],data['form']['date2'])) ]] - [[ formatLang (account_sum_credit(o.id,data['form']['date1'],data['form']['date2'])) ]] + [[ formatLang (account_sum_credit(o.id,data['form']['date1'],data['form']['date2'])) ]] [[ formatLang (account_sum_balance(o.id,data['form']['date1'],data['form']['date2']))]] [[ company.currency_id.symbol ]] - - -
- [[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]] + [[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]] @@ -247,21 +238,18 @@ [[ move_g['name'] ]] - [[ formatLang( move_g['debit']) ]] + [[ formatLang( move_g['debit']) ]] - [[ formatLang( move_g['credit']) ]] + [[ formatLang( move_g['credit']) ]] [[ formatLang( move_g['balance']) ]] [[ company.currency_id.symbol ]] - - -
- [[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]] + [[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]] @@ -274,13 +262,13 @@ [[ move_a['name'] ]] - [[ formatLang( move_a['debit'] )]] + [[ formatLang( move_a['debit'] )]] - [[ formatLang( move_a['credit']) ]] + [[ formatLang( move_a['credit']) ]] - [[ formatLang( move_a['balance']) ]] + [[ formatLang( move_a['balance']) ]] [[ company.currency_id.symbol]] @@ -288,13 +276,7 @@
- - -
- - - - + \ No newline at end of file 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 22b04e05f39..457ce7bb27f 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -62,7 +62,6 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): def _get_lines(self, form): res = [] - account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ @@ -71,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): @@ -97,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] @@ -132,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] @@ -141,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)' @@ -154,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)\ @@ -164,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: @@ -219,7 +218,6 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): def _get_lines_with_out_partner(self, form): res = [] - account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] @@ -229,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)\ @@ -237,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] @@ -268,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] @@ -288,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)\ @@ -298,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_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml index 08b9030a968..bde0d2786d0 100644 --- a/addons/account/report/account_balance_sheet_horizontal.rml +++ b/addons/account/report/account_balance_sheet_horizontal.rml @@ -233,7 +233,7 @@ [[ '. '*(a['level']-1) ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]] - [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance'])) ]] [[ company.currency_id.symbol ]] + [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code'] and a['name']) and formatLang(abs(a['balance'])) or removeParentNode('font')]] [[ company.currency_id.symbol ]] 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_central_journal.rml b/addons/account/report/account_central_journal.rml index 1045470b2f2..28cb68fcce3 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -283,7 +283,7 @@ Balance - [[ display_currency(data) or removeParentNode('blockTable') ]] + [[ display_currency(data) or removeParentNode('blockTable') ]] A/C No. Account Name @@ -295,16 +295,16 @@ [[ display_currency(data) == False or removeParentNode('blockTable') ]] - Total([[ company.currency_id.code]]): + Total: [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id) ) ]] [[ company.currency_id.symbol ]] - [[ display_currency(data) or removeParentNode('blockTable') ]] + [[ display_currency(data) or removeParentNode('blockTable') ]] - Total:([[ company.currency_id.code]]) + Total: [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] @@ -323,19 +323,17 @@ [[ formatLang(line['credit']-line['debit']) ]] [[ company.currency_id.symbol ]] - [[ display_currency(data) or removeParentNode('blockTable') ]] + [[ display_currency(data) or removeParentNode('blockTable') ]] [[ line['code'] ]] [[ line['name'] ]] [[ formatLang(line['debit']) ]] [[ formatLang(line['credit'])]] - [[ formatLang(line['credit']-line['debit']) ]] [[ company.currency_id.symbol ]] - [[ line['currency_id'] and formatLang(line['amount_currency'] or '') ]] [[ line['currency_id'] and line['currency_code'] or '']] + [[ formatLang(line['credit']-line['debit']) ]] [[ company.currency_id.symbol ]] + [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] - - - + 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_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index a80fb3c3233..fc75a05e029 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -48,6 +48,19 @@ + + account.company.analysis.tree + account.entries.report + tree + + + + + + + + + account.entries.report.search account.entries.report diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml index 489416adf76..fdf044c048e 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -270,7 +270,7 @@ Balance - Total:([[ company.currency_id.code]]) + Total: [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] @@ -373,7 +373,7 @@ [[ formatLang(line['debit'] )]] [[ formatLang(line['credit']) ]] [[ formatLang(line['credit']-line['debit'] ) ]] [[ company.currency_id.symbol ]] - [[ line['currency_id'] and formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] + [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index f3ec97a592e..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 @@ -161,7 +161,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header): else: sql_sort='l.date' sql = """ - SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, + SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, m.name AS move_name, m.id AS mmove_id, c.symbol AS currency_code, i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number, diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index 6ac6cd51286..917ffa214d8 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -334,7 +334,7 @@ [[ formatLang(line['debit']) ]] [[ formatLang(line['credit']) ]] [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] - [[ formatLang(line['amount_currency'] or '') ]] [[ line['currency_code'] or '']] + [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index b8fa0e1f374..324cf378177 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -263,13 +263,13 @@ - + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] + [[ formatLang(sum_debit_account(o), dp='Account') ]] + [[ formatLang(sum_credit_account(o), dp='Account') ]] + [[ formatLang(sum_balance_account(o), dp='Account') ]] [[ company.currency_id.symbol ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), dp='Account') + o.currency_id.code or '' ]] @@ -292,10 +292,10 @@ [[ line['move'] ]] [[ line['lname'] ]] [[ strip_name(line['line_corresp'].replace(', ',','),40) ]] - [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ formatLang(line['amount_currency'] or '')]] [[ line['currency_code'] or '' ]] + [[ formatLang(line['debit'], dp='Account') ]] + [[ formatLang(line['credit'], dp='Account') ]] + [[ formatLang(line['progress'], dp='Account') ]] [[ company.currency_id.symbol ]] + [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] 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_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 3eef3270dd5..ae273ba5647 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -289,7 +289,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -359,7 +359,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ line['ref'] ]] - [[ line['name'] ]] @@ -391,7 +391,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -472,7 +472,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ (line['ref'] or '') + ' ' + line['name'] ]] diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index 4a07a8ef53c..7d7dd035c3f 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -444,7 +444,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -507,7 +507,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ (line['ref'] or '') + ' ' + line['name'] ]] @@ -537,7 +537,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -612,7 +612,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ (line['ref'] or '') + ' ' + line['name'] ]] 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/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index a0748e281ac..d3d2c77e47a 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -46,11 +46,13 @@ - - - - - + + + + + + + @@ -116,7 +118,7 @@ Document: Customer account statement Date: [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]] - Customer Ref: [[ o.ref or '' ]] + Customer Ref: [[ o.ref or ' ']] @@ -181,10 +183,10 @@ [[ line['date_maturity'] and formatLang(line['date_maturity'],date=True) or '' ]] - [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]] + [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]] - [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] + [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and formatLang(line['debit'] - line['credit']) ]] [[ company.currency_id.symbol ]] @@ -195,7 +197,7 @@ - + @@ -206,7 +208,7 @@ Sub-Total : - [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] + [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]] @@ -220,6 +222,8 @@ + + @@ -230,25 +234,21 @@ Balance : - [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] - - - - - - - - - - - + + + + + + + Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]]. diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml index 8c66f223df9..f92f9e07983 100644 --- a/addons/account/report/account_profit_horizontal.rml +++ b/addons/account/report/account_profit_horizontal.rml @@ -240,7 +240,7 @@ - [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance1'])) ]] [[ company.currency_id.symbol ]] + [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code1'] and a['name1']) and formatLang(abs(a['balance1'])) or removeParentNode('font') ]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py index b03aea5c05d..d3fb791bfaa 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/account_tax_report.py @@ -190,7 +190,6 @@ class tax_report(rml_parse.rml_parse): bcl_rup_ind = ind - 1 while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ): - tot_elem = copy.copy(accounts[bcl_rup_ind], context=context) res_tot = { 'code': accounts[bcl_rup_ind]['code'], 'name': '', 'debit': 0, diff --git a/addons/account/report/account_tax_report.rml b/addons/account/report/account_tax_report.rml index 9ad4ff56112..2434437e803 100644 --- a/addons/account/report/account_tax_report.rml +++ b/addons/account/report/account_tax_report.rml @@ -104,7 +104,7 @@ - Taxes + Tax Statement Tax Name 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 7e4295da45b..0aae9dbe3d0 100644 --- a/addons/account/test/account_report.yml +++ b/addons/account/test/account_report.yml @@ -1,6 +1,6 @@ - In order to test the PDF reports defined on an invoice, we will print an Invoice Report -- +- !python {model: account.invoice}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.test_invoice_1')], {}, {}) @@ -9,7 +9,7 @@ - In order to test the PDF reports defined on a partner, we will print the Overdue Report -- +- !python {model: res.partner}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.overdue').create(cr, uid, [ref('base.res_partner_asus'),ref('base.res_partner_agrolait'),ref('base.res_partner_c2c')], {}, {}) @@ -18,7 +18,7 @@ - In order to test the PDF reports defined on Account Move, we will print the Voucher Report -- +- !python {model: account.move}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.move.voucher').create(cr, uid, [ref('account.account_move_0')], {}, {}) @@ -30,28 +30,30 @@ - !record {model: account.tax.code, id: account_tax_code_0}: name : Tax Code Test + sign : 10.00 - Print Tax Code entries report -- +- !python {model: account.tax.code}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.tax.code.entries').create(cr, uid, [ref('account_tax_code_0')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-tax-code-entries.'+format), 'wb+').write(data) + - Print Vat Declaration Report - !python {model: account.tax.code}: | import netsvc, tools, os data_dict = {'model': 'ir.ui.menu', 'form': {'based_on': 'invoices','company_id':ref('base.main_company'),'periods':[]}} - (data, format) = netsvc.LocalService('report.account.vat.declaration').create(cr, uid, [ref("account_tax_code_0")], data_dict, {}) + (data, format) = netsvc.LocalService('report.account.vat.declaration').create(cr, uid, [ref("account_move_0")], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-vat-declaration.'+format), 'wb+').write(data) - In order to test the PDF reports defined on an invoice, we will print an invoice -- +- !python {model: account.invoice}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.test_invoice_1')], {}, {}) @@ -65,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 = {} @@ -84,9 +88,9 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'ir.ui.menu', 'form': {'chart_account_id':ref('account.chart0'),'initial_balance': 1, 'periods': period_list,'journal_ids':journal_ids, 'page_split': 0, 'date_from': time.strftime('%Y-%m-%d'), 'period_length': 30, 'amount_currency': 0,'query_line' : query_line, 'result_selection': 'customer','direction_selection': 'past','fiscalyear_id':fy_id}} data_dict['form'].update(res) (data, format) = netsvc.LocalService('report.account.aged_trial_balance').create(cr, uid, [], data_dict, {}) @@ -122,10 +126,10 @@ (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal.'+format), 'wb+').write(data) - + data_dict.update({'model': 'ir.ui.menu'}) data_dict['form'].update({'active_ids':[ref('account.bal'),ref('account.gpf')]}) - + (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [], data_dict, {'periods': []}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal-menu.'+format), 'wb+').write(data) @@ -145,16 +149,16 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, journal_period_ids, data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-central_journal.'+format), 'wb+').write(data) - + data_dict.update({'model': 'ir.ui.menu'}) data_dict['form'].update({'active_ids':journal_period_ids}) - + (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-central_journal-menu.'+format), 'wb+').write(data) @@ -167,13 +171,13 @@ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context) - + obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) data_dict = {'model': 'ir.ui.menu','id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids, 'active_ids':journal_period_ids}} (data, format) = netsvc.LocalService('report.account.general.journal').create(cr, uid, journal_period_ids, data_dict, {}) @@ -189,15 +193,15 @@ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] acc_ids = [ref('account.bal'),ref('account.gpf')] - + obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query': query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, acc_ids, data_dict, {}) if tools.config['test_report_directory']: @@ -217,15 +221,15 @@ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] acc_ids = [ref('account.bal'),ref('account.gpf')] - + obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query':query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':1,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, acc_ids, data_dict, {}) if tools.config['test_report_directory']: @@ -252,17 +256,17 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'sort_selection': 'date','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, journal_period_ids, data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-print_journal.'+format), 'wb+').write(data) - + data_dict.update({'model': 'ir.ui.menu'}) data_dict['form'].update({'active_ids':journal_period_ids}) - + (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-print_journal-menu.'+format), 'wb+').write(data) @@ -275,16 +279,17 @@ fy_id = ref('account.data_fiscalyear') period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] - + journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context) obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - data_dict = {'model': 'ir.ui.menu', 'form': {'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} - (data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, [], data_dict, {}) + + data_dict = {'model': 'ir.ui.menu', 'form': {'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'active_ids':journal_period_ids,'display_partner': 'all','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} + (data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, journal_period_ids, data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-partner_balance.'+format), 'wb+').write(data) @@ -302,9 +307,9 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': True,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} (data, format) = netsvc.LocalService('report.account.third_party_ledger').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: @@ -324,7 +329,7 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': False,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} (data, format) = netsvc.LocalService('report.account.third_party_ledger_other').create(cr, uid, [], data_dict, {}) diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml index 37d64ead528..9a733d8ad5f 100644 --- a/addons/account/test/account_validate_account_move.yml +++ b/addons/account/test/account_validate_account_move.yml @@ -1,3 +1,12 @@ +- + Demo data for Account tax code +- + !record {model: account.tax.code, id: account_tax_code_0}: + name : Tax Code Test + sign : 1.00 +- + + - In order to test the 'Validate Journal Entries' wizard in OpenERP, I created an account move @@ -20,6 +29,7 @@ - journal_id: account.bank_journal period_id: account.period_6 ref: '2010010' + tax_code_id: account_tax_code_0 tax_amount: 0.0 account_id: account.a_recv amount_currency: 0.0 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):
-