We want to create a XMLID for every first exhibition of a field in a
model. That is, we just want one XMLID by field by model and not one
XMLID by field by class. Previous implementation was determining the
"first field exhibition" by making sure the field was created and used
as part of the same module.
This assumption is invalid when we consider mixins. A mixin is an
abstract model that define fields and methods to be included in other
models. As it is abstract, it does not exhibits the field by itself. The
field will only be exhibited when included in a concrete model via
inheritance. When it is included in another module, the XMLID creation
is discarded.
Take a module M1 that defines a model A, take another module M2 that
defines a mixin X with a field X1. In a third module M3, extend A to
inherit from X. While M3.A is the first model module to exhibit the
field X1, the XMLID creation was discarded because `"M2" != "M3"`.
See https://github.com/odoo/odoo/issues/49354#issuecomment-614093767
Task: 2235368
Closes#49354closesodoo/odoo#53435
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Before this commit the message "Applicant created" was displayed twice in the chatter.
Task-2278142
closesodoo/odoo#53252
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
When a view is:
- a specific view (duplicated for a specific website)
- inherited by a new view that is translated
the inheriting view will also be duplicated, but the translation will
only be created for the generic version and not the specific ones.
With this changeset, we duplicate translation of arch_db terms of the
generic view onto matching specific views.
Without the change, added test fails with:
AssertionError: '<div>hello</div>' != '<div>hi</div>'
loading module translation copy translation from base to specific view
fixes#51579
opw-2261278
closes#52451closesodoo/odoo#53012
X-original-commit: 989d58d26f8803b40c1411cb97b0171b05d274d7
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
currently, the expense banner is displayed on to many menus like:
'expense report > to Pay, to Post'.
so in this commit,the banner should only be visible in the
'My Expenses' and 'My Expense Reports' menus.
and also removed some unused action from hr_expense.
closes odoo/odoo#52241
Taskid: 2267850
Closes: #52241
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit the font-size for the days/hours left was too big. There is
also a useless scroll bar for the calendar. Adjusting the CSS to remove the scroll bar.
Task-2254820
closesodoo/odoo#52178
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Purpose of this task is,lots of business flows can be crashed if
the field Private Address(address_home_id) is a private address instead
of a regular contact.
so in this commit,we change the demo data for employee and set the
private type address on employee for private address and also fix
the flows on which errors could occur.
Currently billing administrator does not have right for private address
and while creating payment from expense it was going to set the
customer from the employee's private address on payment so give the
private address right to the billing adminnistrator.
Also chaned admin/demo user's private address as 'private' instead of
regular contact.
and on hr_expense use the Sudo while accessing the home address this
method is used from payslip too.
TaskID:2170016
closes odoo/odoo#46628
Closes: #46628
Related: odoo/enterprise#8924
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
When clicking on an image in edit mode, the web editor attempts to find
an attachment that corresponds to the image's URL. In the case of the
website logo, the URL looks like it's referencing an attachment by id or
xml-id, but it's actually neither. This cause a variable to never be
initialized, which in turns causes a traceback when trying to access it
later.
This commit fixes that by always initializing attachment to None.
closesodoo/odoo#53418
X-original-commit: 790e33de190392b937e21c73905db4d48cfb86aa
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This PR allows to display sample (fake) data in empty views, in
the hope of easing user onboarding. This can be enabled (in
list and kanban views) with attribute sample="1" on the arch
root element. In this case, if there is no data to display, sample
data will be generated based on heuristics (depending on field
types and names). This can be used in addition to the no
content helper.
This PR also activates it in a bunch of list and kanban views.
Task 2232801
closesodoo/odoo#53417
Forward-port-of: odoo/odoo#52867
Related: odoo/enterprise#11330
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Jérémy Hennecart <jeh@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
This commit sets attribute sample="1" in a bunch of list and
kanban views, to enable the new sample data feature when views are
empty.
Task 2232801
X-original-commit: 5471309b35619f307242c2704c7681ba63d2be42
Some changes in AbstractModel have been done to ease the
implementation of the sample data feature. This commit reverberates
those changes in other addons.
Part of task 2232801
X-original-commit: dd8069a3c80570e7fa03a80dbb100ab0a182692a
For the sample data feature to work, rpcs done by the view need to
be mocked. This commit properly mocks the 'retrieve_dashboard'
function. It also remove custom no content helper style that was
conflicting with the new style in web.
Task 2232801
X-original-commit: 300bc6d9ac2c1bea823bfc80675ffcf8e5dd3e9f
Previous commit introduces the sample data feature in list and
kanban views. When sample data is displayed, most parts of the
renderers can't be clicked on, to prevent the user from interacting
with sample records (e.g. to open a sample record in form view from
the list). This commit disables keyboard navigation as well, as
those sample records could still be accessed with the keyboard.
To do so, several refactorings have been done in views:
- _giveFocus function added on controllers (so that we can hook
on the moment where we want to focus the renderer, and prevent
it in sample mode), it kind of replaces giveFocus of ActionMixin
which wasn't use from the outside
- updateRendererState -> _updateRendererState as it is private
- _setState function added on controllers, to have a hook when we
set a new state (already existed, but only in kanban)
- _renderView function moved from Basic to AbstractRenderer, so
that we have a proper hook to deactivate clickable elements in
sample mode
Task 2232801
X-original-commit: 4482a03fe2f083f4f44fc6eb76d90ae22afbff91
With this commit, it is now possible to display sample (fake)
data in empty views, in the hope of easing user onboarding.
This can be enabled (in list and kanban views) with attribute
sample="1" on the arch root element. In this case, if there is
no data to display, sample data will be generated based on
heuristics (depending on field types and names). This can be
used in addition to the no content helper.
Task 2232801
X-original-commit: 7c8e627ff5029cb539d702705e5ce53d658c76ed
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Jérémy Hennecart <jeh@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Leftover tooltips may make following tests fail, which isn't what
we want as a test shouldn't impact another one.
X-original-commit: 17a4c72b9a86186c7690bdba5e62ccd64ab2f77a
This commit introduces a new utility function: 'groupBy'. It is
similar in API and result as the underscore method of the same
name.
X-original-commit: 834a1967161dc537cb2d5543314a062dbac08f9c
- Create 2 companies A & B, with different currencies
- Create a product in company B
Set the company on the product
Automated valuation
- Receive some stock in company B
- Switch to company A, and keep B available
- Go to Inventory > Reporting > Inventory Report
The currency on the product is the currency of the product company
instead of the currency of the current company.
The value is computed in the current company currency:
https://github.com/odoo/odoo/blob/bc3d1f2dc408fa91d42743d6a7063042e0f6c42b/addons/stock_account/models/product.py#L115
The currency should be consistent.
opw-2278751
closesodoo/odoo#53426
X-original-commit: 8aa952d18acca5a0ac3b32579e812158e641c13c
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit fixes an issue with deliveries slip
when time < 10 AM in autraslian timezone.
If datetime is 22/06/2020 5AM,
it will be 21/06/2020 on the delivery slip.
This is due to the fact that we use
widget=date on a datetime field.
OPW-2277194
closesodoo/odoo#53425
X-original-commit: c8ec8b4ffbaceb9a58a5ca48bd5a087e779edcc9
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
This commit updates the orderpoint (replenishment) view with the
following changes:
- group "Min Quantity", "Max Quantity", and "To Order" together
- make preferred route "selection" only (note that widget="selection"
does not work in list view => standard workaround applied)
- renaming of order buttons: "Order" => "Order Once" and "Order Always"
=> "Automate Orders"
- add a link to forecasted inventory report for the product (note this
link will show even if there is no data to show in the report)
- remove class decorates from replenishing related buttons ("Order
Once", "Automate Orders", and "Snooze")
Specifications 14 and 15 of inventory usability task.
Task: 2206279
Related Enterprise PR: odoo/enterprise#10723closesodoo/odoo#51681
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit makes the stock rule added delay consistent with the naming
scheme of "Lead Time" used for many other "delay" values. Also adds
"days" to the view for context of what the number means.
Specificiation 9 of inventory usability task.
Task: 2206279
Related Enterprise PR: odoo/enterprise#10723
When an external report layout has not been setup and an admin user
tries to click on Routes: View Diagram within a product form > Inventory
then the document template setup would open even though it is not
necessary for this diagram.
Specification 10 of inventory usability task.
Task: 2206279
Related Enterprise PR: odoo/enterprise#10723
Two stat buttons which should have said "Product Move" said
"Traceability" instead (which is a different stat button.) This
commit fixes this.
This covers specification 6 of overall inventory usability task.
Task: 2206279
Related Enterprise PR: odoo/enterprise#10723
Delivery slip updated to include the backordered products (not
canceled or already done) in a new table. Note that this only goes
1 level deep (i.e. backorders with backorders will not have their
backordered values included).
To support table alignment, small changes were made to existing delivery
slip table.
This covers specification 4 of inventory usability task.
Task: 2206279
Related Enterprise PR: odoo/enterprise#10723
Rename "Inventory" to "Count Sheet" under print dropdown and add in a
"Print Count Sheet" button to inventory adjustment.
This covers specification 2 of inventory usability update.
Task: 2206279
Related Enterprise PR: odoo/enterprise#10723
Before this commit, monetary fields occurring in kanban views
without widget="monetary" specified weren't correctly formatted:
the whitespace separating the value from the currency symbol was
formatted has $nbsp; (html) instead of a simple whitespace.
closesodoo/odoo#52521
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Create a promotion program with conditions:
- Minimum product quantity (ex 2)
- Minimum purchase in currency (ex 500$ tax excluded)
- Auto apply
- On current order
- with reward:
-- Free product (Free Prod A)
-- 1 Quantity
Create a sale order. Insert 3x ProdA @ 1000$. Click on "promotions".
Nothing will occur because the minimum order amount for applying the reward is
calculated removing from the order the product associated with the
reward. This removed all of the products from the order, so the result is 0.
Fixing by subtracting just the amount specified in the reward program.
opw-2274316
closesodoo/odoo#53407
X-original-commit: 804461fb1353c931986eeae94bd3ad8465b604e7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Before this commit the schedule and timezone were only visible in debug mode. As the default timezone is UTC, some misleading information could be displayed in some cases (e.g. planning without internal users).
closesodoo/odoo#52111
Taskid: 2246557
Related: odoo/enterprise#10370
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
- Create 3 products:
A: kg, no tracking
B: kg, tracked by lot
AB: kg, no tracking
- Create a BOM for AB:
1 kg of A
30 g of B
- Create a MO for 1 kg of AB, validate and close the MO
- Unbuild the MO
A stock move for 0.03 g of B is created instead of 30 g.
This happens because we wrongly compare the quantity in the UoM of the
stock move with a normalied quantity.
opw-2278727
closesodoo/odoo#53390
X-original-commit: 6790e89f97d6bbbaab4e071af52cce9ccee98821
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Currently, toast notifications are too far apart with each other if there are
multiple notifications.
So with this commit, we have reduced the margin from the bottom so it looks
closer.
Task : 2278730
closesodoo/odoo#53381
X-original-commit: d43008b38b7b71a5dc1a260560a98ca75e1fafb4
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
* code *must* have an eval_context, `None` would blow up as soon as it
looks for the `'action'` key
* [accidentally quadratic] eval_value returns a value per line, seems
silly to evaluate all lines for each line when we can evaluate all of
them once, then map results to field names
* eval_value doesn't break inside the loop, so every id gets a value
by construction, `dict.fromkeys` is completely unnecessary (and
provides no performance benefits)
closesodoo/odoo#53110
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Taking a self and a separate action seems unnecessary given self *is
an action*.
Only do this change for the "new" naming scheme, so the old one keeps
working as-is.
There is no reason to call these directly, in fact it's not really
possible to do so as they expect an `action` object as first
parameter.
* warn against the presence of rpc-public runners
* move runner selection outside of ``run``
* improve doc a bit maybe
General Purpose : Introduce a new "My Activities" view so that CRM
users can easily overview and process their To-Do list
- new button in "My Activities" tree view : Send Email
Purpose: allow users to send email in one click to the client
- new button in "My Activities" tree view : Send SMS
Purpose: allow user to send sms in one click to the client
- new button in "My Activities" tree view : Snooze
Purpose: easily Snoozes the activity for 7 days
--> today + 7d if deadline < today
--> deadline + 7d if deadline >= today
- New view crm_case_tree_view_my_activities to show "My Activities"
Purpose: Use this view so that CRM users can have a "To Do List"
Domain of this action is : crm.lead, type = opportunity
Filter is : My Activities (at least an activity assigned to me)
- Rename filter "assigned_to_me" to "My Activities"
- Change crm_case_tree_view_oppor to be clearer for the user.
Purpose: allow the user to have an good idea of what he has to do in
a view.
Remove all decorations set on the CRM tree views
Add the widget remaining_days to the field activity_date_deadline
Add the field activity_ids with the widget list_activity
- New menu item and corresponding act_window to display the new views
Task ID 2243124
Community PR odoo#51537
closesodoo/odoo#53376
X-original-commit: 2382c01956feda617b7d207d1bc4d69de1e8b6b3
Related: odoo/enterprise#11314
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
`state` was special cased in `copy_data` such that it would always be
reset to its default value if it had one.
While this special case can be useful (maybe) and is certainly
ingrained in odoo, having it not be overridable can be
problematic. Move the special case to the fields, so it's possible to
explicitly mark state fields as copy.
closesodoo/odoo#53113
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
As users find it odd to have the RUC(Registro Único de Contribuyentes) labeled as VAT(from odoo),
so we are going to add the RUC itself to display the right name for users in Peru
closesodoo/odoo#53366
X-original-commit: aba0b299243c3d9b4615e1066d641aa8360aabac
Signed-off-by: Josse Colpaert <jco@openerp.com>
When you create an ir_ui_view form the backend, the encrypt function
was called with a Falsy value and crash with error:
TypeError: secret must be unicode or bytes, not bool
Now, when you create view from backend, we only set password if it is a qweb
view. In case of update, the field is dirty, so if you don't update it, it
will be not write.
closesodoo/odoo#53348
X-original-commit: 3d9101db0f7cc0adc1f34721c38b4c2f7089566d
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
The attribute has been lost during a previous commit e6695c72d8.
This commit avoid that you can create an ir.ui.view without arch.
Before this commit, if you try to create an ir.ui.view with type but no
arch, the code will raise an exception in _check_xml:
/odoo/addons/base/models/ir_ui_view.py, line 377, in _check_xml
view_arch = etree.fromstring(view.arch.encode('utf-8'))
AttributeError: 'bool' object has no attribute 'encode'
Now, the user will have a warning on create, to say that View Arch field is required.
Could be backported if reported
X-original-commit: 4877bb4b650f5d1c52fefb06dec2fa568afcb121
- Modify `timesheet_action_all` to display the tree view before the grid
view
- In the quotation tree view, order by Status, group by Salesman and
save as filter
- Open a SO with timesheets
- Clck on the 'Timesheets' stat button
An error occurs because the `orderedBy` context key is added in the
action context.
The purpose of replacing the action context is to remove the default
filters. We can simply set an empty dict to avoid any unwanted keys.
opw-2278618
closesodoo/odoo#53339
X-original-commit: 4a0348fed0c7c5b9557d1c9ae2dbf2bbfafcc3a2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Before this commit, checking if the menu was visible or not combined
with checking if we are on desktop or not was enough. Now that we have
website header templates using hamburger which can be enabled in
desktop, this was not enough anymore.
closesodoo/odoo#53307
X-original-commit: 04e95bc191bba8bc3aaa36aec7b61e085744e85b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Bug
===
Install CRM, then go to the lead kanban view and try to generate leads.
An error will be raised.
Technical
=========
In the "iap.account" model, in the `get` method, we can create the IAP
account if it doesn't exist yet. Since 5307f47d975c3b3ebd87c7f7e2248802a1aa5be7
the operation is done in a different SQL cursor than the current one.
The reason is that we need to commit the change, and committing the current
SQL cursor can cause issue and break some flows (mainly if it's not done
at the very beginning/end of the flow).
In the current code, we cache the `account_token` to be able to read it
with the current SQL cursor (otherwise, the current cursor has no access
to the field because change has not yet being committing for it).
But, the cache is invalidated when the "IAP account SQL cursor" is closed.
```python
with self.pool.cursor() as cr:
...
IapAccount = self.with_env(self.env(cr=cr))
account = IapAccount.search(domain, order='id desc', limit=1)
if not account:
if not force_create:
return account
account = IapAccount.create({'service_name': service_name})
# fetch 'account_token' into cache with this cursor,
# as self's cursor cannot see this account
account.account_token
# <---- Cache is invalidated here
...
```
So we can not access the the field value after the invalidation.
Solution
========
The solution is the store the `account_token` value before closing the
"IAP account SQL cursor" and then, after closing it, we add it in the cache.
Task-2277733
closesodoo/odoo#53323
X-original-commit: 32caf74ff10052d2a303fa24d5cc7b37538dd406
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Steps to reproduce the bug:
- Let's consider two companies C1 and C2
- Let's consider that the default company of the current user U is C1
- Log in C2 (only)
- Print the POS details report
Bug:
The header of C1 was displayed.
opw:2274282
closesodoo/odoo#53073
X-original-commit: 59f5e5767445d157d9cd496f6b2b49d516cf003b
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Update translation files to match the latest content
Load also translations for fr_BE
It's common to use fr_BE for Belgian people working in Luxembourg
opw-2278849
closesodoo/odoo#53352
X-original-commit: dadb0d088879f7824ab12763dcaf9d8768d9b787
Related: odoo/enterprise#11309
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
for invoice_reference_model field with selection add property in account.journal set ondelete policy that implements the proper cleanup of the corresponding records upon module uninstallation
account.move type field rename to move_type
closesodoo/odoo#53344
X-original-commit: ef0df0562cc5d296006a3288672031fe4f4621e0
Signed-off-by: Josse Colpaert <jco@openerp.com>
On ir.property model, do get the field_id using the cached result from
ir.model.fields _get() method instead of issuing a direct SQL query
OPW-2067461
closesodoo/odoo#53351
X-original-commit: 24fff41d02fc7469d563f732a607db5c9a150e1e
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Since dd139948f0 when saving oe_structure for the first time, for eg.
a `<div class="oe_structure" id="oe_structure_part_1"/>` structure, when
edited we will create an inheriting view that fills it.
But this inheriting view would contain branding data and "data-note-id"
which would make this use case erroneous:
- edit page and fill oe_structure => data-note-id="1" saved on view
- edit page and add link in other oe_structure => error
This happen because the data-note-id refers to the editor of the
element currently being edited, since we saved it previously we get two
elements with `data-note-id="1"` and the code will just get the first
one which in reality could have not been in editing.
With this change, we strip the branding data on the parent element.
Without the change, added test failed with:
AssertionError: '<div class="oe_structure" data-test="1"
id="oe_structure_test" test="2">hello</div>' not found in
'<t t-name="dummy"><div class="oe_structure" data-test="1"
id="oe_structure_test" data-oe-id="55" test="2">hello</div>
</t>' :
saved element attributes are saved excluding branding ones
opw-2268836
closes#53321closesodoo/odoo#53346
X-original-commit: 855438be92ee71d8f8d5afedd52459e149ec49f7
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>