On Sales order confirmation, a project can be create. The project
company is not correctly propagated: the created project should
be in the same company as the SO.
To stay consistent, during the sold quantity conversion into the
planned hours of a task, we need to use the SO company instead of
the one of current user.
Task-1999686
As task can be billed, it became a important business model. To avoid mistakes in a multi company
environment, we need to make the company_id field required. Indeed shared task can be problematic
with access rights when a employee will log timesheet from another company in a task that is not in
the same company as its project.
To populate this field, we recommend to take the company of task's project, or to fallback on
the company of the user that created one.
Task-1999686
The sales order is a important model. Since it generates invoices and other business
documents, the company_id field should be required as the company must be propagate
to generated documents.
Moreover, a sales order without a company raises a error, and we need a company to
compute the multi currency rate.
This commit fixes that bug, by setting the company_id field required on sales order
and sale order line.
Note: we only simplify the ir.rule of sale.order, and not the one of
sale.order.line. Indeed, when creating an SOL, the creation is done
in 2 times by the ORM: first insert, then UPDATE with computed stored
fields. As company_id of SOL is a stored related, the check access rules
raises during the inconsistent state (between INSERT and UPDATE,
company_id is False).
Maybe this will be clean after the big refactoring of the ORM.
Task-1999686
The following trick used to work, because `sudo()` was actually making
an environment for the superuser to operate upon:
request.env[...].sudo().method(...)
It no longer works in general, since `sudo()` now makes an environment
in superuser mode but with `uid=None`! It may still work by accident
for operations that never use `env.uid`, but is broken in general.
Using `auth='public'` fixes the problem by using the public user when no
user is available.
closesodoo/odoo#34297
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Before the fix, it was possible to validate a bank statement of a POS without validating the entire POS session.
After the fix it's impossible to validate the bank statement of an opened POS session. We now have an error message if we try to do it from accounting app and can't see the validate button anymore from the POS app.
TASK-ID: 2001551
closesodoo/odoo#33986
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Steps to reproduce:
Open a POS session and add an order with a few items on it, but
don't submit a payment for that order.
Exit, close and validate/post the POS session
Open another POS session
Current behavior:
The unpaid order vanished into Never Never Land, never to be
found again.
Expected behavior:
Either an error should be displayed when trying to close a
session with outstanding orders, or any open orders should
be automatically moved to the next open session. If I had
the choice, I would much prefer the second option, plus a
warning message when closing the session.
Closes https://github.com/odoo/odoo/issues/16151
TAK-ID: 1918354
closesodoo/odoo#33395
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Since changes made on decimal precision access rights in rev: a1eb000c93
the pos user doesn't have access anymore to decimal precision model in
read access.
So we've added the read right on this model for the pos user.
In fiscal position, fields from 'ZIP range' were not supporting the ZIP range with 'char' field and only support 'integer'. It was a problem in some countries like Canada.
task 1948120
closesodoo/odoo#31910
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Also make a base performance class for some context and users in order
to lessen a big file size.
closesodoo/odoo#34547
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this task, when a customer bought a course, he was directly
redirect to the checkout process.
After this task, the customer can either Add to Cart or Buy Now
(if the Buy Now option is activated)
This commit also updated the redirection regex in website_sale_product_
configurator. When a product has an optional product, you have the possibility
to add in your cart the optional product thanks to a modal. Before, the button
"Add to Cart" was only available in the shop (/shop/), but now it is also
available on a course (/slides/). So to be redirected on the cart when we
click on the button "Proceed to Checkout" for a course, we needed to apply the
redirection also for the course.
Linked to task 1974929
Related to PR #34224
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Now we can have eCommerce and eLearning without automatically willing to
sell courses. The auto_install in the manifest was also blocking the
possibility to uninstall the module. When we tried to uncheck the option for
selling course, it reinstalled it just after we had saved the change in the
settings.
Linked to task 1974929
Related to PR #34224
Since previous commit moved decimal_precision module's feature into base,
use the new syntax for fields declaration
Remove the imports to the removed module
Remove the module from dependency in manifest
sed -i "s|digits=dp.get_precision('\([A-Z a-z]*\)')|digits='\1'|" **.py
sed -i "/from odoo.tools import decimal_precision as dp/d" **py
The decimal precision feature makes sense to be an ORM feature, no need to be
in a specific module
Previous syntax was
from odoo.addons import decimal_precision as dp
fields.Float(digits=dp.get_precision('Foo'))
and now is:
fields.Float(digits='Foo')
Remove the possibility to have a callable method on the digits attribute (it
was only used for precision anyway) and directly retrieve the digits on the
decimal.precision model
Rename the method digits to get_digits to avoid confusion between the field
attribute when declaring a field and the method to retrieve the precision
Task id: 48198
For 3000 lines (3 for 1000 products):
- 35s before this commit
- 22s after this commit
Gain around 30%
closesodoo/odoo#34295
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
In a list/kanban view when applying a default_order on the view, it does not
work with favourite filter
Before this commit,
1) The default_order was not applied to the view when favourite filter is
applied
2) when default_order applied, Click on an element of the list/kanban and
then go back to the list/kanban with the breadcrumbs, default_order has been
changed.
This is because the ```_getOrderedBy ``` returns [] when favourite filter is
applied and it does not have sort value, added check if favourite has orderedBy
and has length then and only then pass orderedBy else pass undefined
After this commit,
1) default_order will be applied to the view
2) default_order will not be changed when going back through breadcrumbs
task-1922576
closesodoo/odoo#34001
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
On Inventory Adjustment lines view, when you set serial number for a
tracked product, its quantity is automatically set on 1.
Task #2025397closesodoo/odoo#34301
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Purpose
=======
This commit adds the attempt number on the answer (= survey.user_input)
form & tree views.
The attempt number is always relative to its "pool" of attempts and
depends on the "invite_token" if specified.
ex: Attempt n° 2 / 4 (where "4" is the attempts_limit of the related survey).
closesodoo/odoo#31771
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose of this commit is to improve and add tools, methods and data to test
mail and SMS features. We also add tests for current implementation of SMS
feature, allowing to better understand future changes.
[ADD] test_mail_full
* have a module depending on mail sub-applications like sms or snailmail.
Its purpose is to check that standard mail features work effectively with
all overrides and extra behaviors activated;
* add a new model specific for SMS gateway, with default recipient
computation;
* add SMS tests for SMS module adding SMS capabilities linked to mail
feature. This commit tests SMS feature before the upcoming refactoring
and improvement of SMS module in community: posting with SMS and sms
composer usage;
In test_mail
* add necessary mobile information on test partners;
* improve assertBusNotification that was not correctly asserting all items
in message of bus notifications;
In sms
* add mock for SMS sending. Purpose is to mock the connection to IAP
services by mocking the call to IAP server. It allows to perform SMS
tests without having to contact (and pay) for this service;
* allow some customization when calling the SMS gateway mock to simulate
errors and test corner cases;
Related to task 1922163
Linked to PR #34516
Purpose of this commit is to support more formatting options in phone tools,
to provide new API methods for phone numbers validatio. It also introduces
a method on sms.api to send SMS in batch. This one uses a new route given
in IAP services that send a batch of SMS instead of sending them one by one.
Concerning phone validation, tools are updated to correctly handle all
format supported by phonenumbers library. Indeed in addition to national
and international formatting phonenumbers library also supports E164
(international without spaces) and RFC3966 (beautification of phone numbers).
Let us support them and ease the use of our small tool methods in various
addons, notably sms.
Cleaning / check tools methods are added in phone validation module. Various
methods allow to sanitize phone numbers according to a context record and/or
some parameters. Those tools will be used in upcoming sms refactoring.
Another purpose of this commit is to add phone_validation in dependencies
of SMS application. Phone_validation module adds tools to parse and format
phone numbers and allow to replace the manual check done currently. Adding
it in dependencies of SMS does not change anything functionally as
* library is still optional. If phonenumbers library is not installed the
features are skipped without crashing;
* no model is modified as it introduces only tools and a mixin. Models are
updated in crm_phone_validation that updates lead and partner models;
Related to task 1922163
Linked to PR #34516
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
Co-Authored-By: Pierre Rousseau <pro@odoo.com>
Purpose is to prepare future improvements in mail and SMS module. In this
commit we apply some guidelines on XML Ids and file naming.
In mail cancel wizard code is separated from the resend one as they have
nothing in common.
More importantly ``sms.send_sms`` model is renamed to ``sms.composer`` to
avoid underscores (which is really really bad, take a look at
ir.config_parameter) and have a meaningful name.
Related to task 1922163
Linked to PR #34516
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
Co-Authored-By: Pierre Rousseau <pro@odoo.com>
Product "Update Quantity" button can open the "Change Product Quantity"
wizard if all advanced stock options (stock locations, assign owner,
tracking by SN/LN, packaging) are disabled.
Task #2006337closesodoo/odoo#33873
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
On editable list quant view, when user come from a single product (one
specific product variant, or product template with no variants), the
`product_id` field is hidden.
Task #2006337
All of those fields `__get__` and method calls have a cost, it is small but when
done for many records it adds up, so they are better not done.
When creating 1000 products without image, this compute takes:
47ms +/- 1ms before the commit
37ms +/- 1ms after the commit
That's around 20% less.
Part of task-1918881
closesodoo/odoo#34294
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
If `self` contains around 1000 records, this reduces the time of the method by
a factor of 10 when `read` is necessary, and by 200 when using the values from
`vals_list` and no additional query is needed at all.
This speeds up the creation of all models using `mail.thread`.
Part of task-1918881
closesodoo/odoo#34274
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Add comment on both methods to clarify their goal.
Remove the unnecessary check. Indeed the `product.template.attribute.value` is
not displayed during the variant set up of the product template so there is no
point to check the context for it.
Update the view to apply the context change also for the search result. Indeed
the context change on the o2m itself didn't propagate so the attribute was
displayed unnecessarily on the search result.
closesodoo/odoo#34187
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Before this commit, it was impossible to know which view was the one searched
if there was COW views.
Indeed, since multiwebsite, views might get duplicated from one website to
another. Then, when searching for an ir.ui.view in a form view, every
duplicated view would be listed next to each other with the exact same name
without a way to identify which one comes from which website.
This commit will suffix the view name by its website_id if there is one.
To do so, we use the context key that has been introduced with 62d73253f3.
task-1920052
closesodoo/odoo#33307
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
File `calendar_mismatch.scss` was wrongly in a `css` folder
while it should be in a `scss` folder according to the guidelines.
And set the correct `type="text/scss"` instead of `type="text/css"`
for a .scss file.
closesodoo/odoo#34478
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Commit f17655d introduced a new file (`views/assets.xml`) in
the manifest to load a new scss file. But it also deleted from
the manifest an existing file (`views/hr_contract_templates.xml`)
without moving the content from removed file to the new file.
Hence, style defined in `calendar_mismatch.scss` was never loaded.
Purpose
=======
Since the new company switcher, it's now easier
to manage records of different companies.
Specification
=============
Add a multi company `ir.rule` for `fleet.vehicle`.
closesodoo/odoo#34426
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
If we were using Units of Measure before, the pos order line didn't show what unit we were using. Now we display the Units of Measure in the order line if the option is active.
TASK-ID: 2001995
closesodoo/odoo#33915
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This makes the media easier to sort than manually manipulating their sequence.
task-2029597
closesodoo/odoo#34440
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit merges the following models
* account.invoice and account.move
* account.invoice.line and account.move.line
* account.voucher and account.move
* account.voucher.line and account.move.line
It was the opportunity for a big cleanup of the code, so it also restructures the whole account module, its different models/fields, the tests etc. for a better world and a better code readability.
==== Rationale ====
The rationale of this huge change is that we want journal entries / invoices to be easily edited, and changes reflected in the other model. It's a HUGE feature and very strategic for the fiduciary companies. For example, changing the account of a journal entry needs to be automatically reflected on the related invoice.
The same reasoning applies to sale/purchase vouchers.
==== Changes made in features =====
When creating an invoice, you are now creating a journal entry directly.
--> The object account.invoice no longer exists.
In the same fashion when creating an invoice line, you're now adding journal items directly in the journal entry representing the invoice. If this invoice line has some tax, it may create additional journal items as well.
--> The models account.invoice.line & account.invoice.tax no longer exist
Identically, when creating a sale/purchase receipt with its lines, you are now creating a journal entry directly and there's no more usability difference between encoding a receipt or an invoice.
--> The object account.voucher no longer exists.
--> The object account.voucher.line no longer exists.
--> The whole account_voucher module no longer exists.
Positive side-effects coming from these changes are
* draft invoices/bills/sale or purchase receipts now create a draft accounting entry. Validate these objects now simply post its journal entry. That means that draft invoices/bills/sale or purchase receipt can straightforwardly be included in reporting or budgets.
* opening a journal entry in form view will now always open the correct view: if it's a sale/purchase journal entry we will have a customer invoice/vendor bill view or a sale/purchase receipt view, whatever the menu we're coming from.
* code & business logic simplification. It is also condensed in a single place instead of being partially duplicated on invoices, vouchers and journal entries.
There should be no feature loss, except the one allowing to group multiple journal items together based on the same product during the invoice validation.
==== Changes made in models =====
* account.invoice: model removed. Instead, now use account.move with following mapping
field (account.invoice) field (account.move)
----------------------- --------------------
name invoice_payment_ref
number name
reference ref
comment narration
user_id invoice_user_id
amount_ total_company_signed amount_total_signed
residual amount_residual
state state + invoice_payment_state /!\ selection changed
date_invoice invoice_date
date_due invoice_date_due
sent invoice_sent
origin invoice_origin
payment_term_id invoice_payment_term_id
partner_bank_id invoice_partner_bank_id
incoterm_id invoice_incoterm_id
vendor_bill_id invoice_vendor_bill_id
source_email invoice_source_email
vendor_display_name invoice_vendor_display_name
invoice_icon invoice_vendor_icon
cash_rounding_id invoice_cash_rounding_id
sequence_number_next invoice_sequence_number_next
sequence_number_next_prefix invoice_sequence_number_next_prefix
'invoices' subset of account.move can be accessed by using the selection field 'type' or one of the many helpers like is_invoice()
* account.move: now has a valid state 'cancel' that has to be excluded from all business logic
* account.move: field 'amount' renamed into 'amount_total'
* account.move: field 'reverse_entry_id' renamed into 'reversed_entry_id'
* account.move.line: now has a field 'display_type' that has to be excluded from all business logic, in order to support invoice layouting
* account.invoice.line: model removed. Instead, now use account.move.line with following mapping
field (account.invoice.line) field (account.move.line)
---------------------------- -------------------------
invoice_id move_id
uom_id product_uom_id
invoice_line_tax_ids tax_ids
account_analytic_id analytic_account_id
'invoice lines' subset of all account.move.line from a journal entry can be accessed by using the boolean field 'exclude_from_invoice_tab'
* account.invoice.tax: model removed. Instead, now use account.move.line with following mapping
field (account.invoice.tax) field (account.move.line)
--------------------------- -------------------------
invoice_id move_id
account_analytic_id analytic_account_id
amount price_unit
base tax_base_amount
'tax lines' subset of all account.move.line from a journal entry can be accessed by using the relational field 'tax_line_id'
* account.invoice.confirm: model removed. Instead, now use the 'post()' function of account.move
* account.invoice.refund: model removed. Instead, now use account.move.reversal to reverse the entries with the same options as we had for invoices
* account.voucher: model removed. Instead, now use account.move of type in ['out_receipt', 'in_receipt]
* account.voucher.line: model removed. Instead, now use account.move.line
==== Changes made in functions ====
* on account.move, method _run_post_draft_to_post() renamed into _autopost_draft_entries()
* on account.move, method action_account_invoice_payment() renamed into action_invoice_register_payment()
* on account.move, method action_invoice_reconcile_to_check() renamed into action_open_matching_suspense_moves()
* on account.move, method _get_domain_edition_mode_available() renamed into _get_domain_matching_supsense_moves()
* on account.move, method _get_intrastat_country_id() renamed into _get_invoice_intrastat_country_id()
* on account.move.line, method _get_domain_for_edition_mode() renamed into _get_suspense_moves_domain()
* in account.bank.statement, contextual key 'edition_mode' renamed into 'suspense_moves_mode'
Was task 1917430
Let's assume a one2many field in a form view with a default value
with commands 4 (link to). Before this rev., when saving the record,
the BasicModel generated a command 4 and a command 1 (update) for
each record, with the values of the record (directly coming from DB).
This can cause an issue when the related record can't be edited
(e.g. a posted journal entry in accounting).
closesodoo/odoo#33797
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit merges the following models
* account.invoice and account.move
* account.invoice.line and account.move.line
* account.voucher and account.move
* account.voucher.line and account.move.line
It was the opportunity for a big cleanup of the code, so it also restructures the whole account module, its different models/fields, the tests etc. for a better world and a better code readability.
==== Rationale ====
The rationale of this huge change is that we want journal entries / invoices to be easily edited, and changes reflected in the other model. It's a HUGE feature and very strategic for the fiduciary companies. For example, changing the account of a journal entry needs to be automatically reflected on the related invoice.
The same reasoning applies to sale/purchase vouchers.
==== Changes made in features =====
When creating an invoice, you are now creating a journal entry directly.
--> The object account.invoice no longer exists.
In the same fashion when creating an invoice line, you're now adding journal items directly in the journal entry representing the invoice. If this invoice line has some tax, it may create additional journal items as well.
--> The models account.invoice.line & account.invoice.tax no longer exist
Identically, when creating a sale/purchase receipt with its lines, you are now creating a journal entry directly and there's no more usability difference between encoding a receipt or an invoice.
--> The object account.voucher no longer exists.
--> The object account.voucher.line no longer exists.
--> The whole account_voucher module no longer exists.
Positive side-effects coming from these changes are
* draft invoices/bills/sale or purchase receipts now create a draft accounting entry. Validate these objects now simply post its journal entry. That means that draft invoices/bills/sale or purchase receipt can straightforwardly be included in reporting or budgets.
* opening a journal entry in form view will now always open the correct view: if it's a sale/purchase journal entry we will have a customer invoice/vendor bill view or a sale/purchase receipt view, whatever the menu we're coming from.
* code & business logic simplification. It is also condensed in a single place instead of being partially duplicated on invoices, vouchers and journal entries.
There should be no feature loss, except the one allowing to group multiple journal items together based on the same product during the invoice validation.
==== Changes made in models =====
* account.invoice: model removed. Instead, now use account.move with following mapping
field (account.invoice) field (account.move)
----------------------- --------------------
name invoice_payment_ref
number name
reference ref
comment narration
user_id invoice_user_id
amount_ total_company_signed amount_total_signed
residual amount_residual
state state + invoice_payment_state /!\ selection changed
date_invoice invoice_date
date_due invoice_date_due
sent invoice_sent
origin invoice_origin
payment_term_id invoice_payment_term_id
partner_bank_id invoice_partner_bank_id
incoterm_id invoice_incoterm_id
vendor_bill_id invoice_vendor_bill_id
source_email invoice_source_email
vendor_display_name invoice_vendor_display_name
invoice_icon invoice_vendor_icon
cash_rounding_id invoice_cash_rounding_id
sequence_number_next invoice_sequence_number_next
sequence_number_next_prefix invoice_sequence_number_next_prefix
'invoices' subset of account.move can be accessed by using the selection field 'type' or one of the many helpers like is_invoice()
* account.move: now has a valid state 'cancel' that has to be excluded from all business logic
* account.move: field 'amount' renamed into 'amount_total'
* account.move: field 'reverse_entry_id' renamed into 'reversed_entry_id'
* account.move.line: now has a field 'display_type' that has to be excluded from all business logic, in order to support invoice layouting
* account.invoice.line: model removed. Instead, now use account.move.line with following mapping
field (account.invoice.line) field (account.move.line)
---------------------------- -------------------------
invoice_id move_id
uom_id product_uom_id
invoice_line_tax_ids tax_ids
account_analytic_id analytic_account_id
'invoice lines' subset of all account.move.line from a journal entry can be accessed by using the boolean field 'exclude_from_invoice_tab'
* account.invoice.tax: model removed. Instead, now use account.move.line with following mapping
field (account.invoice.tax) field (account.move.line)
--------------------------- -------------------------
invoice_id move_id
account_analytic_id analytic_account_id
amount price_unit
base tax_base_amount
'tax lines' subset of all account.move.line from a journal entry can be accessed by using the relational field 'tax_line_id'
* account.invoice.confirm: model removed. Instead, now use the 'post()' function of account.move
* account.invoice.refund: model removed. Instead, now use account.move.reversal to reverse the entries with the same options as we had for invoices
* account.voucher: model removed. Instead, now use account.move of type in ['out_receipt', 'in_receipt]
* account.voucher.line: model removed. Instead, now use account.move.line
==== Changes made in functions ====
* on account.move, method _run_post_draft_to_post() renamed into _autopost_draft_entries()
* on account.move, method action_account_invoice_payment() renamed into action_invoice_register_payment()
* on account.move, method action_invoice_reconcile_to_check() renamed into action_open_matching_suspense_moves()
* on account.move, method _get_domain_edition_mode_available() renamed into _get_domain_matching_supsense_moves()
* on account.move, method _get_intrastat_country_id() renamed into _get_invoice_intrastat_country_id()
* on account.move.line, method _get_domain_for_edition_mode() renamed into _get_suspense_moves_domain()
* in account.bank.statement, contextual key 'edition_mode' renamed into 'suspense_moves_mode'
Was task 1917430