Commit Graph
84 Commits
Author SHA1 Message Date
Martin Trigaux cd464d84d7 [FIX] sale: render the report as superuser
Same as 5dde19c92ecee, sudo is not enough but the report needs to be
rendered with the user 1.
The access token proves the user has the access, the fact that he is a
portal, employee or public should not change the result

closes odoo/odoo#80491

X-original-commit: 66ab2ae213f05b055a032d0810de1de9334741ac
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-26 20:37:46 +00:00
Kamen Zhekov 2b832269f4 [IMP] sale*: merge configuring products and opt. products modals
The changes concern the following modules:
- sale
- sale_product_configurator
- website_sale
- website_sale_product_configurator

When optional products are enabled and a user adds an item to the cart, the
modal popup does not allow further modifications to the main product based
on its template. If the user wants to change the color or the material, they
have to close the popup, modify the product and open it back up.

The same is applied when Add to Cart is active, and the user cannot configure
the product at all after clicking the add to cart button.

This change will make it possible to change the product variants without having
to close the modal, and configure the product when using the "Add to cart"
button when it's enabled.

The added configuration step is needed for some cases like the following:

1. When adding a product that had variants directly from the /shop page before,
the first variant was added by default and configuring it was impossible without
explicitly going on the product's page and configuring it from there. This 
behaviour made no sense, and it's the reason the "optional products modal"
(which should no longer be called that) is opened when the product is not 
configured even if there are no optional products.
2. When going through the product's page, and there are optional products enabled
for the product getting configured, then it's nice but not necessary to be able to 
configure the product further while choosing and configuring the optional products.
This doesn't add an extra step in any case, it just makes it possible to still configure
your product in the modal.
3. If there are no optional products, the configuration made on the product's
page is taken into account and the product is directly added to the cart without 
opening the modal, which is the same behaviour as previously.

Only one modal is shown, depending on the situation:

- For the website flow, if the product is not configured and has variants or has
optional products (or both), a popup shows that allows for configuration + 
choosing and configuring optional products.
- For the sales flow, there was already a configuration popup, so the optional
products modal is only shown when there are optional products and replaces
the first instead.

Some tests were adapted to function with the new product configuration modal:

- The steps checking for the text mentioned above are removed
- Triggers were adapted to the modal for products that were previously added to cart
  with their default variant
- Various other small adjustments

task-2541663

closes odoo/odoo#73086

Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-08-30 13:27:44 +00:00
Antoine Vandevenne (anv)andVictor Feyens 573ed74c12 [REF] payment, *: refactor online payments API
This commit replaces the old online payments API of the `payment`
module with the new one and adapts to it all the implementing modules.

See the merge commit for more details.

task-2085989
task-2119838
task-2165982
task-2289255

Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-03-30 09:25:51 +02:00
Laurent Stukkens (LTU) 009bcc59fe [IMP] sale_timesheet: adapt timesheet sections in portal
Prior to this commit:

    * The portal timesheet section was only visible in invoices when
      invoicing policy was set to delivery.
    * The portal timesheet section was not visible on orders.

After this commit:

    * The portal timesheet section will be displayed for both delivery and order invoicing
      policies.
    * The portal timesheet section will be available for orders.

task-2388500

closes odoo/odoo#62516

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-11-25 18:13:11 +00:00
Andrea Grazioso (agr-odoo) c97e605457 [FIX] sale: keep card info on form save
Configure card payment provider (stripe, Authorize, etc) in test mode
Allow the customer to decide if saving payment info
Go to web shop, fill cart and checkout
Select provider and check "save payment method"

After payment the card info is not saved:
the related check variable is overridden in the process.

Note: this occur only when using the provider site.
S2S payment via Odoo follows a different flow

opw-2335237

closes odoo/odoo#61351

X-original-commit: dc18fdba1d4e0d38df0ebce4eed46f8ad08f4821
Related: odoo/enterprise#14597
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2020-11-04 16:37:30 +00:00
Nicolas Martinelli 691c14c070 [FIX] account, purchase, sale: portal access error
- Install account / purchase / sale
- Ceate an internal user without any access rights
- Go to `/my`

