Commit Graph
140847 Commits
Author SHA1 Message Date
Swapnesh Shah cbd103eafc [FIX] sale_coupon: expected singleton archiving coupon
Before this commit, There was expected singleton tracback on Archiving multiple Coupons at once.
With this commit, We are passing single Record to process.

This is manual Forward port of https://github.com/odoo/enterprise/pull/9637
(Coupons modules went from OE to OC in saas-12.3)

closes odoo/odoo#48996

X-original-commit: d8c2c7269560920511598414741ad42e1f7a0213
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-04-03 18:41:06 +00:00
Xavier Morel 9d37cecfca [FIX] core: iterations on LRU
Iteration methods on LRU were removed because they were not
thread-safe and it's not clear that making them thread-safe is the
correct thing to do, so not providing them seems saner.

I thought I'd looked for usages of the LRU but apparently didn't look
hard enough as I missed that it's used by the cron workers (apparently
using the threaded server we only run crons for dbs currently living
in the registry cache, the more you know).

Convert these to iterating on the LRU's internal mapping, and also
don't iterate on the LRU to clear its entries one by one when we can
just clear the entire thing safely, although Registry.delete_all
really seems completely unused.

closes odoo/odoo#49023

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-06 09:45:29 +00:00
Pierre Paridans eacc9bfe25 [FIX] web: remove script tag for non-existing test file
This JS test file has already been moved to enterprise.

Upgrade note: updating this template is not mandatory for existing
databases, but a nice to have for new ones.

closes odoo/odoo#49020

X-original-commit: 7b00581a249556695fbfc1b21cbe30d4c702787e
Related: odoo/enterprise#9685
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-04-06 09:37:20 +00:00
Toufik Ben Jaa b0cd9c13a0 [FIX] payment: use order company on payment page
- The payment link generated by using the wizard
    `payment.link.wizard` are overriden to generate
    URL linked to sale orders.

    If so, we want the payment acquirer displayed to
    be in the same company as the sale order.

closes odoo/odoo#49018

X-original-commit: 8c299efb6cb4355cec39cdedd8d7c3134f53d199
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-04-06 09:24:28 +00:00
oco-odoo 473be98911 [IMP] l10n_ch: remove old development TODO
Oopsy! 0:)

closes odoo/odoo#49005

X-original-commit: 6827757f6dbe2692a5b343b2227240c69d1a4af5
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-04-04 18:12:23 +00:00
Florent de Labarre c2ee3c11a7 [FIX] website_sale : Use the current company
Use the company set there: https://github.com/odoo/odoo/blob/12.0/addons/website_sale/data/mail_template_data.xml#L19

opw:2226703

closes odoo/odoo#48828

X-original-commit: 9bcf008b2ef150deb034d2e787ef5c0bd909fbe8
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-04-02 08:16:25 +00:00
Ankita Raval 4e137f8ff2 [FIX] account: fix ambigius issue.
In this commit,we add a proper reference on credit and debit
because we are referencing an attribute or attributes that
belong to more than one of the tables we are using in the query,
and have not qualified the attribute reference.

closes odoo/odoo#48796

X-original-commit: 9de090926390e2f02dea979347b477e31bc9188f
Signed-off-by: Christophe Simonis <chs@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-01 20:49:41 +00:00
Xavier Morel 4b7ac65e17 [FIX] survey: use absolute paths
On redirection, werkzeug converts locations from relative to absolute
URLs. Apparently the specific algorithm when given a relative *path*
changed between 0.14 and 0.15, or possibly these paths suddenly became
processed whereas before they were interpreted as absolute?

So in Werkzeug 0.14, `redirect('foo/bar')` was treated as
`redirect('/foo/bar')` but in 0.15 it's first urljoin-ed to the
current path before the redirection is effected.

This is an issue with slides, because survey's get_start_url returns
the url `survey/start/<access_token>` without a leading slash.

The result is that where with 0.14 the certification tour would do this:

    GET /slides_survey/slide/get_certification_url?slide_id=39&fullscreen=1
    GET /survey/start/<id>?answer_token=<token>

with 0.15 or above it does this:

    GET /slides_survey/slide/get_certification_url?slide_id=39&fullscreen=1
    GET /slides_survey/slide/survey/start/<id>?answer_token=<token>

Which weirdly enough doesn't work at all.

closes odoo/odoo#48982

X-original-commit: 82a23883748172c05d2562f244ffbc1558ce01fc
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-03 14:19:01 +00:00
Katherine Zaoral d2d1720525 [FIX] l10n_ar: invoice report identification name
Show the identification type name instead of always show VAT in the customer information on the invoice report

