Commit Graph
153701 Commits
Author SHA1 Message Date
Victor Feyens aa9dcc2bce [REF] sale,*: invoicing wizard
1) Invoicing wizard refactoring

* reduce the use of context in the business logic,
  store the orders being invoiced
* factorize invoice creation values, using the correct method from
  the sale.order model
* switch from default fields to computed fields, and avoid computing
  unnecessary fields when the wizard is opened to invoice multiple
  orders together (most fields are only used for down payments)
* Rely on python constraints instead of error messages scattered
  accross business methods to notify the user that the invoice cannot be
  created.
* Clean the code to make it easier to follow, understand and maintain

2) Distinguish Down Payment Invoice lines from standard ones

(with a dedicated field)

Allows to stop relying on the dumb property,
not specifically reliable, e.g. if the down payment product is modified
in the settings after down payments orders were already created.

closes odoo/odoo#98600

Related: odoo/enterprise#30653
Related: odoo/upgrade#3799
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-09-02 23:15:44 +02:00
Victor Feyens a680441dda [REF] sale: split _find_mail_template
Despite recent improvements, the method is still quite confusing,
especially with the 'force_confirmation_template' parameter.
Splitting this parameter logic in a split method giving only the
confirmation template when needed.

Part-of: odoo/odoo#98600
2022-09-02 23:15:44 +02:00
William Braeckman 87e7f30abc [IMP] website_sale_loyalty: make it possible to remove an auto reward
Prior to this commit there was no way of removing an automatically
claimed reward from a website order, since it would always get claimed
right after the update to the cart.

TaskId-2951413

closes odoo/odoo#99023

Related: odoo/enterprise#30794
Related: odoo/upgrade#3820
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-09-02 20:10:59 +02:00
eres-odooandWilliam Braeckman 6927dcda9f [IMP] loyalty*: misc loyalty improvements
This commit improves some messages and usability for loyalty and its
submodules:
 - Coupons should not be restricted to the partner assigned to them
   anymore
 - Merged "I have a promo code" and "Use a gift card" into a single
   toggle
 - Boolean fields have been added to each app to disable them where we
   don't want them.
 - Reduced the size of coupon codes
   This means that we increase the risk of collision which should be
   handled by the model as well now.
   Creating a coupon with an existing code will retry the creation (up
   to 10 times) until the coupon is indeed created.
 - Make it clearer in the coupon generation wizard that an email will be
   sent to the customer.
 - Reintroduce coupon/gift card details on sale order lines in eCommerce
   which was wrongfully removed.
 - Remove the "on product with taxes: " message on order lines when
   the amount is not split between taxes or if the tax message would be
   empty.
 - Make it possible for some error messages to be displayed as warning
   instead of errors
 - Split program types in two menuitems, one for promotions discount
   loyalty etc and one for gift cards and ewallet, the latter has
   simplified views.
 - Views overall have been reviewed to make it easier to understand how
   to programs work. New program types have also been added.

TaskId-2951413

Part-of: odoo/odoo#99023
Co-authored-by: William Braeckman <wbr@odoo.com>
2022-09-02 20:10:59 +02:00
Simon Genin (ges) feef532b41 [REF] web, stock: refactor report client code
This commit converts the report code to the new framework.

Since the module stock still has code that extends the old
"ReportClientAction", the old report code is put inside this module.
It can be then naturally removed once the module is fully converted.

closes odoo/odoo#97390

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-02 20:10:53 +02:00
Louis Wicket (wil) 10950d549d [IMP] mail: add support for inline definition of sort and compute
This commit allows compute and sort functions to be declared within a
field definition instead of providing a string with the name of the
record method to be used to compute/sort the field value.

Example of code with compute inline:
```javascript
registerModel({
    fields: {
        thread: one('Thread', {
            compute() {
                return {
                    id: this.id,
                    model: 'mail'.thread',
                };
            },
        }),
    },
});
```

Example of code WITHOUT:
```javascript
registerModel({
    recordMethods: {
        _computeThread() {
            return {
                id: this.id,
                model: 'mail.channel',
            };
        },
    },
    fields: {
        thread: one('Thread, {
            compute: '_computeThread',
        }),
    },
});
```