A 500 error is raised because of an AccessError.

When the user has no access rights to any of the mentioned applications,
the `search` call returns an AccessError.

We prevent the access error and return 0 as a fallback.

opw-2367559

closes odoo/odoo#60849

X-original-commit: 54ef98c613219aba3bda41817f7767261b8092d2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-27 15:36:48 +00:00
Adrian Torres b7017e58cc [FIX] *: adapt business code to function-redefined error
This commit adapts the business code in which
class/module/function/method redefinition took place so that it no
longer happens and the pylint test passes.
2020-10-16 12:56:52 +00:00
Victor Feyens 2da7bc2adb [REM] portal, *: remove archive_groups dead code
PURPOSE

Clean code and be and more performance oriented.

SPECIFICATIONS

Various portal pages hold references to archive_groups. It was a summary
of customer documents for portal, containing a count of all documents split
by model.

Currently its computation is not used. Indeed archive_groups is displayed
only in 'my_details' page that does not hold any document-based reference
or code call. Other calls to archive_groups are dead code as the result is
not used. Since 13.0 it is even not computed on standard pages to speedup
their load (as it was not used).

It is not used anymore and its computation and references can be removed
safely, especially with v14 in mind for which we want to remove dead code
to maintain.

Followup of odoo/odoo#55228

LINKS

Task ID-2329081
PR odoo/odoo#55800
PR #12368

closes odoo/odoo#56859

X-original-commit: e75086000ee4317b2ad2994db5d906fbcbd5081f
Related: odoo/enterprise#12830
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-09-01 10:30:32 +00:00
Damien Bouvy 2cc8af737a [FIX] sale,payment: remove useless comments
DBO won't be here anymore 👋

This is my last commit, I had to find something harmless.

Task-NaNNaNNaNNaNNaNNaN

closes odoo/odoo#56789

X-original-commit: fc92728fb2aa306bf0e01a7f9ae1cfa3c1df0e10
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-31 09:59:54 +00:00
Jeremy Kersten 73b4e9b1b6 [IMP] portal,*: /my counter async
Before this commit, the time to compute all counters was making the rendering
of the portal page slow.

Now the count is done in rpc after the loading of the page.

Now you can decide which part you want to show on the portal, and only compute
for these one.

It is not because you have purchase installed for your internal process, that
it means that your supplier use your portal and it avoid the computation for
all end users.

We parallelize the counters in arbitrary 3 rpcs.

closes odoo/odoo#55999

Related: odoo/enterprise#12456
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-08-17 15:59:03 +00:00
Victor Feyens 71f3fa991c [IMP] *: disable unused archive_groups feature in portal
The archive groups feature allows the user to have fast access to
records of a given month, under its details information.

But since the details section isn't shown anymore on portal sub-pages,
the feature is computed for nothing on (most) pages.
Removing this computation avoids a read_group call on portal subpages
(multiple potential queries).

This commit disables the feature until a total removal in master.
my_details is only truthy on the /my/account portal page, where no
archive_groups is given anyway (and the value is set to True only in the
rendered tempate itself).

X-original-commit: 40c57fafdd5651a522891ab68affe38933ea5202
2020-08-03 07:23:30 +00:00
Victor Feyens 34fb9f3159 [IMP] portal,*: do not compute record counts for portal subpages.
The record counts are only useful for the badges displayed in /my &
/my/home.
By avoiding those counts on subpages, we gain a lot of useless queries,
improving the loading speed of those sub-pages.

X-original-commit: 79c8384f1bcbcdede030e187008319a70c664571
2020-08-03 07:23:29 +00:00
jerome hanke (jhk) d6d540a8d5 [FIX] sale: portal generates pdf for the chatter in a separate request
Steps to reproduce:
- install studio, website and sales
- go to sales > open studio > go to 'reports' > Quotation/Order
- add a field anywhere on the report with the field expression set to
"doc.signature" > save
- go to sles > create a quotation > send by email > send > go to the customer portal
- sign and send the quotation > go back to the edit mode > open the pdf attached
to the latest message in the chatter