closes odoo/odoo#48801

X-original-commit: 5a7ff2c932ae9abe4207291cc20e52a401a560a2
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-04-01 20:56:15 +00:00
Gustavo Valverde 65e457b215 [FIX] l10n_latam_invoice_document: Remove non-existent field
When printing an invoice using l10n_latam_invoice_document it crashes as res.partner does not have an attribute 'l10n_latam_identification_type_id', keeping the whole xpath is not needed as the VAT label is already considered in the account module: https://github.com/odoo/odoo/blob/13.0/addons/account/views/report_invoice.xml#L10

closes odoo/odoo#48800

X-original-commit: 9f0bf9bcaa6c21c36d5abdc5316aa80cef67f12f
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-04-01 20:55:55 +00:00
Paul Morelle d2a1d72be8 [FIX] account: ensure followers are internal users
On invoices, we had cases where the supplier was added as a follower to
the invoice, and an email was sent to them.

This commit adds tests that reproduce the same follower assignment that
happened in saas-12.3, and fixes the issue for 13.0.

We also treat the case when custom_values is None (the default value),
and call the super method instead of just returning False.

Since saas-13.2, account.move.name is computed, so there is no default
value, and no need to specify it at the invoice creation.

closes odoo/odoo#49004

X-original-commit: 4a32716c0c57fe904e1aeea63926fb5b65e3516b
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
2020-04-04 17:47:16 +00:00
Katherine Zaoral 761be431ed [IMP] l10n_cl: update module views to match with removed fields in l10n_latam_invoice_document module
closes odoo/odoo#47547

Related: odoo/enterprise#9216
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-04-01 16:50:11 +00:00
Katherine Zaoral c765bce768 [IMP] l10n_ar: adapt code to remove sequences
* remove logic of sequences in invoices and use new logic to make it work
* add logic do to not let the user to change the pos number in the document number
* update translations
2020-04-01 16:49:04 +00:00
Katherine Zaoral e8286ce4d9 [IMP] l10n_latam_invoice_document: adapt to new sequences
* remove logic of sequences in invoices and use new logic to set invoices sequences.
* re add l10n_latam_document_number field to make the sequence set possible.
* replace type field with move_type field in model account.move
* add new field l10n_latam_manual_number to know when the document number should be or not set
* update compute highest_name everytime that the journal and document type change.
* implement how we deal with first number
* for customer invoices only compute the name after they has been posted
* be able to search by document type code
* update translations
2020-04-01 16:48:53 +00:00
Katherine Zaoral 396ddbb705 [REF] account: make it possible to find your own highest query 2020-04-01 16:43:39 +00:00
Simon Lejeune 0172a12298 [FIX] stock: return: allow stock user to unlink line
Unlinking a return line is convenient and should be allowed for stock
user. Note that the same functionality could be achieved by setting the
quantity to 0 on the line.

related to 65530dfd6a

closes odoo/odoo#48988

X-original-commit: dc77519066993ed245ef863cdf42f6c25e10c99c
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-04-03 15:31:06 +00:00
Christophe Monniez 017361d056 [FIX] web: skip calendar timezone drage and drop qunit test until fixed
Following 889dd9245, there is still a qunit test that randomly crash.

closes odoo/odoo#48977

X-original-commit: cb76a00226cf22d1ed659d736a36fa9b92e0a512
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-03 13:17:12 +00:00
Aaron Bohy ebb94e6299 [IMP] web_tour: reset tours from debug manager
This commit improves the "Start tour" dialog accessible via the
DebugManager. It is now possible to reset a tour to its initial
step, so that it can be re-executed (in onboarding mode). The
content of the dialog has been reworked as well:
  - testing tours are displayed in another table
  - tour sequence is displayed
  - tours are sorted by sequence, and by name.

Task 2229909

closes odoo/odoo#48892

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-04-03 10:13:33 +00:00
Xavier Morel 1b30a78beb [IMP] core: rebuild LRU on OrderedDict
That's pretty much the entire point of OrderedDict's existence.

Also removed the iteration methods: they're not used and they're not
thread-safe, since they're written as generators they "return"
instantaneously when called immediately unlocking, then the iteration
itself is unprotected, so the entire thing is useless.

They could be reimplemented with explicit locking (a `with self._lock`
internally) if there's ever a use case for it, but that doesn't seem
to be the case at the moment.

closes odoo/odoo#46061

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-03 13:16:46 +00:00
Victor Feyens e167f4aeae [FIX] sale_product_matrix: indeterministic tour failure.
Unexpectedly, it sometimes happen in runbot tests that sales order lines
are opened in readonly mode when the sales order is in edit mode.