The aim of these changes is to empower a better separation of concerns,
by allowing to group together in one place the data related to a field.

Note that for technical reason (`Function.prototype.call` not working as
expected with arrow functions), compute/sort functions should not be
arrow functions.

closes odoo/odoo#99424

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-02 19:14:04 +02:00
sash-odoo 5bfcead619 [FIX] project: fix the field 'recurrent' visbility in form view
Before this commit, the 'recurrent' field still be visible even if the
'recurring tasks' feature is disabled in the settings.

So in this commit, fixes the issue by adding the recurrent group and
updating the attrs on field.

task-2858336

closes odoo/odoo#99392

X-original-commit: f83451b9ba86fd919184fc78093535625c0459ef
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-09-02 19:13:57 +02:00
Nasreddin Boulif (bon) cb789579d2 [FIX] website[_sale]: add company to domain of snippet filters
Steps to reproduce:

  - Install website_sale module
  - Create a new company X
  - Create a new product Y and set company to X
  - Create a website Z and ensure it's linked to a company but NOT X
  - Go to website Z homepage and edit it
  - Add a `Products` block then save
    (should be by default on filter `Newest`)
  - Select product Y in the block

Issue:

  The product should not be displayed and when clicking on it, we have
  an access right error.

Cause:

  Not taking into account the company of the website when preparing
  values to render in the snippet therefore the product is displayed
  while it should not.

Solution:

  Update `_prepare_values` to add the website company to the domain if
  the filter's model has a company_id field.
  Same issue occure with latest_sold filter (for ex.) so must
  apply same fix to `_get_products` for filters that use a server action.

opw-2956186

closes odoo/odoo#99181

X-original-commit: dab7fed0c396d3dd6e2e2ad8560c706d5c2e89fb
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2022-09-02 19:13:53 +02:00
Nasreddin Boulif (bon) 156e2f1fc3 [FIX] website: get right access token for public visitor user
Current Behavior:

When we get the access token for a website visitor, we check if the
`self.env.user` is a public user. If it is, we return his id.

Expected behavior:

We should check the `request.env.user` instead since the visitor can
only be created through the frontend.

opw-2956186

Part-of: odoo/odoo#99181
2022-09-02 19:13:53 +02:00
Didier (did) c89853c219 [IMP] mail: move command code out of postMessage
closes odoo/odoo#99489

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-02 17:46:17 +02:00
Zelong Lin 0c3961008e [FIX] mail: guard message view
add guard on onMouseenter/onMouseleave

task-2901855

closes odoo/odoo#99477

X-original-commit: 7ce86d6c90062c9f8eef0ba7337d773e6a79f5ec
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-02 17:46:02 +02:00
Pierre Paridans 8546efe940 [FIX] web: searchbar vertical alignment on mobile
On non-legacy views (like Pivot) the vertical alignement of the
searchbar wasn't properly centered. Also there wasn't enough spacing
between the actual search input and the bottom line.

This commit fixes it by certically center it and normalize the bottom
padding accross legacy/non-legacy and mobile/desktop.

closes odoo/odoo#99476

X-original-commit: cdee502c05cfacdefd2e656001c6f9ae7d3146af
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-09-02 17:45:58 +02:00
clesgow ddfbfddf3c [FIX] purchase_stock: Fix receipt auto-batch
When using the auto-batch feature for receipt, when creating a purchase,
it wouldn't batch pickings that matched the group-by conditions.

The issue is that the _create_picking() called when validating a
Purchase Order creates the picking, then creates its moves and then
validates them. Doing it this way avoids the trigger for the auto-batch
feature located in picking's action_confirm().

By calling action_confirm() on the created picking, we force the trigger
of the auto-batch, while not confirming the moves a second time since
their state isn't 'draft' anymore.

opw-2961618

closes odoo/odoo#99466

X-original-commit: 7d091ba995d13fa8f692827b33aad0982c2a65fa
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2022-09-02 15:28:05 +02:00
mafo-odoo 4e6e3e6261 [FIX] hr_holidays: no date_from creates error
Probem:
With some time off type as default type in an allocation request
you get a traceback as soon as you try to open the allocation
request form.

