Uploading a WEBP or SVG file disguised with a proper file extension (JPG, PNG)
will cause a traceback because img.image is
not populated when there is an empty source, SVG, or WEBP file uploaded
as this code should not be reached with these file types.
The reason this occurs is because we check for the file extension when
deciding to post process an image, but when we get to initializing the
ImageProcess object, we then check the actual file structure to verify
the type of file.
This is a workaround for the time being, but should not be a final
solution in future versions.
Adding a null check on img.image in the _postprocess_contents method
in order to avoid attempting to access the size of this image when it is
null.
Raises a user error in order to trigger the catch and exit the code
while logging the error and 'Post processing ignored:'.
Includes test for this new workflow with no errors.
opw-3672250
closesodoo/odoo#162976
X-original-commit: e9750b16a61c3598f7a2b14a1552fcb4ecf1a293
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Ryan Cen (ryce) <ryce@odoo.com>
The cron "send invoices automatically" was not properly using the
job_count parameter because the to_process invoices were now pulled from
a read_group. The limit parameter on read_group only limits the number
of groups and it was being grouped by company. This meant if there was
less than job_count number of companies this was not doing anything. And
if one company had a large amount of invoices this would time out and
repeat the same invoices the next time it was attempted because no
progress is saved until the batch is over.
Changing the read_group to a search.
opw-3765192
Part-of: odoo/odoo#158035
Added a validation for URLs on product.document to resolve an issue
where incomplete links on documents will redirect to a local URL instead
of an external URL. Thus leading to a page that does not exist.
e.g.: youtube.com instead of https://www.youtube.com
This seemed like the proper course of action as there would be no reason
to not validate as any URL within the database can still be formatted properly and work the same.
api.constrains does not seem to work upon creation on this model, so I
opted to use the api.onchange.
opw-3698591
closesodoo/odoo#155806
Signed-off-by: Ryan Cen (ryce) <ryce@odoo.com>
Co-authored-by: Morgane Demesmaeker (edm) <69820391+Demesmaeker@users.noreply.github.com>
The customer was having an issue where they would create an expense from an email with the wrong cost on the expense.
Then when they would try to change the price on the expense record it would seem find all the way up until the journal was posted.
Issue:
When creating an expense from an email the unit_amount is updated instead of the total_amount.
This would cause issues if you had an attachment because when you would attempt to change the amount through the front-end this unit_amount would never get updated because it was set and there was an attachment (line 265).
However, when you would create a journal entry from this expense, because it has the unit_amount != 0 it would provide the unit_amount instead of the total_amount.
Thus propogating the original number from the email even if it was updated between the time of posting and the creation of the expense from the email.
Solution:
Implement an inverse function on total_amount that will update the unit_amount to total_amount_company.
This will cause the unit_amount to stay up to date with the total_amount while also taking into account currency.
opw-3286372
closesodoo/odoo#126388
X-original-commit: c2588824edc732bea40b1a8f6e5248b3d318b361
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Issue:
CSRF token was being cached and this caused issues when the session id was updated.
Post requests would continue to use the old CSRF token and it would not be able to be validated with the session id.
Solution:
Added the t-nocache attribute to every instance where csrf_token is called in the case that the session_id is different.
This is changed to behave the same as the csrf token input in the products_item template.
opw-3256880
closesodoo/odoo#117923
X-original-commit: 629d9cb15a6a6eb68756bad9da83cf0a81a3b5bd
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>