The SO lines modal shouldn't open at all in SO edit mode because the
lines are editable inline.

closes odoo/odoo#48974

X-original-commit: 7cb2e0cc881eabbd1b24afc0b96fa9caa90a26b4
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-04-03 12:48:01 +00:00
Odoo's Mergebot 90f8d9a5df [REF] marketing apps: better use toggle_active
Purpose of this merge is to call toggle_active or archive / unarchive methods
instead of manually writing on active field. Indeed this allows to trigger
business code related to archive / unarchive which is normally located
in toggle_archive (called by action_archive and action_unarchive).

We also improve some active-related behavior, notably

  * correctly cascade channel archive status to its slides;
  * cascade survey archive status to its certification badge;
  * fix opportunity lost / activated subtype in crm;

See sub commits for more details.

Task ID 2170708
Community PR #46563

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-03 15:28:07 +02:00
Thibault Delavallée d73a92505c [IMP] website_slides: implement archive cascade behavior in toggle_active
Purpose of this commit is to make use of toggle_active to implement business
behavior linked to active field being changed. In this commit we move the
business specific code from write to toggle_active. When archiving a channel
its slides are archived.

In this commit we also track active field for courses and slides, allowing
to see flag changes in chatter.

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:29 +00:00
Thibault Delavallée 6cf824933f [IMP] survey: cascade archive of a survey to its badge
Purpose of this commit is to synchronize active status of certifications to
their badges. When archiving or activating a certification, its badge is also
archived or activated.

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:29 +00:00
Thibault Delavallée bea9bc3d6c [IMP] mail, mass_mailing, phone, survey: call toggle_active / action_(un)archive when possible
Purpose of this commit is to call toggle_active or archive / unarchive methods
instead of manually writing on active field. Indeed this allows to trigger
business code related to archive / unarchive which is normally located
in toggle_archive (called by action_archive and action_unarchive).

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:28 +00:00
Thibault Delavallée 9b76c6b7f1 [IMP] crm: better use toggle_active and add business behavior in it
Purpose of this commit is to make use of toggle_active to implement business
behavior linked to active field being changed. In CRM notably

  * when archiving: it is considered as lost, and therefore probability is
    set to 0;
  * when reactivating: void the lost reason and update probabilities for PLS;

In this commit we also update tracking subtype to more clearly track
lost / restored subtypes

  * lost: writing a lost reason (resetting it is not lost), archiving
    it if no other subtype;
  * restored: activating it again;

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:28 +00:00
Thibault Delavallée 318f02b8e8 [REF] base: replace toggle method by already-existing toggle_active for ir.ui.view
Toggle method defined on ir.ui.view does the same job of toggle_active that
is the generic one available on all models.

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:28 +00:00
jvm-odoo 15227170cb [FIX] website_forum: fix answer name disappear after edit
Issue

	- Install Forums
	- Create a post (name = test)
	- Add an answer
	- Check your profile > answers

	You have an answer named "Re: test"

	- Edit the answer
	- Check again

	"Re: test" disappeared, it's a blank line now

Cause

	When editing the answer, we do not pass a name
	So if we do name = kwargs.get('name') => None

Solution

	Pass the name to the vals if it exists

OPW-2227418

closes odoo/odoo#48970

X-original-commit: c53f1c6a58b4c8c9e9b3c87f27281c9bfd65a0e1
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-04-03 11:58:56 +00:00
Raphael Collet 0563093d1e [IMP] ir.ui.view: optimize _compute_arch
Simply avoid computing a field when not necessary.

This saves 0.5% of the total installation time.

closes odoo/odoo#48967

X-original-commit: f3fa93228b6ea8e9e171aaa508ca0218d70406f3
Related: odoo/enterprise#9655
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-03 11:40:30 +00:00
Raphael Collet 8a3e1a0ccd [IMP] ir.ui.view: call _update_user_groups_view() once per install
This saves 1.5% of the total installation time.

X-original-commit: afd39e1a9824252d13823e484c60ad813b9b51a6
2020-04-03 11:40:30 +00:00
Raphael Collet a233d534c2 [FIX] core: add NOT NULL constraints in post-init
The method `_init_column` for the field `alias_id` of `mail.alias.mixin`
requires the reflection of models, because `mail.alias` records have a
many2one field to `ir.model`.  The actual initialization of the column
is thus performed in post-init phase (after reflection).  Therefore, the
NOT NULL constraint cannot be added right away.