Cause:
FIX commit [1] introduced the issue as it didn't consider the
possibility of a false date_from

Improvement 1:
Having a date_from False sets a False in the leave request name
displayed on the form, we change that to have an empty string
instead

Improvement 2:
The timezone bug fix in commit [1] is only applied on a specific
configuration, we applie it to all configuration of leave request
name

[1] 5a50dea2652cff014d9198f59265cf36a3ec1865

opw-2961344

closes odoo/odoo#99454

X-original-commit: 3b9a012e4a0839bc5da2daf51d56591d2863b4be
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Fockedey Martin (mafo) <mafo@odoo.com>
2022-09-02 15:27:59 +02:00
Demesmaeker 83d6ba6e0d [FIX] sale: fallback on the product uom
`_compute_discount` from subscription add dependencies that triggered
the compute before the `product_uom` was set in a sale order line, once
the uom is set, the `_compute_discount` will be triggered again.

task-2960768

closes odoo/odoo#98780

Related: odoo/enterprise#30721
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-09-02 15:27:53 +02:00
Odoo's Mergebot 216b1a1b2f [IMP] mrp: back to basics 7 ngtr
A series of 7 UI improvement or small implementations:
- Match qty field in Work Order kanban view
- UI Fix for Lot/serial column in MO form view
- Improve UI of Manual Consumption field on BOM
- UI Improvement of review split window field rearrangement
- Add setup/cleanup time to Work Center Specific Capacities
- Allow multi-edit Work Order

task-2925474

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#97588

Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-09-02 14:18:00 +02:00
Triet Ngo aa14a8027c [IMP] mrp: Allow multi-edit workorder
This commit allows users to multi/mass-edit the Work Order fields

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:59 +02:00
Triet Ngo d494f5988a [IMP] mrp: Add setup/cleanup time to Workcenter Specific Capacities
- Add columns setup/cleanup time to Specific Capatities of Workcenter
- Take into account these 2 fields when compute expected duration in WO

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:59 +02:00
Triet Ngo a968404a84 [IMP] mrp: UI Improvement of review split window field rearrangement
rearrange the fields of the tree from
Quantity, User, Date to Date, User, Quantity

task_id: 2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:59 +02:00
Triet Ngo e2d4586ac7 [IMP] mrp: Improve UI of Manual Consumption field on BOM
Auto mark manual_consumption as True as soon as the component is use in
an operation and make the field read-only

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Triet Ngo dae82e7aae [IMP] mrp: UI Fix for Lot/serial column in MO form view
The commit modifies the following:
- add tooltip : 'Displays the consumed Lot/Serial Numbers consumed.'
- Change the column Serial Numbers to also display lot number
- Make the column read-only

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Triet Ngo 562e01eb28 [IMP] mrp: Match qty field in Work Order kanban view
Currently, the kanban view show qty_production. However, the Listview
show the qty_remaining. So this commit match the field for 2 views (both
should show qty_remaining)

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Triet Ngo 5f684778f4 [IMP] mrp: Add color to warning multi-lot mass produce
When mass producing from several reserved lots, we display a warning
message that the lot reservation is 'multiple'. This commit displays
that message in red.

task-2925474

Part-of: odoo/odoo#97588
2022-09-02 14:17:58 +02:00
Nikunj Ladava 7c66ed560d [IMP] portal_rating, {website_slides}_forum: miscellaneous improvements
PURPOSE

Added some light wording improvements to various screens.

SPECIFICATION

- There was a strange flicker of 'Add a review' and 'Write a review
  while loading the course player because we have different strings
  in XML and js due to which while loading it appears like flickering
  of 'Add a review' and 'Modify Your Review' so, we modified the string
  to 'Review' and also moved the share button from left to right to improve
  the view.
- This commit will rename the 'New Post' button to 'Forum' and add
  tooltip 'Forum' to it.

task- 2627364

closes odoo/odoo#78139

Related: odoo/upgrade#3444
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-09-02 14:17:40 +02:00
Nikunj Ladava 7d66dcbf54 [IMP] website_slides: improve design of share pages in elearning
PURPOSE

