Error after deleting product sources

Hello,

After deleting the product sources of a product (because I wanted to create new ones), i get an error in de Packages tab:

How to fix? Because I can’t add packages now :wink:

Hi, @David_Douma can you also show what you have on the Product sources tab?

@Artur Do we think we should get Katarzyna to try to reproduce this issue?

From the screenshot alone, it seems like @David_Douma was able to delete a product supplier even though the foreign key constraint (from product package to product supplier) should have blocked that from occurring. So either the foreign key constraint doesn’t exist (maybe only in his system) or he deleted the product supplier manually from within MySQL.

I just checked the default schema generated by OpenBoxes and the foreign key constraint is definitely there. So, as far as I can tell, there should be no way to delete a product supplier that is associated with a product package, from within the application without disabling foreign key constraints (or dropping them altogether).

@David_Douma Can you provide the results from executing the following query on your system?

mysql> select table_schema, table_name, column_name, constraint_name, referenced_table_name, referenced_column_name from information_schema.key_column_usage where table_name = 'product_package' and table_schema = 'openboxes';
+--------------+-----------------+---------------------+--------------------------+-----------------------+------------------------+
| TABLE_SCHEMA | TABLE_NAME      | COLUMN_NAME         | CONSTRAINT_NAME          | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME |
+--------------+-----------------+---------------------+--------------------------+-----------------------+------------------------+
| openboxes    | product_package | id                  | PRIMARY                  | NULL                  | NULL                   |
| openboxes    | product_package | product_id          | product_package_uniq_idx | NULL                  | NULL                   |
| openboxes    | product_package | product_supplier_id | product_package_uniq_idx | NULL                  | NULL                   |
| openboxes    | product_package | uom_id              | product_package_uniq_idx | NULL                  | NULL                   |
| openboxes    | product_package | quantity            | product_package_uniq_idx | NULL                  | NULL                   |
| openboxes    | product_package | created_by_id       | FK615A48F6217F5972       | user                  | id                     |
> openboxes    | product_package | product_supplier_id | FK615A48F629542386       | product_supplier      | id                     |
| openboxes    | product_package | uom_id              | FK615A48F63906C4CF       | unit_of_measure       | id                     |
| openboxes    | product_package | updated_by_id       | FK615A48F6426DD105       | user                  | id                     |
| openboxes    | product_package | product_id          | FK615A48F6DED5FAE7       | product               | id                     |
+--------------+-----------------+---------------------+--------------------------+-----------------------+------------------------+
10 rows in set (0.00 sec)

@jmiranda Actually, the question about the Product sources tab is from Katarzyna. Basically we need more details about this one.