6ae472959e963cab2278eb56d7e2ba0983d6b078
hr.expense.sheet
Issue: Main attachments on expense sheets was never correctly set, leading to missing attachment previous in the hr.expense.sheet form view, and unnecessary RPC requests to `register_main_attachment`, because the attachment was never set. Steps to reproduce: - Install Expenses - Create 2 different expenses with different attachments - Create a report from those 2 expenses, save it - Notice there is nothing in the preview for the attachments, but if you zoom in or zoom out the page, then you can see it. Also swiping on the list of attachments isn't persistent, once you refresh the page, the main attachment we selected lastly is lost. Cause: There are 2 main issues: - `hr.expense.sheet` has `message_main_attachment_id`, but it's never set. - When writing an attachment via `register_main_attachment`, we pass only the id of the attachment. Then in the backend, the related record is based on the model of the attachment, but the attachment is linked to `hr.expense`, not `hr.expense.sheet`. Therefor we re-write the same attachment on the record we read the attachment from. And then the frontend will continue to call `register_main_attachment` everytime it tries to find the attachments linked to the sheet, but it's never done. Fix: - Add a compute to initially set the value of the `message_main_attachment_id` based on the spec "we take the first line that has a main attachment (attachment if no main attachment) and we set it on the sheet" - The `hr.expense.sheet` now maintains a copies of the attachments linked to it's expenses, for proper ACL and functionality of `register_main_attachment`. Affected versions: 16.0 up to master = saas-17.1 Reference: task-3572440 closes odoo/odoo#150501 X-original-commit: 2e02a05838ab62e48c65ba90980bd9e21b677019 Signed-off-by: Cedric Snauwaert <csn@odoo.com> Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%