Globally improve user experience when sharing content from the e-learning app.
This includes new sharing options, allowing to share to multiple emails, split
the sharing template from slide and course, etc...

SPECIFICATION

- added two more options 'WhatsApp' and 'Pinterest' to share snippets.
- we converted the email type of input for 'Share by email' to text,
  so we can enter multiple emails to share and also add validation
  in the controller for this input text input.
- We improved the design of the share modal by making sure that the full URL
  for sharing link is visible and rearranged the UI fields of
  'Share' nav-tab on non-fullscreen content (if there is
  embed code, the sharing by email and embed code will still be on
  the single row).
- Improved the share modal of the channel by adding an email field in it to
  Share the channel through the mail.
- New field name 'share_channel_template_id' for channel template
  in 'slide.channel' modal and also added _send_share_email method
  in it and email template for sharing channel through the mail, and
  also added the dedicated route for sharing the channel.
- New share button is added on the top of documents in the slide (which
  previously was in the tab below the content).

task- 2627364

Part-of: odoo/odoo#78139
2022-09-02 14:17:40 +02:00
Thanh Dodeur 291e99b7f7 [FIX] mail: prevents traceback when downloading rtc call logs
Before this commit, since https://github.com/odoo/odoo/pull/96954 ,
the `CallActionListView` had its `channel` field renamed into `thread`.

A reference to this old field name was missed which caused the
traceback, this commit fixes this issue by using the right field name.

closes odoo/odoo#99447

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-02 12:21:41 +02:00
Lucas Perais f4a8d5bf9b [FIX] web: legacy Many2ManyTags in list view: add/remove records
Have a list view (new RelationalModel inside a WOWL list view) that has
a legacy many2many tags field in its arch.

Try to add or remove some records from that many2many.

Before this commit, there was a crash, because the legacy field wrapper
doesn't use the model the right way for that case.

After this commit, there is no crash.

closes odoo/odoo#99431

Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-09-02 10:16:01 +02:00
Nshimiyimana Séna 128b961bdd [FIX] account_edi_ubl_cii, l10n_account_edi_ubl_cii_tests: add partner email to factur_x XML
Currently, when creating an invoice from factur_x XML, the vendor is
identified by sequentially checking (in this order) the following
information :
- VAT number
- name
- email
However, when we generate a factur_x XML, we do not include
the partner's email address. This means that in some cases, two odoo
databases are not able to communicate bills/invoices properly.
This commit brings back a behavior that was unintentionally removed in
https://github.com/odoo/odoo/commit/d25fdafcd8eb4cfef14c2ef7ed8ad7785dd01b55

opw-2909408

closes odoo/odoo#99263

X-original-commit: 51609d19177c080835116f0ad9c04c33536d926a
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Nshimiyimana Serge Séna (sesn) <sesn@odoo.com>
2022-09-02 10:15:58 +02:00
Jorge Pinna Puissant 285d1c4a08 [FIX] web: SettingsFormView - highlight Element with inner html/fields
Before this commit, if a text-muted on a setting (a description of the
setting) contains fields or HTML tags, the highlight generated wrong
texts.

Now, we highlight the text in an iterative way, taking care to only
highlight the text.

closes odoo/odoo#99205

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-02 09:18:35 +02:00
Jorge Pinna Puissant 129bb263f0 [FIX] web: SettingsFormView - avoid searching hidden settings
When searching a text of a hidden field (for example, "gate"), the
setting itself will not be shown, but the group title, and the app
Search Header will be shown.

This issue arise because, we use an if condition with all the label of
all the fields (hidden or not) in the group (or app) to decide if the
group title or the app header will be showed.

Now, we modify this to hide (d-none) the group title or the app header
if there is not a settings below them.

Part-of: odoo/odoo#99205
2022-09-02 09:18:35 +02:00
Aurélien (avd) d6dc795e20 [IMP] pos: add some indexes to speedup Tax Report
Tax Report _compute_from_amls_grids query calls
two method overriden in pos_account_reports.