X-original-commit: 2e3400f149ce4ed4c00bc49a519f58993b49bc51
2020-04-03 11:40:29 +00:00
Raphael Collet 9afce4805f [IMP] core: reflect models, fields and selections in batch
This saves 4.5% of the total installation time.

X-original-commit: 8519064dce975af542ccd30dc14c56b9bb36d07b
2020-04-03 11:40:29 +00:00
Raphael Collet 6eb7d5c6a0 [IMP] core: add/update foreign keys in batch
This greatly reduces the number of queries to add foreign keys (notably
for many2one fields).

This saves 6.5% of the total installation time.

X-original-commit: 13a2666b4da09fc0ec7608a974dadde45f76fd7a
2020-04-03 11:40:29 +00:00
Raphael Collet e0c2dde324 [IMP] core: create/drop indexes all at once
Reduce the number of queries to create and drop indexes.

This saves 1.5% of the total installation time.

X-original-commit: 0e1e480da9d971575feba64038c4fa518ebe102b
2020-04-03 11:40:29 +00:00
Raphael Collet 3ecb6fdcb0 [IMP] core: optimize model._auto_init() on a new model
Create the table with all the columns from scratch, with the NOT NULL
constraint when required.  Also do not call `_check_removed_columns()`
on a new table.

This saves 0.5% of the total installation time.

X-original-commit: 0727cacf5194a143b15ab4cb9893f3035a67be1f
2020-04-03 11:40:28 +00:00
Raphael Collet 892e3df701 [IMP] core: compute field_computed lazily
This is a simple refactoring.

X-original-commit: 634775bff6d9eba9d4548cc801071a942895a719
2020-04-03 11:40:28 +00:00
Raphael Collet 0551e7ad54 [IMP] core: compute field triggers lazily on registry
This saves 2% of the total installation time.

X-original-commit: 6a0028f91944b1d9e4eac026e86ca249ef5bc7ee
2020-04-03 11:40:28 +00:00
Raphael Collet 8b94e53084 [IMP] core: optimize field._setup_related_full
Simply avoid browsing records for models, and use classes instead.

This saves 1% of the total installation time.

X-original-commit: 35ebaea098edeb3d34f77305b09cb36e56ea5a92
2020-04-03 11:40:27 +00:00
Raphael Collet f3932ea716 [IMP] core: remove Field._slots
This optimization is no longer necessary.  Thanks to Python 3.6's new
implementation of dicts, the memory footprint difference between slots
and dicts is now around 5%, which is no longer worth the complexity and
performance cost.

This saves 2% of the total installation time.

X-original-commit: c7f17770803744cbbb741fc11265ee914641aed7
2020-04-03 11:40:27 +00:00
Raphael Collet f694caac41 [IMP] core: optimize model._setup_base()
Simplify the code to retrieve fields on a class.
Simplify the class attribute that lists the class' proper fields.
Optimize `model._add_inherited_fields()`.
Optimize `resolve_mro` by using classes instead of recordsets.

This saves 3.5% of the total installation time.

X-original-commit: 89ab71905cb6c5d3beda5eac357f8592e31aaef8
2020-04-03 11:40:27 +00:00
Raphael ColletandXavier Morel b491ca0bb3 [IMP] core: avoid duplicates in depends and depends_context
Repeated calls to `registry.setup_models()` will eventually introduce
many duplicates in the those attributes, which may slow down the
determination of computation triggers.

X-original-commit: 735e65f7ca45616881336121d10a874412446dcf
Co-authored-by: Xavier Morel <xmo@odoo.com>
2020-04-03 11:40:26 +00:00
Raphael Collet db276e4d99 [IMP] core: perform xmlid_lookup in pure SQL
This saves 3% of the total installation time.

X-original-commit: ed2971023edf0ce475e6972598e9d0dfaa88c2b8
2020-04-03 11:40:26 +00:00
Raphael Collet 7030fc179d [IMP] modules: don't mark all packages as 'update' unless necessary
When installing a database from scratch, marking all packages (in the
module graph) as 'update' forces the migration manager to retrieve all
migrations scripts... for nothing.

X-original-commit: fd8f3c73c8c30162034c7712fa0993e2408fba89
2020-04-03 11:40:26 +00:00
Damien Bouvy 9702142204 [IMP] odoo: avoid useless error in logs
Avoid logging an error in the logs for an operation that is not an

closes odoo/odoo#48957

