diff --git a/addons/account/account.py b/addons/account/account.py index 75936320e58..3c7c14737c1 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1447,6 +1447,8 @@ class account_move(osv.osv): def unlink(self, cr, uid, ids, context=None, check=True): if context is None: context = {} + if isinstance(ids, (int, long)): + ids = [ids] toremove = [] obj_move_line = self.pool.get('account.move.line') for move in self.browse(cr, uid, ids, context=context): @@ -1928,7 +1930,7 @@ class account_tax(osv.osv): 'child_depend':fields.boolean('Tax on Children', help="Set if the tax computation is based on the computation of child taxes rather than on the total amount."), 'python_compute':fields.text('Python Code'), 'python_compute_inv':fields.text('Python Code (reverse)'), - 'python_applicable':fields.text('Python Code'), + 'python_applicable':fields.text('Applicable Code'), # # Fields used for the Tax declaration @@ -1942,8 +1944,8 @@ class account_tax(osv.osv): 'ref_base_code_id': fields.many2one('account.tax.code', 'Refund Base Code', help="Use this code for the tax declaration."), 'ref_tax_code_id': fields.many2one('account.tax.code', 'Refund Tax Code', help="Use this code for the tax declaration."), - 'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."), - 'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."), + 'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1."), + 'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1."), 'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"), 'company_id': fields.many2one('res.company', 'Company', required=True), 'description': fields.char('Tax Code'), @@ -2833,7 +2835,7 @@ class account_tax_template(osv.osv): 'child_depend':fields.boolean('Tax on Children', help="Set if the tax computation is based on the computation of child taxes rather than on the total amount."), 'python_compute':fields.text('Python Code'), 'python_compute_inv':fields.text('Python Code (reverse)'), - 'python_applicable':fields.text('Python Code'), + 'python_applicable':fields.text('Applicable Code'), # # Fields used for the Tax declaration @@ -2847,8 +2849,8 @@ class account_tax_template(osv.osv): 'ref_base_code_id': fields.many2one('account.tax.code.template', 'Refund Base Code', help="Use this code for the tax declaration."), 'ref_tax_code_id': fields.many2one('account.tax.code.template', 'Refund Tax Code', help="Use this code for the tax declaration."), - 'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."), - 'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."), + 'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1."), + 'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1."), 'include_base_amount': fields.boolean('Include in Base Amount', help="Set if the amount of tax must be included in the base amount before computing the next taxes."), 'description': fields.char('Internal Name'), 'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,), diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 0fc9d9e2227..d5c453ee9c7 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -26,7 +26,7 @@ from operator import itemgetter from lxml import etree -from openerp import netsvc +from openerp import workflow from openerp.osv import fields, osv, orm from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp @@ -311,13 +311,13 @@ class account_move_line(osv.osv): context = {} c = context.copy() c['initital_bal'] = True - sql = """SELECT l2.id, SUM(l1.debit-l1.credit) - FROM account_move_line l1, account_move_line l2 - WHERE l2.account_id = l1.account_id - AND l1.id <= l2.id - AND l2.id IN %s AND """ + \ - self._query_get(cr, uid, obj='l1', context=c) + \ - " GROUP BY l2.id" + sql = """SELECT l1.id, COALESCE(SUM(l2.debit-l2.credit), 0) + FROM account_move_line l1 LEFT JOIN account_move_line l2 + ON (l1.account_id = l2.account_id + AND l2.id <= l1.id + AND """ + \ + self._query_get(cr, uid, obj='l2', context=c) + \ + ") WHERE l1.id IN %s GROUP BY l1.id" cr.execute(sql, [tuple(ids)]) return dict(cr.fetchall()) @@ -932,11 +932,10 @@ class account_move_line(osv.osv): 'line_id': map(lambda x: (4, x, False), ids), 'line_partial_ids': map(lambda x: (3, x, False), ids) }) - wf_service = netsvc.LocalService("workflow") # the id of the move.reconcile is written in the move.line (self) by the create method above # because of the way the line_id are defined: (4, x, False) for id in ids: - wf_service.trg_trigger(uid, 'account.move.line', id, cr) + workflow.trg_trigger(uid, 'account.move.line', id, cr) if lines and lines[0]: partner_id = lines[0].partner_id and lines[0].partner_id.id or False diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml index 9d2e65a3a4c..8119e9f1002 100644 --- a/addons/account/data/account_data.xml +++ b/addons/account/data/account_data.xml @@ -16,7 +16,6 @@ - Immediate Payment balance diff --git a/addons/account/edi/invoice_action_data.xml b/addons/account/edi/invoice_action_data.xml index b3fe8362b8b..417169fa8cb 100644 --- a/addons/account/edi/invoice_action_data.xml +++ b/addons/account/edi/invoice_action_data.xml @@ -22,7 +22,7 @@ Invoice - Send by Email - ${object.user_id.email or object.company_id.email or 'noreply@localhost'} + ${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe} ${object.company_id.name} Invoice (Ref ${object.number or 'n/a'}) ${object.partner_id.id} diff --git a/addons/account/partner.py b/addons/account/partner.py index d0db2ed4f6c..f24ffcf55b4 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -107,14 +107,15 @@ class res_partner(osv.osv): _description = 'Partner' def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None): - query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) + ctx = context.copy() + ctx['all_fiscalyear'] = True + query = self.pool.get('account.move.line')._query_get(cr, uid, context=ctx) cr.execute("""SELECT l.partner_id, a.type, SUM(l.debit-l.credit) FROM account_move_line l LEFT JOIN account_account a ON (l.account_id=a.id) WHERE a.type IN ('receivable','payable') AND l.partner_id IN %s - AND (l.reconcile_id IS NULL OR - reconcile_id in (SELECT id FROM account_move_reconcile WHERE opening_reconciliation is TRUE)) + AND l.reconcile_id IS NULL AND """ + query + """ GROUP BY l.partner_id, a.type """, diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 6ddfc238bff..08c05c65fa8 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -170,6 +170,7 @@ + diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml index a99ae3b4d43..a1a119ea59a 100644 --- a/addons/account/test/account_validate_account_move.yml +++ b/addons/account/test/account_validate_account_move.yml @@ -80,8 +80,13 @@ I validate this account move by using the 'Post Journal Entries' wizard - !record {model: validate.account.move, id: validate_account_move_0}: - journal_id: account.bank_journal - period_id: account.period_6 + journal_ids: + - bank_journal + - check_journal + period_ids: + - period_6 + - period_7 + - period_8 - I click on validate Button - diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 4b7a7fd5314..8a583b79383 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -52,10 +52,19 @@ class account_invoice_refund(osv.osv_memory): journal = obj_journal.search(cr, uid, [('type', '=', type), ('company_id','=',company_id)], limit=1, context=context) return journal and journal[0] or False + def _get_reason(self, cr, uid, context=None): + active_id = context and context.get('active_id', False) + if active_id: + inv = self.pool.get('account.invoice').browse(cr, uid, active_id, context=context) + return inv.name + else: + return '' + _defaults = { 'date': lambda *a: time.strftime('%Y-%m-%d'), 'journal_id': _get_journal, 'filter_refund': 'refund', + 'description': _get_reason, } def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index 050191db187..297f3445606 100644 --- a/addons/account/wizard/account_validate_account_move.py +++ b/addons/account/wizard/account_validate_account_move.py @@ -25,18 +25,18 @@ class validate_account_move(osv.osv_memory): _name = "validate.account.move" _description = "Validate Account Move" _columns = { - 'journal_id': fields.many2one('account.journal', 'Journal', required=True), - 'period_id': fields.many2one('account.period', 'Period', required=True, domain=[('state','<>','done')]), + 'journal_ids': fields.many2many('account.journal', 'wizard_validate_account_move_journal', 'wizard_id', 'journal_id', 'Journal', required=True), + 'period_ids': fields.many2many('account.period', 'wizard_validate_account_move_period', 'wizard_id', 'period_id', 'Period', required=True, domain=[('state','<>','done')]), } def validate_move(self, cr, uid, ids, context=None): obj_move = self.pool.get('account.move') if context is None: context = {} - data = self.browse(cr, uid, ids, context=context)[0] - ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data.journal_id.id),('period_id','=',data.period_id.id)]) + data = self.read(cr, uid, ids[0], context=context) + ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','in',tuple(data['journal_ids'])),('period_id','in',tuple(data['period_ids']))]) if not ids_move: - raise osv.except_osv(_('Warning!'), _('Specified journal does not have any account move entries in draft state for this period.')) + raise osv.except_osv(_('Warning!'), _('Specified journals do not have any account move entries in draft state for the specified periods.')) obj_move.button_validate(cr, uid, ids_move, context=context) return {'type': 'ir.actions.act_window_close'} diff --git a/addons/account/wizard/account_validate_move_view.xml b/addons/account/wizard/account_validate_move_view.xml index 6a9b1e159f0..5f22ccbc97f 100644 --- a/addons/account/wizard/account_validate_move_view.xml +++ b/addons/account/wizard/account_validate_move_view.xml @@ -9,8 +9,8 @@
- - + +