Previous behavior:
the custom field added was not rendered properly,
the attachment is not available during the request and the generated
pdf shows the placeholder image instead

Current behavior:
the message posted in the chatter is generated in another request,
this makes the attachment available

opw-2260989

closes odoo/odoo#54955

X-original-commit: a15cbb0a7be666d3ad438f6470d29cda75c24027
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-27 09:39:25 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
2020-06-18 13:03:34 +02:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
Nicolas Martinelli c4b3d5b814 [FIX] sale: quotation viewed email
According to some PO, the email is useless to salespersons.
According to salespersons, the email is very useful.

This reverts a26a010324

opw-2215123

closes odoo/odoo#49756

X-original-commit: 0709890357005e4c1b205816061c3ec1582ad16d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-20 07:20:32 +00:00
Tonow-c2candDamien Bouvy 2038ff2f26 [FIX] sale: change the date to isoformat to be serializable
Avoid posting message if we are still on the same date

closes odoo/odoo#49486

X-original-commit: 5bd98159878501a8d1d3af336c1f895ed342268e
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Co-authored-by: Damien Bouvy <dbo@odoo.com>
2020-04-14 08:44:38 +00:00
Thibault Delavallée e2b33f460d [REF] mail, various: rename subtype parameter of message_post to subtype_xmlid
PURPOSE

Clean posting process and improve mail.message definition and comprehension.

SPECIFICATIONS

In order to be more explicit subtype parameter is renamed to subtype_xmlid.
It therefore clearly indicates it should be a valid subtype Xml ID. Support
of ill formatted Xml IDs is removed because there is no reason to try to
add some random prefix. Give something that exists or go to hell, punk !

LINKS

Task ID 2071556
PR #38692
2019-12-02 15:18:44 +00:00
Yannick Tivisse 26e32dac34 [IMP] portal: Partial revert of #37312
Purpose
=======

This fix makes no sense because it exposes some private data to
portal users. Fortunately it was only introduced in the master branch.

closes odoo/odoo#40710

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-22 14:45:22 +00:00
Yannick Tivisse 6299323522 [FIX] sale: Allow internal users to see their own SO 2019-11-05 13:08:02 +01:00
fw-bot ea11adf982 [FIX] sale: show payment token in sale payment
purpose of this commit is to show payment token while making payment with sale order

before this commit:
in SO payment, there is a filter for s2s acquirer, and becuase of that filter, if brings
tokens of the acquirer which is set to s2s currently

after this commit:
payment token will be shown for particular user, now it will not depends on mode of acquirer

task- 2028285

closes odoo/odoo#37562

X-original-commit: 0ebfe8575a8bac0f6b4c0ba1f1084701d73c4c74
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-09-30 08:27:13 +00:00
Antoine Vandevenne (anv) f976a10803 [FIX] sale: fix returning to sale from rental portal
This commit changes the behavior of the 'Back to edit mode' button in the customer portal preview of sales order.
If the sales order is a rental order, the user is sent back to the Rental app. If not, the button makes him return to the Sale app.
This doesn't take into account the app in which the order was opened: if a rental order was opened in the Sale app, the portal will send the user back to the Rental app.

task-2071281

closes odoo/odoo#37423

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-09-25 15:58:17 +00:00
Victor Feyens f0e059e601 [REF] payment* : state based publishing
Replace website_published and environment by a generic state on
payment.acquirer

Payment acquirers aren't enabled by default.  When setting their state to 'enabled' or 'test', it is verified the required fields for the provider are set.
2019-08-12 08:45:50 +00:00
Victor Feyens 611fde6c88 [IMP] payment: UI/flow 2019-08-12 08:44:25 +00:00
Kaushalya Mandaliya a26a010324 [IMP] sale: prevent email to salesperson when customer opens up a quotation
Purpose of this commit,
Salesperson does not need email notification as there is not implied action
to perform salesperson side. It's just polluting the user's mailbox.
What matters is the order confirmation, and they already receive the email.

