Prevent Unnecessary Warnings for Intrastat Countries in Specific Scenarios

When testing the account_stock_eu module, we encountered a UserWarning in certain scenarios related to stock movements: “Could not find the intrastat countries for moves.”

All scenarios involve a “storage location” that has an address and country. However, we believe this warning is unnecessary when location has not warehouse, in the following cases:

  • Production: When running production (do inputs) or do production (do outputs).
  • Internal Shipments: When moving items from “Lost and Found” to a “Storage” location.
  • Initial Stock: When creating moves without a shipment. Moves are from a “Supplier” to a “Storage” location.

For inventory, the UserWarning should not be raised, because transaction has skip_warning in the context.

Here is An intrastat warning is raised when moving product to lost and found (#13523) · Issues · Tryton / Tryton · GitLab

Here is An intrastat warning is raised when doing a production (#13524) · Issues · Tryton / Tryton · GitLab

For me it is an expected behavior. The system can not know that it is an initial import and there is no real point to implement such mechanism to avoid just a warning once.

But it should be removed by Support warning keys of newly created record (#10591) · Issues · Tryton / Tryton · GitLab.