CroissanceCommune / autonomie

Autonomie est un progiciel de gestion à l'usage des CAE
GNU General Public License v3.0
20 stars 12 forks source link

Erreur à la suppression d'une facture #965

Closed tonthon closed 5 years ago

tonthon commented 5 years ago
Traceback (most recent call last):
  File "/var/www/autonomie/local/lib/python2.7/site-packages/pyramid_exclog/__init__.py", line 134, in exclog_tween
    response = handler(request)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 171, in tm_tween
    reraise(*exc_info)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 152, in tm_tween
    return _finish(request, manager.commit, response)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 96, in _finish
    reraise(*exc_info)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 76, in _finish
    finisher()
  File "/var/www/autonomie/local/lib/python2.7/site-packages/transaction/_manager.py", line 131, in commit
    return self.get().commit()
  File "/var/www/autonomie/local/lib/python2.7/site-packages/transaction/_transaction.py", line 310, in commit
    reraise(t, v, tb)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/transaction/_transaction.py", line 301, in commit
    self._commitResources()
  File "/var/www/autonomie/local/lib/python2.7/site-packages/transaction/_transaction.py", line 446, in _commitResources
    reraise(t, v, tb)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/transaction/_transaction.py", line 418, in _commitResources
    rm.tpc_begin(self)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py", line 98, in tpc_begin
    self.session.flush()
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2254, in flush
    self._flush(objects)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2380, in _flush
    transaction.rollback(_capture_exception=True)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2344, in _flush
    flush_context.execute()
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 386, in execute
    n.execute_aggregate(self, set_)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 694, in execute_aggregate
    uow)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 265, in delete_obj
    cached_connections, mapper, table, delete)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 1028, in _emit_delete_statements
    c = connection.execute(statement, del_objects)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 948, in execute
    return meth(self, multiparams, params)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
    context)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
    exc_info
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
    context)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
    cursor.execute(statement, parameters)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/var/www/autonomie/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue
IntegrityError: (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`autonomie`.`business_payment_deadline`, CONSTRAINT `fk_business_payment_deadline_invoice_id` FOREIGN KEY (`invoice_id`) REFERENCES `invoice` (`id`))') [SQL: u'DELETE FROM invoice WHERE invoice.id = %s'] [parameters: (64173L,)] (Background on this error at: http://sqlalche.me/e/gkpj)
tonthon commented 5 years ago
alter table business_payment_deadline drop foreign key fk_business_payment_deadline_invoice_id;
alter table business_payment_deadline ADD CONSTRAINT `fk_business_payment_deadline_invoice_id` FOREIGN KEY (`invoice_id`) REFERENCES `invoice` (`id`) ON DELETE SET NULL;