So when a quotation is viewed by the customer, salesperson will no more receive
an email that customer has viewed the quotation.

task-1950368
closes: #34004

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-06-11 06:01:46 +00:00
Raphael Collet 368e9530f4 [REF] *: record.env.user._is_XXX() -> record.env.is_XXX()
Superuser mode implies `record.env.is_XXX()`.
2019-07-04 11:32:22 +00:00
Christophe Simonis 71a50a2214 [MERGE] forward port branch saas-12.3 up to 409679866b 2019-06-06 11:54:35 +02:00
Christophe Simonis c8d7ad9a6b [MERGE] forward port branch saas-12.2 up to 995aa1685e 2019-06-03 15:49:31 +02:00
Christophe Simonis cfe0523714 [MERGE] forward port branch 12.0 up to 8f21148e1a 2019-05-31 14:37:38 +02:00
Yannick Tivisse f5dfe4727c [IMP] api.py: Rename company_id/company_ids into company/companies
The goal is to be coherent with the user property.

Actually, company_id and company_ids on the environment are no fields.

Calling env.company_id returns a browse record, not an id.
2019-05-29 08:09:15 +00:00
Sébastien Theys 0ac7635b54 [FIX] sale: fix get_combination_info RPC when product_id given
Follow up of 51ef8514ea

The RPC would fail to return the correct value for `is_combination_possible` if
a product_id is given instead of a combination.

opw-2003069

closes odoo/odoo#33677

Signed-off-by: Sébastien Theys <seb-odoo@users.noreply.github.com>
2019-05-27 11:45:18 +00:00
Yannick Tivisse a5b6f31cf2 [IMP] base: Contextualize the multi company
Purpose
=======

Allow the user to select the allowed companies for which he wants to see records
on top of selecting his current company.

It is confusing for users to see the records from the company he is connected to
and the records of the children companies.

Instead of using the hierarchy of companies to access records across companies,
the user can now select (from his set of allowed companies) the companies for
which he wants to access records.

/!\ This means that the user will interact with records from company A when in
company B.
Example: a SO has been created and confirmed in A. When in B, I create the
invoice from it.

Specifications
==============

1/ Deprecate the parent/children hierarchy on the res.company model. The fields are
kept on the res.company model to ensure the retro-compatibility, but won't be used
accross the standard code anymore. The only functional usage for this mechanism
was to allow to see records from several companies by creating a virtual parent
company, which will be possible with the new mechanism.

2/ By default, a user will only see the records of the company he is connected
to (or records without a company). (It is still editable by the user if needed).
For that, put this information in the user context, to allow having different
configurations on different browser tabs. Instead of having domains like
['|',
('company_id', '=', False),
('company_id', 'child_of', user.company_id.id)]
you'll have something like
['|',
('company_id', '=', False),
('company_id', 'in', company_ids)]
Note that the 'company_ids' is a value that is passed in the evaluation
context on the record rule, as we already have user, or time.
company_ids is a list of the ids of all the enabled companies in the
user's context.