The resulting query contains EXISTS subqueries on pos_session.move_id
and pos_order.account_move. Because these two fields are not indexed
by default, the cost of the query can skyrocket in large databases,
leading to slow tax report generation.

closes odoo/odoo#99095

X-original-commit: 51e607a70be804b0cd614cccc36ea0145c934676
Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-09-02 08:14:47 +02:00
Luis Torres 82ae8ba0f0 [IMP] l10n_pe: Welcome ISC tax
The SUNAT requires than when a ISC tax is used on an invoice, on the
cbc:TierRange attribute be specified the ISC type.

Now, the 3 options could be:
- 01: System to value
- 02: Application of the Fixed Amount
- 03: Retail Price System

To this, now was added a new field on the tax, with this options.

Extra, the ISC could have many amount options, for now, only is
generated a tax for 0%, that allows to the customer only change the
percentage that will to use.

Legal Reference:

Catalog No 08:  https://cpe.sunat.gob.pe/node/88

Guide for the Preparation of Electronic Invoice:
https://cpe.sunat.gob.pe/sites/default/files/inline-files/gu%C3%ADa%20xml%20para%20factura%20electr%C3%B3nica%20%28ubl%202.0%29_0.pdf

Impuesto selectivo al consumo (ISC):
https://www.gob.pe/7918-impuesto-selectivo-al-consumo-isc

closes odoo/odoo#98962

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-09-01 21:25:29 +02:00
David Beguin 08561e6db4 [FIX] rating: check model is set before using it as key.
As message_notify can be done on empty recordset, message.res_id and
message.model can be Falsy. During filtering on rating messages, we need to
prevent the code to crash when filtering on those two properties and filter out
messages that are not linked to any record.

Task-2850521 (Knowledge: trash management)

closes odoo/odoo#99436

Related: odoo/enterprise#30908
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-01 20:22:17 +02:00
Sébastien Theys 545d23888b [IMP] mail, im_livechat, *: add typing for guest and clean code
* = bus, hr_holidays, test_discuss_full

- use channel member instead of partner for typing
- use channel member instead of partner for all other return values from server
- remove temporary partner hack in livechat and keep public partner
- remove some obsolete convert data
- adapt format methods accordingly

task-2664853

closes odoo/odoo#98923

Related: odoo/enterprise#30760
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-09-01 20:21:58 +02:00
William Henrotin 2c91ad3ae8 [FIX] mrp: remove onchange in import hack
Since d7716f071d, the onchanges to create the stock moves in mrp
production have been replaced by computes.
There was a hack in the create() method to trigger the onchanges in case
of import. As those onchanges do not exist anymore, this hack needs to
be remove too.
The compute methods are called naturally in imports.

closes odoo/odoo#99434

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-09-01 19:17:36 +02:00
Didier (did) f922f51910 [FIX] mail: avoid partner without name in suggestion
task-2884212

closes odoo/odoo#99432

X-original-commit: 385ba1d062abbc73ca3cdb9a27adb4b9cc7803be
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-01 19:17:32 +02:00
Florian Damhaut 90bf897c28 [FIX] calendar: Single char partner create traceback on calendar
Since 3a145216a6a6fb259c5afef6175669c8a65ba39f, partner_info value
was changed but not it's usage.

This commit also simplify the code for better understanding.

closes odoo/odoo#99422

Task-id: 2954397
X-original-commit: a667179e43ab00a8384b75923769782f1836c24b
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
2022-09-01 19:17:29 +02:00
Xavier BOL (xbo) 2179620aa7 [REM] hr_timesheet: remove QRCode for app store and play store
This commit removes all custom codes to create a QRCode to get the link
of the Timesheet Awesome App, the link is sufficient to download the
mobile app.

closes odoo/odoo#99362

Related: odoo/upgrade#3840
Related: odoo/enterprise#30942
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-09-01 19:17:20 +02:00
Stanislas Sobieski d76e28b43b [FIX] base_import: fix test
Test was skipped on runbot since odf was missing

