Validae Invoice

Hello,

When I am validation Customer/Supplier invoice. It gives the exception.

2020-07-26 13:13:53.548 DEBUG 29637 --- [nio-8080-exec-3] org.hibernate.SQL                        : insert into account_move (archived, import_id, import_origin, version, created_by, created_on, updated_by, updated_on, accounting_ok, accounting_report, adjusting_move, attrs, auto_year_closure_move, company, company_currency, company_currency_code, currency, currency_code, date_val, export_date, export_number, functional_origin_select, get_info_from_first_move_line_ok, ignore_in_accounting_ok, ignore_in_debt_recovery_ok, invoice, journal, partner, payment_mode, payment_voucher, period, reference, reject_ok, status_select, stock_move, technical_origin_select, validation_date, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2020-07-26 13:13:57.068 DEBUG 29637 --- [nio-8080-exec-3] org.hibernate.SQL                        : update account_invoice set archived=?, import_id=?, import_origin=?, version=?, created_by=?, created_on=?, updated_by=?, updated_on=?, address=?, address_str=?, already_printed_ok=?, amount_paid=?, amount_rejected=?, amount_remaining=?, attrs=?, bank_details=?, canceled_payment_schedule=?, company=?, company_bank_details=?, company_ex_tax_total=?, company_in_tax_total=?, company_in_tax_total_remaining=?, company_tax_total=?, contact_partner=?, contract=?, created_by_interco=?, currency=?, debit_blocking_by_user=?, debit_blocking_ok=?, debit_blocking_reason=?, debit_blocking_to_date=?, debit_number=?, debt_recovery_blocking_by_user=?, debt_recovery_blocking_ok=?, debt_recovery_blocking_reason=?, debt_recovery_blocking_to_date=?, decision_pfp_taken_date=?, direct_debit_amount=?, display_expense_on_printing=?, display_timesheet_on_printing=?, doubtful_customer_ok=?, due_date=?, estimated_payment_date=?, ex_tax_total=?, external_reference=?, has_pending_payments=?, head_office_address=?, hide_discount=?, in_ati=?, in_tax_total=?, interbank_code_line=?, interco=?, internal_reference=?, invoice_automatic_mail=?, invoice_automatic_mail_on_validate=?, invoice_date=?, invoice_id=?, invoice_message_template=?, invoice_message_template_on_validate=?, invoices_copy_select=?, irrecoverable_status_select=?, journal=?, management_object=?, move=?, note=?, old_move=?, operation_sub_type_select=?, operation_type_select=?, origin_date=?, original_invoice=?, partner=?, partner_account=?, partner_tax_nbr=?, payment_condition=?, payment_date=?, payment_mode=?, payment_move=?, payment_schedule=?, pfp_validate_status_select=?, pfp_validator_user=?, price_list=?, printedpdf=?, printing_settings=?, proforma_comments=?, project=?, purchase_order=?, reason_of_refusal_to_pay=?, reason_of_refusal_to_pay_str=?, reject_date=?, reject_move_line=?, sale_order=?, schedule_payment_ok=?, specific_notes=?, standard_invoice=?, status_select=?, subrogation_release=?, subrogation_release_move=?, subscription_from_date=?, subscription_to_date=?, supplier_invoice_nb=?, tax_total=?, trading_name=?, usher_passage_ok=?, validated_by_user=?, validated_date=?, ventilated_by_user=?, ventilated_date=? where id=? and version=?
2020-07-26 13:14:47.260 DEBUG 29637 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper   : could not execute statement [n/a]
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uk_20qqmat85osmhn8okihvyx3x0"
  Detail: Key (invoice_id, company)=(001, 1) already exists.
] c.a.exception.service.TraceBackService   : javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
	at com.axelor.apps.account.db.repo.MoveManagementRepository.save(MoveManagementRepository.java:112)
	at com.axelor.apps.account.db.repo.MoveManagementRepository.save(MoveManagementRepository.java:38)
	at com.axelor.apps.account.service.move.MoveCreateService.createMove(MoveCreateService.java:209)
	at com.axelor.apps.account.service.move.MoveCreateService.createMove(MoveCreateService.java:122)
	at com.axelor.apps.account.service.move.MoveServiceImpl.createMove(MoveServiceImpl.java:159)

Hello

Detail: Key (invoice_id, company)=(001, 1) already exists.

Mean for me : you have trouble with sequences of invoice
Please check this :

Aplication Config > General data > Sequences

Edit for invoice if you haven’t do it yet, or change parameters and make some test for see if it’s work

Come back with details of parameter if you don’t find solution.

Have a good day

1 Like