3/ Out of the generic improvements brought by this task, this will illustrate
issues that could exist since several versions. For example, it should not be
possible to create a scrap order for the company A with a package of the company
B, or it should not be possible to create an invoice on the company A with
payment terms from the company B. Before the version 12.0, it was easy to
encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side
effect of the fact that the SUPERUSER_ID has become an inactive user was to
make it more difficult to introduce mismatch on the records, but haven't solved
the issue, as it was still possible to do it with parent companies
configuration. Some of these issues have been fixed in this commit, but all the
business flows should be re-tested to check if an ir.rule should be introduced
(eg: a multi company rule for stock.quand.package), if the company of a record
is correctly transfered to another record created from the first record (eg:
From a SO, create an invoice and a payment, the company of the sales order
should be transfered on the invoice and the payment, even if the company of the
sales order is A and I'm logged into the company B with the company A enabled.

4/ Currently, if I click on a button on a notification email (example 'View
Task'), I face a traceback if I'm not logged into the company of the record.
Now, if you click on a button and if you have access to the record, the correct
company will be automatically set.

5/ If I display a kanban view with several records from several companies (and
an image), all the images should be displayed.

6/ Currently if you copy paste an url, this will crash if you're not in the
correct company. This won't be fixed because it's quite impossible to do it in
a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into
the correct company, re-copy/paste -> Ok.

7/ 2 property methods have been added on the environment to retrieve the company
on which the user is logged in and the companies the user enabled, on a specific
tab.
That way, when creating a record, instead of doing
default=lambda self: self.env.user.company_id
do
default=lambda self: self.env.company_id
On the other hand, to retrieve the enabled companies, do
companies = self.env.company_ids

8/ Modify the Company Switcher widget to allow to log into another company
WITHOUT writing on the res.users (and thus bringing cache invalidation issues
and so on). Also allow to enable several companies and see records from several
companies, and independantly of the other browser's tabs.

9/ When focusing on a tab, save the current company configuration on the local
storage. That way, when doing 'CTRL+T' or a middle click, the context is
propagated to the new tab.

10/ Improve the error message in case of multi company access errors. Now, when
the user is in debug mode, display the related names of the records and the name
of the user who brings the issue.

11/ Remove the context erasing when writing on a res.users
This is probably coming from the migration to new API of the base module.
The context was not propagated at this moment, which was a common mistake at
that time. When migrating the module, probably by using the 'black box' method,
as the context was not propagated, it was erased on the new version. This is
now an issue because the context (i.e. the enabled companies) was erased when
writing on a res.users, leading to tracebacks.
See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624

12/ Fix the crash manager on redirect warnings. The issue is the following
- Create an invoice on a company without a configured CoA.
- Set a partner
- On the onchange_partner_id, a redirect warning is raised to propose you
to configure a CoA
- Click on 'Go to the configuration panel'
- A generic warning says something like 'Do you want to discard your changes?'
- Click on yes, the page refreshes, but not on the redirect action.
Now, set correctly the action on the hash, and reload instead. The breadcrumb is
lost for example, but you reach the correct action at least.

13/ Introduce a res.group to enable/disable the multi company per tab
feature.

14/ To help the users to know which tab is in which company, add the
possibility to have a favicon per company. When creating a company,
the classical 'O' icon is colored by default in a random color.

15/ Remove the company switcher on the frontend. This was mainly there
to allow a user to swicth to the company linked to the website.
This behavior is now transparent to the user. If the website A is
activated, then the company set on the context is the company of the
website.

16/ Deprecated the _company_default_get method on the res.company
model. Remove the method _get_company on the res.users model.

17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval
context. You can now use those variables on domains in the views to
access directly to the activated company.ies on the current tab.

TaskID: 1960971

closes odoo/odoo#32341

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-13 08:57:49 +00:00
Mitali Patel 74c5c00aff [IMP] sale, website_sale : improve emails sent on confirmation and payment
Purpose of this commit is to send the order and payment details email to user
when they purchase any order from ecommerce or when do the payment from
portal. Currently it was sending quotation mail when the payment is processed.
Now it send an email for quotation, and one email for sale confirmation that
may contain more detailed content if coming from website (eCommerce).

In sale

 * create new confirmation template and set the default template in sales
   settings;
 * when payment enabled in sales settings then display template option to send
   default confirmation mail when payment is processed or order signed;
 * add tool method to find the right template to use when sending the
   quotation / SO by email;
 * ensure email is sent everytime SO is confirmed;

In website_sale

 * add option in website setting in order, to set the confirmation mail
   template;
 * ensure email is sent everytime SO is confirmed;

Related to task ID 1873634
Linked to PR #28781
2019-05-09 14:58:21 +00:00
Sébastien Theys 51ef8514ea [FIX] product,sale,website_sale: compute combination possible in rpc
This has several advantages:
- make the code easier to maintain by having the logic only on the python model
- prevent price flickering when changing from/to an impossible combination
- fix the UI for the issue mentioned in the previous commit/the opw
- make the code much faster when using many combinations, by not requiring to
browse and to return every existing and every archived variants

The opportunity is also taken to properly throttle the rpc and to use
"DropMisordered" on its result:
- fix all the other remaining flickering when changing quantity or combination
- fix the server being spammed of rpc when using the configurator modal, but
also in a lot of other cases such as incrementing the quantity, ...
- fix UI consistency by ensuring the result of the last rpc is always the one
displayed, obsolete rpc returns are ignored

By computing the possibility of the combination asynchronously, the two
drawbacks are:
- the UI is a bit less reactive than in the previously the best case scenario,
but this almost completely mitigated by debouncing with a leading call
- it is possible for a quick user to click on "add to cart" on an impossible
combination before the return of the rpc, but this is not really an issue
because when the product will be added to cart there will a check and the
closest possible combination will be selected automatically instead

Finally the event of the configurator mixin and the widgets using it have been
cleaned to avoid the duplication of the rpc in the first place.

opw-1959317
PR: #32691

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-21 10:11:38 +00:00
Christophe Simonis 71faa19af0 [MERGE] forward port branch saas-12.1 up to 2b3296bbf8 2019-03-11 14:42:34 +01:00
Christophe Simonis 2c5c9b8342 [MERGE] forward port branch 12.0 up to c023d0784f 2019-03-08 17:56:14 +01:00
Aurélien Warnon eff1f45767 [REF] *_product_configurator,website_sale: remove deprecated methods/params
Task #1891970

Purpose
=======

This commit cleans up the deprecated methods introduced during the product configurator
post v12 fix (ref: f8dad1bb4b).
2019-03-28 14:55:01 +00:00
Aurélien Warnon 3cb46ec74c [ADD/MOV] sale_product_configurator: new module and files move
Purpose
=======
- Moved the product_configurator into its own module now that we have a specific option for it.
  The option only enables the p. configurator in the SO form.
  The e-commerce should always allow customer to configure their products, even if the option is not checked.

  This allows moving some of the code specific to the p. configurator into its own module.
  However, a lot of the code has to remain in "sale" module since the e-commerce does not require the option
  checked and needs the "configure product" feature in the shop by default.
  (This is why the fields "product_custom_attribute_value_ids" and "product_no_variant_attribute_value_ids"
  are still in the "sale" module)
2019-03-27 15:12:50 +00:00
Aurélien Warnon d9423656ce [IMP] (website_)sale: improve the exclusion mechanism in p.configurator
Targets commit d3530eb07e
References task id 1891970

Purpose
=======
- A message will be displayed when hovering a disabled attribute value's input to explain why it's disabled.
  e.g: Not available with Color: Black

  This works for both exclusions within the product and exclusions from a reference product.

- The exclusions will work in both sides, if "black" excludes "metal", "metal" will also exclude "black".
2019-03-27 15:12:48 +00:00
Sébastien Theys 15adbcab1b [FIX] sale,website_sale_stock: prevent compute stock from /shop
The `_get_combination_info` override in website_sale_stock is only necessary
when we want to get the stock, which is on the product page RPC.

Before this commit, the stock would be computed all the time, which slowed down
the requests for no reason.

opw-1923999
task-1922055
PR: #30274
2019-02-15 10:17:03 +00:00
Hetal Dhanak ef61713418 [IMP] sales: make sign and pay in portal a continuous flow
Purpose of this commit is to make a single flow to sign and pay in the
customer portal. When having signed its document popup for payment is
automatically opened.

This is much better for usability and avoid to have orders being signed
and not paid because the customer did not see it was still to be paid.

This commit is related to task ID 1910532 and PR #29849 .
2019-02-08 12:48:54 +00:00
jem-odoo 17ac041bfa [REF] portal: posting message with signed token
Before this commit, it was possible to post a message on a document
the user has no access, thanks to a token. In addition to this token,
if a hash (signed token with a partner id), the author_id of the message
was forced.
This commit change a little bit that logic by distinguish 2 cases:
1/ Token only: anyone with the token can post a message on the document. If
  the user is not logged (public with token), the author_id will be the
  customer of the document (or the public user). This case is moslty used
  for business document, through the portal or with the "share link" for
  instance.
2/ Signed token: user has no write access to the document, but can post a
  message on it. The user have to be logged, as the token is signed with its
  identifier. The goal here is to avoid leaking the access token's document
  to all visitors. This case is mostly used for public content, such as blog
  posts, slides, ...

The token case was already existing. The second is now working with this
commit. To do so, it was required to
- move `_sign_token` from the portal mixin to mail.thread.
- transfering 'pid' and 'hash' parameters from the controller to template
to js widgets.

This commit also change the `_message_post_helper` signature by making
the 3 first parameters required, as to post a message you need at lease
res_model, res_id and the message body. The optional argurments and kwargs
are here to check the bypassing access rights mecanism.

Task-1902304
2019-02-06 09:55:13 +00:00
Hetal Dhanak 32486fc1a6 [IMP] sales: make sign and pay in portal a continuous flow
Purpose of this commit is to make a single flow to sign and pay in the
customer portal. When having signed its document popup for payment is
automatically opened.

This is much better for usability and avoid to have orders being signed
and not paid because the customer did not see it was still to be paid.

This commit is related to task ID 1910532 and PR #29849 .
2019-01-31 10:38:59 +00:00
Christophe Simonis 8aa8548d8a [MERGE] forward port branch 12.0 up to 3e4138deaa
closes odoo/odoo#30045
2019-01-09 15:56:53 +00:00
Nicolas Martinelli 012eefcf3e [FIX] sale: company logo on portal
- Set a logo for Companies A & B
- Create a partner P in A
- Create a SO for P in B
- Send the SO by email
- In the email received, click on 'View Sales Order'

The logo displayed is the logo of Company A instead of Company B.

The logo is retrieved from `res_company` in the template:

https://github.com/odoo/odoo/blob/6be0cdef98fdafc2cb90042758de1b756e955624/addons/portal/views/portal_templates.xml#L31

However, `res_company` is set based on the company of the user:

https://github.com/odoo/odoo/blob/6be0cdef98fdafc2cb90042758de1b756e955624/odoo/addons/base/models/ir_ui_view.py#L1295

We make sure to set `res_company` based on the company of the order
instead. This works since the `values` have the priority over the
`qcontext`:

https://github.com/odoo/odoo/blob/fa9874915449896ff770adbb63780629c18b3e7b/odoo/addons/base/models/ir_ui_view.py#L1283

opw-1913665

closes odoo/odoo#29649
2018-12-19 14:18:13 +00:00
Sébastien Theys f8dad1bb4b [FIX] product,(website_)sale(*): fix product configurator
This commit has several parts:

- fix ordering of attributes and values
- fix/create python logic (notably for checking the possibility of a combination
	and for price computing)
- fix currency
- display correct info on the views without the need of JS (prevent flickering)
- fix various issues with website and SO
- add a lot of tests (both unit and tour)

================================================================================

*** Make consistent the filtering and ordering of product variants ***

Filter & Check possibility
==========================

The first variant shown on the website should always be possible.

When activating the customize "list view of variants", we don't want to show
impossible combination on the list.

We also don't want the user to be able to add to cart an impossible variant.

Show appropriate messages when no combination is possible.

Order
=====

We want the variant order to be consistent with what the user selected with the
sequence fields. The display order on the website should be the same than the
display on the various backend views.

This implies also fixing the order of:
- product.attribute
- product.attribute.value
- product.template.attribute.line
- product.template.attribute.value

The general order is now: (parent,) sequence, id.

Before, it was already a mix of those, but not always in the same order, and not
every key for every model. The name has been removed from the order: either we
sequence them correctly, or we want them in the creation order.

On the website, the first combination shown by the python should be the same as
the one that will be computed by the JS to prevent flickering.

Ideally there should be no RPC at page loading if the python has computed
everything correctly, but it is currently not possible to achieve because the
view logic for website_sale_stock is only in JS.

================================================================================

*** Fix product template and variant price computation ***

Move and improve the get_combination_info method:

- take into account tax included/excluded settings (B2B/B2C)
- take into account pricelist discount policy (striked price)
- fix inconsistencies when price after pricelist would be 0
- use proper rounding and discount compute with the currency helper methods
- fix an issue where context "partner" would have a mix of id and recordset

================================================================================

*** Fix currency conversions ***

The list_price and lst_price of a product are always encoded using the currency
of the product.

The results of "combination info" are always returned using the currency of the
pricelist if given, or the currency of the product.

The prices on an order (line) are encoded with the currency of its pricelist.

================================================================================

*** Fix dynamic variants access rights ***

Public users on the e-commerce should be able to create product variants if the
configuration of the attributes of the product template is set as "dynamic".

This uses "sudo" to bypass create security rules for public users.
Multiple checks are done to ensure that it creates a valid product variant.

================================================================================

*** Miscellaneous bugs, tracebacks and necessary improvements ***

In general:
 - correctly show warning when no variant is possible
 - don't let user add to cart an impossible variant (from optional product
 	modal or from any RPC), both in interface and controller logic
 - fix as much flickering as possible by correctly pre-computing in python/views
 - move business logic from controllers to models
 - correctly add no_variant and is_custom values on the SO line description

Sale order:
 - fix traceback when emptying the product_id field from configurator

website_sale:
 - correctly compute first image / carousel, and correctly swap images when
 	changing variants, without duplicate image or zoom problems
 - don't use list view of variants when it doesn't make sense
 - added missing product info when adding a no_variant attribute to cart
 - fix cart accessory product computation

website_sale_wishlist:
 - fix it with dynamic variants, no_variant and is_custom

website_sale_comparison:
 - fix it with dynamic variants (comparison and alternative products)

website_sale_stock:
 - fix it in general (some flickering still present)

================================================================================

Authored by @seb-odoo with contribution from @awa-odoo

task-1910821

closes odoo/odoo#28079
2018-12-18 16:21:32 +00:00
Christophe Simonis 7a0243ec15 [MERGE] forward port branch 12.0 up to b3052b690f 2018-11-23 12:11:32 +01:00
Nicolas Martinelli 84bf9f3145 [FIX] sale: free optional product
- Create a dynamic product P1 with an optional product P2
- The list price of P2 is 20
- Create a pricelist where P2 is free (fixed price of 0)
- In a SO, choose 'Configure a product' and choose P1, add

In the modal which suggests P2, its price is 20 instead of 0.

This is because we fall back on the list price when fetching the
combination prices.

This should not be necessary since:
- a pricelist is required to fetch a price
- a pricelist should always contain a rule applying to all products

Therefore, the list price doesn't need to be used as a fallback.

It is then necessary to modify the test tours by adding a partner on the
SO before selecting the product. Anyway, this is usually the way to go
since the selection of the partner determines the pricelist.

opw-1902456

closes odoo/odoo#28687
2018-11-20 10:22:56 +00:00
Geoffroy Larue e9879e63b4 [IMP] portal: improve design
Small changes to the customer portal : form input reorderings,
relabelling, removal of the draft quotation warning.
2018-11-16 09:33:06 +00:00
Sébastien Theys 130af96dc1 [IMP] portal,sale: improve signature widget and move it to portal
Purpose
=======

The goal is to avoid duplicate code between portal and sign (enterprise), and
also to allow the user to use the signature mode 'auto' and 'load' in portal
(before this commit only 'draw' was available in portal).

The sales order signature (currently the only portal signature) has been changed
to use this new code.

This signature widget has been improved:

Improved style:
 - better structure and use of BS classes
 - removed most of custom CSS
 - made it more responsive

Changed code to follow guidelines, added JSDoc.

Technically
===========

New widget NameAndSignature common to portal and sign (enterprise).

Reworked existing portal signature form to use new widget.

Related to enterprise PR https://github.com/odoo/enterprise/pull/3266

task-1894903

closes odoo/odoo#29453
2019-01-28 09:48:32 +00:00