Error: if the extension already exists, this is a success.
X-original-commit: 2f884942c94a640ae5107ff2acb27ba4ecc60bc0
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-04-03 10:27:12 +00:00
Aaron Bohy 147d7e8910 [FIX] web: form: hide labels of oe_(read|edit)_only fields
In a form view, nodes with classname "oe_read_only" (resp.
"oe_edit_only") are only visible in readonly (resp. edit) mode.
Moreover, fields inside a group automatically have an associated
label.

Before this commit, when one of these classnames was set on a
field node inside a group, the effect wasn't applied on its label,
so the label was always visible, even if the field was hidden.

Bug reported in PR odoo/odoo#48699

closes odoo/odoo#48968

X-original-commit: 705f434f0f18a0e4d2fdb0f86d3e350d190b2a30
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-03 11:41:05 +00:00
Thibault Delavallée 540df68b32 [FIX] crm: do not erase activity_type_id field value when converting
activity_type_id is a related field on the first activity to do and should
probably not be reset / forced to a value. It is probably some code coming
from previous implementations of activities that were linked to crm only.

Coming notably from 87e457158e and 42226de46e .

Community PR odoo/odoo#48946

closes odoo/odoo#48960

X-original-commit: de2e682824a636062fbb2c47b1bf5d7c7cef18db
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-03 11:08:18 +00:00
Odoo's Mergebot c6c1080be1 [FW][MERGE] event_*: provide various fixes related to last 13.3 changes
PURPOSE

Provide fixes for event application in order to fix 13.3 changes.

SPECIFICATIONS

See sub commits for more details. Globally fixes are related to start and
end dates, as well as sold out computation.

  * include timezoned event date_end in registration open computation;
  * ensure event_registrations_open can always be computed;
  * better sold out computation and display;
  * improve backend views and help strings;
  * add some test for is_ongoing with timezones;
  * remove unnecessary copy=True added while converting fields;

LINKS

Task ID 2228189

closes odoo/odoo#48959

Forward-port-of: odoo/odoo#48652
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-03 13:30:45 +02:00
Thibault Delavallée cee2b11da2 [FIX] event_*: remove now unnecessary copy=True
Commit 397872a07f remove most onchange in event related modules to replace
them by computed r+w stored fields. At that time copy was by default set to
False for computed fields as resulting of standard behavior.

Since 4b274d3b4101fbae154a572cdf40d23838899773 this is not True anymore as we consider those fields are
duplicable. We can therefore remove unnecessary copy=True on fields to clean
their definitions.

Task ID 2228189
Community PR odoo/odoo#48652

X-original-commit: c6b378987bd3351deba7770b51c2a5755f7ff341
2020-04-03 11:07:56 +00:00
Thibault Delavallée bc1b5e134b [FIX] website_event: better sold out computation
Purpose of this commit is to remove some complex check embedded in templates
and replace them by a computed unstored field. It eases definition and
understanding.

Its computation has been cleaned, so that sold out appears only when tickets
are really sold out, not if their end sales date is reached. Sold out label
is displayed in both event list and event specific page views in frontend.

Small spacing issues in frontend registration form are also fixed.

Task ID 2228189
Community PR odoo/odoo#48652

X-original-commit: c36cf90e7b83d2424b2f52ad8a2fec0bf367e8d8
2020-04-03 11:07:56 +00:00
Thibault Delavallée b29b4bcbfc [FIX] event: ensure event_registrations_open can always be computed
Using a compute_sudo ensure this field is correctly computed (aka without
crash) if someone is allowed to read the event but not all its sub models.
For example event_registrations_open reads the active flag of a product
linked to a ticker which may not be readable by public users. This field
is used in frontend templates and therefore usable by external people.

Also remove unnecessary registrable rendering parameter in website_event
as it has been replaced by computed fields.

Task ID 2228189
Community PR odoo/odoo#48652

X-original-commit: b2b334a65f3a1379f25717ec39f0a52f3305b19c
2020-04-03 11:07:56 +00:00
Thibault Delavallée d2840a0519 [FIX] event: include timezoned event date_end in registration open computation
Purpose of this commit is to try to lessen random conditions being concatenated
in templates by correctly computing event_registrations_open field that is
now correctly based on

  * event.date_end -> if event is done, registrations are not open anymore;
  * event.start_sale_date -> lowest start date of tickets (if any; start_sale_date
    is False if no ticket are defined, see _compute_start_sale_date);
  * any ticket is available for sale (seats available) if any;
  * seats are unlimited or seats are available;

Some better timezone computation is included even if it could be done better.

Task ID 2228189
Community PR odoo/odoo#48652

X-original-commit: a11af9074499465b6dd8ad1400e60c7af96e21c7
2020-04-03 11:07:55 +00:00