diff --git a/addons/account/account.py b/addons/account/account.py index 208bf1d6f68..3dc5c36c889 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1162,32 +1162,36 @@ class account_move(osv.osv): ] def post(self, cr, uid, ids, context=None): + if context is None: + context = {} invoice = context.get('invoice', False) valid_moves = self.validate(cr, uid, ids, context) - if valid_moves: - for move in self.browse(cr, uid, valid_moves): - if move.name =='/': - new_name = False - journal = move.journal_id + + if not valid_moves: + raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + + for move in self.browse(cr, uid, valid_moves): + if move.name =='/': + new_name = False + journal = move.journal_id - if invoice and invoice.internal_number: - new_name = invoice.internal_number + if invoice and invoice.internal_number: + new_name = invoice.internal_number + else: + if journal.sequence_id: + c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} + new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) else: - if journal.sequence_id: - c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} - new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) - else: - raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) + raise osv.except_osv(_('Error'), _('No sequence defined on the journal !')) - if new_name: - self.write(cr, uid, [move.id], {'name':new_name}) + if new_name: + self.write(cr, uid, [move.id], {'name':new_name}) - cr.execute('UPDATE account_move '\ - 'SET state=%s '\ - 'WHERE id IN %s', - ('posted', tuple(valid_moves),)) - else: - raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + cr.execute('UPDATE account_move '\ + 'SET state=%s '\ + 'WHERE id IN %s', + ('posted', tuple(valid_moves),)) + return True def button_validate(self, cursor, user, ids, context=None): diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 1aa4e30d95d..777955d5a8e 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -650,18 +650,19 @@ class account_invoice(osv.osv): return ok def button_reset_taxes(self, cr, uid, ids, context=None): - if not context: + if context is None: context = {} + ctx = context.copy() ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) - partner = self.browse(cr, uid, id, context=context).partner_id + partner = self.browse(cr, uid, id, context=ctx).partner_id if partner.lang: - context.update({'lang': partner.lang}) - for taxe in ait_obj.compute(cr, uid, id, context=context).values(): + ctx.update({'lang': partner.lang}) + for taxe in ait_obj.compute(cr, uid, id, context=ctx).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute - self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) + self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx) return True def button_compute(self, cr, uid, ids, context=None, set_total=False): diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index efce4bc4da4..f94082445da 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -200,7 +200,8 @@ class account_automatic_reconcile(osv.osv_memory): "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ - "AND debit > 0", + "AND debit > 0 " \ + "ORDER BY date_maturity", (account_id, partner_id)) debits = cr.fetchall() @@ -212,7 +213,8 @@ class account_automatic_reconcile(osv.osv_memory): "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ - "AND credit > 0", + "AND credit > 0 " \ + "ORDER BY date_maturity", (account_id, partner_id)) credits = cr.fetchall() diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml index 8460cfa6cc9..d5a5baab946 100644 --- a/addons/association/profile_association.xml +++ b/addons/association/profile_association.xml @@ -48,8 +48,9 @@ - - 3 + + 3 + always diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 722ac5cb0a8..1ff7777cf36 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1438,7 +1438,8 @@ true, it will allow you to hide the event alarm information without removing it. res = super(calendar_event, self).search(cr, uid, args_without_date, \ offset, limit, order, context, count) - return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) + res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) + return res def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ @@ -1533,11 +1534,9 @@ true, it will allow you to hide the event alarm information without removing it. if fields and 'date' not in fields: fields.append('date') - real_ids = [item2 for item1, item2 in select] - event_values = dict([(res['id'], res) for res in super(calendar_event, self).read(cr, uid, real_ids, fields=fields, context=context, load=load)]) - for base_calendar_id, real_id in select: - res = event_values[real_id] + #REVET: Revision ID: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn + res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load) ls = base_calendar_id2real_id(base_calendar_id, with_date=res and res.get('duration', 0) or 0) if not isinstance(ls, (str, int, long)) and len(ls) >= 2: res['date'] = ls[1] diff --git a/addons/base_report_designer/base_report_designer_installer.xml b/addons/base_report_designer/base_report_designer_installer.xml index 4ea4970d19a..2c0cf191e4e 100644 --- a/addons/base_report_designer/base_report_designer_installer.xml +++ b/addons/base_report_designer/base_report_designer_installer.xml @@ -19,7 +19,7 @@ This plug-in allows you to create/modify OpenERP Reports into OpenOffice Writer. - +