closes odoo/odoo#99282

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2022-09-01 19:17:11 +02:00
Simon Genin (ges) 001ec7b2c2 [IMP] web: char field, password shouldn't be trimmed
Passwords are something we know that need to be exact. So, the regular
behaviour where double spaces are changed to single ones and spaces are
trimmed at the start and end of the string is not a good idea for
passwords in general. Not that a lot of people put double spaces or
space in the start or end of their passwords, but it happened and it is
possible. So, if password is True on the field, it does not make any
sense to trim it and let's support that in the web client (as the web
client does the trimming) instead of putting trim=False on all password
 fields in the Python, risking to forget it for the next password field.

closes odoo/odoo#99088

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-09-01 19:17:07 +02:00
nni-odoo 8b28981fae [IMP] l10n_sg: Box Mapping for Purchase Tax
As required from Singaporean tax regulation, we need to add Box 5 on the tax grid to make sure the amount is correctly mapped in both boxes.

2854163

closes odoo/odoo#98950

X-original-commit: be3c30f304c91c2689bd907cf32108a401ea7a9f
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2022-09-01 19:17:04 +02:00
Julien Mougenot d3eff197a5 [FIX] web: Fix binary and pdf_viewer fields
This commit aims to make the BinaryField and PdfViewerField appear and
act the same way as they did before their conversion to Owl.

This mostly consists of a few tweaks in the conditional rendering of
certain elements in the template, and the rest of the changes are meant
to clean and simplify the values the component is working with.

closes odoo/odoo#98251

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-09-01 19:17:00 +02:00
Julien Mougenot cabed350f5 [IMP] web: editInput handles file inputs
This commit allows the 'editInput' test handler to also handle inputs of
type "file". To do so, the value must be a file (or a list of files),
and the handler has been refactored to accept a certain given value only
if its type allows it.

Part-of: odoo/odoo#98251
2022-09-01 19:17:00 +02:00
Victor Feyens 638ca2cd12 [FIX] sale: linting
* Local variable 'filtered_self' might be referenced before assignment
* confusing use of `order` from the previous for loop, support multi recordset
in the method instead.

closes odoo/odoo#98068

Related: odoo/enterprise#30408
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-09-01 19:16:49 +02:00
Victor Feyens db9dd568bd [PRF] sale*: avoid useless recomputations
By default, a related field dependencies are the fields in his relation 
path.
But for non stored UX fields, the field should only be recomputed when
values editable in the view are edited.

Example:

On a given model:

product_id = fields.Many2one(...)
product_type = fields.Char(related='product_id.type')

The product_id field can be changed on the model view, but not the 
linked product,
so there is no need for the orm to search records whose product_type 
must be invalidated
when the type is changed on a product.

To avoid this 'useless' search, we can manually restrict the field 
dependencies:

product_type = fields.Char(related='product_id.type', 
depends=['product_id'])

Part-of: odoo/odoo#98068
2022-09-01 19:16:49 +02:00
Victor Feyens bf55e1a7ea [IMP] sale: privatize portal methods not meant to be called in rpc
Part-of: odoo/odoo#98068
2022-09-01 19:16:49 +02:00
Victor Feyens 4e2d7b800d [CLN] sale: rename _get_invoice_status
follow code guidelines and use _compute_invoice_status instead.

Part-of: odoo/odoo#98068
2022-09-01 19:16:48 +02:00
Victor Feyens cc5c83e01c [IMP] sale: rename update_prices method
make it clear it's expected to be called from the frontend, prefixing it
with action_.
Also split the method to have an utilitary method recomputing all prices,
to use in the tests and/or business code (without the chatter message).

Part-of: odoo/odoo#98068
2022-09-01 19:16:48 +02:00
Victor Feyens 7ca4163517 [IMP] sale: do not store anymore whether the pricelist changed
As for the show_update_fpos field, do not store this simple UX field.  
We only want to highlight the pricelist modification when it happens (to 
allow prices recomputation), no need to store it undefinitely.

Part-of: odoo/odoo#98068
2022-09-01 19:16:48 +02:00
Victor Feyens 920c1fa019 [CLN] sale: cleanups
Methods ordering (after place of call)
String guidelines (double quoted strings for strings shown to the user)

Part-of: odoo/odoo#98068
2022-09-01 19:16:47 +02:00