Commit Graph
1906 Commits
Author SHA1 Message Date
Elisabeth Dickinson b2ef35a431 [IMP] *: replace .bg-color by .text-bg-color on ribbons
Also remove unnecessary CSS on ribbons.

Part-of: odoo/odoo#116641
2023-05-12 22:59:16 +02:00
clesgow 08ae8609c9 [IMP] purchase_requisition: set RFQ origins for alternatives
When creating an alternative RFQ, set the source document of the
original RFQ as source document of the newly created alternative.

Part of task-3218314

Part-of: odoo/odoo#119381
2023-05-09 21:04:01 +02:00
clesgow 2a6f1e32f5 [IMP] purchase_requisition: unlock blanket orders custom descriptions
It should be possible to modify the custom description of a Blanket
Order line without having to reset it to draft to do so.

Part of task-3218314

Part-of: odoo/odoo#119381
2023-05-09 21:04:01 +02:00
Touati Djamel (otd) f23d0fedfa [FIX] purchase: compute the price with correct UoM in PO alternative
Steps to reproduce the bug:
- install the `purchase_requisition` module
- Create a storable product “P1”:
    - UoM: unit
    - cost: 10
- Create a PO:
    - Add 1 unit of “P1”:
        - Change the UoM from unit to Dozen
        - the unit price will be updated from 10 to 120
     - Save the PO
- Create a Po alternative

Problem:
The “Unit of measure” is correctly copied, but the unit price is wrongly
computed “10” instead of 120.

When creating the PO alternative, we copy the uom of the original
lines in the vals:
https://github.com/odoo/odoo/blob/4c2163d2b195a0c829d4e24a7afc3347e7c3401a/addons/purchase_requisition/wizard/purchase_requisition_create_alternative.py#L84

then, The line is created with the correct UoM, but we force the call
to `onchange_product_id`:
https://github.com/odoo/odoo/blob/c677f45dcb050ce7e6f755b71e56c9b9120bf613/addons/purchase/models/purchase.py#L1371-L1372

So `_product_id_change` will be called:
https://github.com/odoo/odoo/blob/c677f45dcb050ce7e6f755b71e56c9b9120bf613/addons/purchase/models/purchase.py#L1163

And the product UoM “Unit” will be set in the `purchase.order.line`:
https://github.com/odoo/odoo/blob/c677f45dcb050ce7e6f755b71e56c9b9120bf613/addons/purchase/models/purchase.py#L1171

Therefore, the unit price will be calculated with Unit instead of dozen:
https://github.com/odoo/odoo/blob/c677f45dcb050ce7e6f755b71e56c9b9120bf613/addons/purchase/models/purchase.py#L1225

Solution:
We have to ensure that the values only created by onchanges and not
provided during the alternative PO creation are still created via the
`onchange_product_id`. Therefore we avoid the incorrect uom reassignment
during the calculation of the unit price when creation is from an alt
PO creation with uom included.

closes odoo/odoo#117808

X-original-commit: 93769b9b51196c0aed74fc74cca1fcacdc59f789
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-04-05 17:31:55 +02:00
Saran440 afcf0fba8d [FIX] purchase: default currency from context
closes odoo/odoo#116238

X-original-commit: ba6f90c2d664b7cef7f7ecd619b763ad6fe2138b
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-03-23 12:14:51 +01:00
Martin Trigaux 1be5eae8ef [I18N] *: remove nl_BE files
They dates from < 2027 and are quite outdated. Favour the nl
translation instead.
n_BE is not on Transifex so it was not possible to correct bad
translations.

closes odoo/odoo#115845

X-original-commit: d04c8b7e484db8306d858c891a7a2b11885fdcd9
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-03-20 16:51:30 +01:00
Touati Djamel (otd) f7abd3b960 [FIX] purchase_requisition: create alternative PO without requisition_id
Steps to reproduce the bug:
- Create a blanket order:
    - add any storable product
    - Confirm
    - Click on new quotation
- Create an alternative purchase order from the new PO

Problem:
A user error is triggered, because the “date_planned” is not set in the
`purchase.order.line`:
"The operation cannot be completed: Missing required fields on
accountable purchase order line."

The `default_requisition_id` is set in the context, so the alternative
purchase order is created with the `requisition_id` field set, and in
the compute override `_compute_price_unit_and_date_planned_and_name`:
https://github.com/odoo/odoo/blob/863c5090f09bfffc2867717ed8b3c99b05a5eb9c/addons/purchase_requisition/models/purchase.py#L119-L120

we don't set the `date_planned` and don't call the super compute with
this record, therefore the `date_planned` is not set:

https://github.com/odoo/odoo/blob/863c5090f09bfffc2867717ed8b3c99b05a5eb9c/addons/purchase_requisition/models/purchase.py#L132

https://github.com/odoo/odoo/blob/863c5090f09bfffc2867717ed8b3c99b05a5eb9c/addons/purchase/models/purchase.py#L1209-L1210

opw-3217377

closes odoo/odoo#115596

X-original-commit: 831ebe11c45e59c16a43051889512dc14fa75eb1
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-03-17 11:47:24 +01:00
Touati Djamel (otd) 934d9a5caa [FIX] purchase_requisition: create a PO alternative with note & section
Steps to reproduce the bug:
- Create a PO:
    - Add a product
    - Add a note or section
- Go To Alternatives:
    - Click on “Create Alternative”
         - Add another vendor
         - Try to validate

Problem:
An error is triggered: “The operation cannot be completed: Description
(name) is mandatory”

The “display_type” and “name” fields must be copied in the vals to
create a `purchase.order.line`

opw-3164863

closes odoo/odoo#115070

X-original-commit: 66f806399d173f53b61db80b81d06a93421c75a3
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-03-13 15:28:01 +01:00
Victor Feyens 24ccf7d9b0 [CLN] *: useless type info for actions
The type fields of actions already defaults to
the model name in the base model definition.

Therefore, specifying `ir.actions.server`, `ir.actions.act_window`
& so on as type is useless (and adds noise since it's the same as
the action model).

closes odoo/odoo#114539

Related: odoo/enterprise#37855
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-08 17:33:37 +01:00
FrancoisGe 17a24020ac [REF] *: do not use activeFields in Field components
This commit is to replace all uses of activeFields in Field components
by passing fieldInfos to extractProps. We will therefore retrieve the
node-dependent information in the extractProps function.

Why?
This ensures that the info used is that of the correct node. Because the
activeFields function contains the information from the last node that
referred to the same field.

Example:
<tree>
    <field name="a"/>
    <field name="a" context='{'b':"yop"}'/>
</tree>

For the first field:
    FieldInfo.context = {}
    activeField.context = {'b':"yop"}

For the second field:
    FieldInfo.context =  {'b':"yop"}
    activeField.context = {'b':"yop"}

Part of task: 3179751

closes odoo/odoo#113874

Related: odoo/enterprise#37621
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-06 15:18:48 +01:00
Michael (mcm) 9f4622492c [REF] *: register field descriptors instead of components
Before this commit, the field's description was stored on the
component and this component was then registered.

Now, an object describing the field is used on registration the same way
as it is done for views since https://github.com/odoo/odoo/commit/b828cfc72c587d0b73fcc5459695705640437671.
This split the component's description (props, template, ...) of
the field's description (displayName, supportedTypes, ...) and makes
it clearer.

closes odoo/odoo#112498

Task: 3171520
Related: odoo/enterprise#37105
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 14:13:32 +01:00
svs-odoo 4dd3104b96 [IMP] product_expiry,purchase_requisition,stock*: visual changes
- The `picking_type_id` field in the pickings form view is not openable;

- Display the `description` field (optional) in the SVL list view;

- Add the `expiration_date` field (optional) in the quant list views;

- Add a description text for the landed cost;

- Renames field `requisition_id`: "Purchase Agreement" > "Blanket Order"

- In Inventory Adjustment, hides the "Apply All" button is at least one
  record is selected;

- In `product_expiry`, renames two views to stick to the XML's coding
  guidelines: https://www.odoo.com/documentation/16.0/contributing/development/coding_guidelines.html#xml-ids-and-naming

- For the replenishment:
  - Places the field `product_id` as the first option when the user
    writes something in the searchbar;
  - Renames `route_id`: "Preferred Route" > "Route";
  - Renames the button "Automate Orders" into "Automate";
  - Set the `route_id` field as "optional=hide" until `mrp_purchase` is
    installed (in this case, it will be set as "optional=show") because
    in this case, there is at least two routes (Buy and Manufacturing).

task-3076044

Part-of: odoo/odoo#109511
2023-02-13 15:15:06 +01:00
niyasraphy 802d50219f [IMP] purchase_requisition: blanket order reference
currently on confirming a blanket order will generate a reference for the record using the sequence and once the record is moved to cancel state and clicking the reset to draft button is clearing the already assigned reference number.

and on clicking confirm again will generate a new reference number for the same record.

this pr will stop clearing the sequence number on reset to draft button.

closes odoo/odoo#108574

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-02-10 09:11:48 +01:00
niyasraphy 2f069b9ce8 [FIX] purchase_requisition: access right error on confirm/cancel bo
before this commit, on closing/confirming a blanket order by a purchase user throws access right on product_supplierinfo model.

after this commit, access right error will not be shown on confirming and closing the blanket order.

closes odoo/odoo#111896

X-original-commit: 9d86621029a478b8e1cbae4f228fe454a184fba3
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-02-03 17:41:18 +01:00
Hansun (hale) 37e1d01166 [FIX] purchase_requisition: adequate display of internal reference
To reproduce the issue:
1. Install Inventory & Purchase apps
2. Toggle on Settings > Inventory > Purchase Agreements and save
3. Go to Purchase
- [Products] > [Products]: add a product w/ internal reference and w/o
- [Orders] > [Blanket Orders]: create a blanket order with the products
- Save, Confirm and click Print icon to generate the said report in pdf

Desired behavior: Do not show brackets for null internal reference

opw-3138636

closes odoo/odoo#110812

X-original-commit: fb0567ee4fe75d3d0ab2475eaf1c7277ee24636a
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-01-24 13:47:26 +01:00
Martin Trigaux 776689b0f4 [I18N] *: export saas-16.1 source terms
closes odoo/odoo#110752

X-original-commit: 56b2b52287a8f2192d80ea417c7efac80a87c0a9
Related: odoo/enterprise#36173
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-01-24 10:20:30 +01:00
niyasraphy 9a3a41202a [FIX] purchase_requisition, stock: improve usererror to show allowed stages
in purchase_requisition and stock module, when deleting a requisition and move, the raised warning says,the deletion can be done only in draft moves, where us the deletion is allowed for the cancelled records also.

improving the user error message to include the cancelled records in the message.

closes odoo/odoo#110340

X-original-commit: b71d298dabb4436182c0eb516d5a7b7e76fca437
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-19 12:30:59 +01:00
Thibault Delavallée 4775bd93a2 [REF] mail: cleanup post with {view, template} wrappers
RATIONALE

Purpose of this commit is to cleanup main post helpers and have a more easy
and understandable way of calling them.

SUMMARY

We now have two main API methods, based on business flow: either posting
on documents, either sending a mass mailing. Indeed those two flows are
different

  * post: create message, then launch notification process by taking into
    account subtype, followers, ...
  * mail: create mails in batch with recipients being based on template or
    given partners. No notifications is involved, only maybe traces if a
    mass mailing is linked

Delegate QWeb rendering to the render mixin (i.e. _render_template_qweb_view)
in order to have a single point to forge evaluation context and re-use
existing rendering code.

SPECIFICATIONS

Main API helpers are now

  * ``message_post_with_source``: (batch) post on records, using an ir.ui.view
    (given a record or its xml id) or a mail.template record (given a record or
    its xml id). When using a template, a composer is called to post on each
    record (as batch post is not yet supported). When using a view, a direct
    call to message_post using the rendered bodies is done, one record at a
    time.
  * ``message_mail_with_source``: send a mass mailing on records, acting like
    invoking the mail composer in mass mode. Same arguments are valid, either
    a reference to a view, either a reference to a mail template.

Other helpers are

  * ``_message_log_with_view``: (batch) log on records, using an ir.ui.view
    to render the body using QWeb (no notification process);
  * ``_message_log(_batch)``: (batch) log on records (no notification process);
  * ``message_notify``: notify partners on records (creating notifications
    specifically for some people while message itself is not displayed in
    chatter);

Code migration

  * ``message_post_with_template`` in "mass mode": use ``message_mail_with_source``
    and set the template record as source;
  * ``message_post_with_template`` in "comment" mode: use ``message_post_with_source``
    and set the template record as source;
  * ``message_post_with_view``: its main usage was to post on a document, in which
    case it generally can be replaced by ``message_mail_with_source`` using
    the view reference as source;

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:34 +01:00
Thibault Delavallée 418761e344 [LINT] mail, various: use explicit subtype in message_post_{with_...}
RATIONALE

Purpose of this commit is to be explicit in subtype chosen when invoking the
message composer / calling message_post. As default value may not always be
clear, better be explicit in case the composer default value changes.

SPECIFICATIONS

Add explicit references to subtype when it is not obvious what will be the
final subtype, notably when using helpers (post_with_view or template which
uses the composer that is not crystal clear in its subtype management).

In this commit we also add support of XMLID-based subtype when invoking the
composer. A ``default_subtype_xmlid`` context key is transformed into a
``default_subtype_id``, to be used notably in JS where we cannot easily
use a ``ref``-like statement. Post API now also supports 'subytpe_xmlid'
argument allowing to give the xml id and ease calling the methods.

Use ``_xmlid_to_res_id`` to get directly the ID of subtypes in order to
avoid useless queries from ``ref`` that does an exists.

Also remove useless values given to post API, notably author_id that is by
default the current users' partner.

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
2023-01-17 20:58:33 +01:00
clesgow 3449a6d7c7 [FIX] purchase_requisition{,_sale}: Link SO to alternative RFQ
Steps to reproduce:
- Create a service that is subcontracted `service_to_purchase` = true
- Create a SO containing this service
- Go to the newly created RFQ
- Go to Alternatives -> Create Alternative and select a new vendor
- The alternative RFQ doesn't show a link to the SO, nor the SO to this
RFQ

Initially, when the alternative RFQ is created, only the `product_id`
and its quantity is copied to the new RFQ. Now we add the reference to
the SO as well so the RFQ is properly linked to the original SO.

Part of task-2985735

Part-of: odoo/odoo#106411
2023-01-13 16:27:26 +01:00
niyasraphy 8ae9212b15 [FIX] purchase_requisition: show button without clicking save button
install purchase_requisition module, and create an RFQ in db, check the alternatives tab in the notebook, currently the button Create Alternatives will not be visible unless user click the save button manually. button no longer needs to be hidden when creating a new PO since v16 added in the auto-save feature

closes odoo/odoo#107733

X-original-commit: a6a830e89c724f993b930442573d8d0c4e692b07
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-12-12 15:17:23 +01:00
niyasraphy eccc308f18 [FIX] purchase_{}, sale_stock, stock: quantities typo
closes odoo/odoo#107242

X-original-commit: 2e18bc8ced09e3100f509b56738cba8ac4288355
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-12-07 15:32:06 +01:00
niyasraphy 9b603054ed [FIX] purchase_requisition: fix singleton error
Activate Product variants and create a new products with attributes Legs, Size and color.

Now enable Variant Grid Entry and Purchase Agreements from purchase settings and now create a Blanket Order from Purchase -> Orders -> Blanket Orders with any products from above created variants.

Confirm the created blanked order and click on New Quotation, now a new RFQ will be created, and click on add an item button and select the product we have created before, now Choose Product Variants matrix will be opened. Enter some random quantities in multiple lines and click on confirm button.

Exception will be raised

closes odoo/odoo#106572

X-original-commit: ca94ace181675b6e150c0f7486de9495198dc8e8
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-11-25 18:55:40 +01:00
clesgow 258ac595a0 [FIX] purchase_requisition: Compare product lines
Steps to reproduce:
- Create a product with both MTO and Buy routes.
- Create a Sale Order containing this product.
- On the created PO, go to Alternatives -> Create Alternative and select
another vendor.
- Go back to the original Sale Order
- Click on the linked Purchase Order
- Go to Alternatives -> Compare Product Lines

When doing this, the `active_id` in the context is the id of the Sale
Order, which raises an issue in the renderer for this list as it's using
the active_id as if it was the Purchase Order.

closes odoo/odoo#106481

X-original-commit: 1b904ece76f55f8e416d868256720f41cba8ceb1
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2022-11-25 09:53:13 +01:00
niyasraphy 850bb0a9d9 [FIX] purchase_requisition: wrong seller in context to get supplier info
the context passed to the method _get_product_purchase_description for the seller_id is wrong. system is expecting to get product.supplierinfo record set in this context key and from this function res.partner record set is passed, which results in the below error:

Record does not exist or has been deleted.
(Record: product.supplierinfo(70,), User: 2)

closes odoo/odoo#105998

X-original-commit: 6e7f778e1d0dbe4795fa9446bfd3542ecec9815c
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-11-18 12:58:16 +01:00
niyasraphy a57b79a309 [FIX] purchase_requisition: warning field visibility condition
activate warnings from purchase settings and open any purchase order and click the create alternatives button from alternatives page. in the next wizard, Warning Messages field is visible always, upon checking the view, it seems the visibility condition given is wrong and thus it get visible always.

closes odoo/odoo#105977

X-original-commit: 40ec1fe8fbaf97faccda7dcd87e308277275bae4
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-11-18 09:57:48 +01:00
Tiffany Chang (tic) 4e32d1fe37 [FIX] purchase_requsition: ensure product_uom_id exists in bo lines
Previous commit 0501bbd62e made it so
the `product_uom_id` for the `line_ids` of a purchase.requsition (i.e. a
blanket order) were no longer being saved when the UoM setting is not
active. This would cause an error to occur when the "New Quotation"
button is pushed because the missing uom is expected by purchase
_onchange_requisition_id.

Steps to reproduce:
- Have UoM setting NOT active
- Create a blanket order for any product/vendor
- Confirm the blanket order
- Click on "New Quotation"

Expected Behavior:
New RFQ created

Actual Behavior:
Stacktrace

We also properly restrict the product_uom_id in the form view of the
line_ids to when the uom setting is active.

closes odoo/odoo#104900

X-original-commit: e90200a7b927ecccb8d4d6f31e3ddecba24d0b6d
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-11-17 11:58:50 +01:00
niyasraphy 7ba966d3e2 [FIX] purchase_requisition: typo for quantites
closes odoo/odoo#105442

X-original-commit: 9dd93b697a6ff50314b2fb2e5894b7125b8b207a
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-11-09 15:04:06 +01:00
niyasraphy 91a52f71c1 [FIX] purchase_requisition: wrong field name in function
closes odoo/odoo#105156

X-original-commit: f6d0482b031d03af227f9765d5e5ee981342a913
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-11-07 15:57:33 +01:00
niyasraphy 21cfd78028 [FIX] purchase_requisition: name field alignment in the form
closes odoo/odoo#104710

X-original-commit: a90bfd58f9cdb41d5a20ca98d7e233583a679192
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-11-02 13:36:14 +01:00
svs-odoo 0ebbc8f1d5 [FIX] purchase(_stock): don't recompute price unit
Before this commit, when the quantity of a PO line is changed, its unit
price is recomputed, which means it will be set to 0 if there is no
compatible vendor price for the selected partner/product.
It can be annoying because if the price unit was set manually by the
user, this info is lost.
To avoid that, we don't recompute the unit price if the PO line matches
the following conditions:
- The PO line has already a price unit;
- There is actually no vendor price list for the partner (in such case,
  we prefer to avoid to stick to a price who doesn't match that list);
- The UoM wasn't changed, because if the UoM was changed, the price
  should obviously recomputed (the price unit for 1 unit is not the same
  than for 1 dozen).

How to reproduce:
- Install Stock and Purchase modules;
- In purchase settings, enable "Purchase Agreements";
- Create a product and in its vendor price list (in "Purchase" tab), add
  a price for Partner A (e.g. 10$);
- Create a PO for Partner B, add a PO line for the created product and
  set the `price_unit` higher than the created vendor price (e.g. 15$);
- Confirm the order and go in the "Alternatives" tab;
- Click on "Create Alternative" and select Partner A as the vendor;
- Click on "Compare Product Lines" and choose the line for Partner A;
- Go back in the first created PO (with Partner B as vendor)
  -> the PO line's quantity is to 0, which is good, but its unit price
     is also set to 0 which is annoying.

Additionnaly, in `_get_stock_move_price_unit`, `float_round` the value
just before it was returned because previously, the rouding was done
before the multiplication by the UoM's factor which can cause some
rounding issue if the rouding is not done after that.

closes odoo/odoo#104206

X-original-commit: f5a24b10cb3a4cf32c6c185df65f3099c8da3ff1
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Steve Van Essche <svs@odoo.com>
2022-10-27 10:37:40 +02:00
gawa-odoo b8dca3b174 [IMP] analytic, *: Json field for analytic distribution
The `analytic_distribution` field is a Json.
It was stored temporarily as a char.

Search is not available yet, so we do queries by hand when we need to search on keys.

Also added a constraint on account_analytic_distribution_model,
so we don't have models with accounts specific to a company when the model has no company or another company.
It would cause an issue when looking at the models from another company.

X-original-commit: 7064c95aa04e5138bb12ae97acfee04ebb67cc0e
Part-of: odoo/odoo#103097
2022-10-17 10:11:09 +02:00
Touati Djamel (otd) 4ef8307d5c [FIX] purchase_requisition: use the requisition currency in the report
Steps to reproduce:
- Connect with a company that uses the dollar as currency
- Go to invoicing → Configuration → accounting → currencies
- Enable euro currency
- Create a new Purchase Agreement:
     - Agreement type: “Blanket Order”
     - Currency: “euro”
     - Add any product:
         - Qty: 1
         - Price: 10
     - save
- Print → Call for tenders

Problem:
The price is displayed in the current company device instead of the
Purchase agreements currency

opw-2991156

closes odoo/odoo#103067

X-original-commit: 8103d501541db07d0b546d5729e66c9a9915a4d1
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-10-11 17:59:35 +02:00
gawa-odoo ba4b71427f [IMP] analytic,*: changes on applicability and make fields visible
Add choices for the business domain on applicability rules, so rules are more precise
Also put 'general' as domain from the view when it's what should have been.
Make analytic field visible since owl migration (for sale and purchase)

closes odoo/odoo#102461

X-original-commit: c5867d5009a7fb448fff1be487b9e9c3e7945d4b
Related: odoo/enterprise#32421
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
2022-10-10 14:04:43 +02:00
Julien Mougenot f34768a555 [FIX] web,*: Unify active actions
`activeActions` is a set of boolean values determining what actions
(i.e. 'create', 'delete', etc.) can be performed on the current view or
subview (x2many).

Before this commit, the x2many fields used a different naming convention
than the one set on the views (e.g. 'canCreate' instead of 'create').
This caused mismatches when subviews would try to rely on the parent
view `activeActions` to define their own. This also introduced a bad
design where the "type" of `activeActions` would be determined by that
same mismatch.

Another issue was that the list renderer did not always check for the
existence of activeFields in its props, despite defining them as
optional.

This commit unifies the names of the active actions accross views and
x2many fields, while adding a "type" property to it s.t. its owner
can determine what context it finds itself in.

closes odoo/odoo#102115

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-10-10 10:53:48 +02:00
clesgow f6ed2835e5 [FIX] purchase_requisition: Adapt for grid
Adapt to the new css grid for groups. Without this, the values in the
`<p>` are squished into a small fraction of their columns.

Part of task-2985735

X-original-commit: 8544fd84916153ffe903a639f3b88b2e83554337
Part-of: odoo/odoo#102495
2022-10-06 19:59:07 +02:00
higo-odoo 16cbbf96b9 [FIX] purchase_requisition,purchase_requisition_stock: Fix Test case
How to reproduce the problem:
- Install the purchase_requistion, purchase_requistion_stock, and any Localization modules such as l10n_be or l10n_in
  (apart from USD currency any localization module)
- error caught only when at the time of module installation but it must have a different currency_id apart from USD

https://watch.screencastify.com/v/1C7GQKHBASyiluGGkFfV

Cause of the problem:
 static values Currency USD cause the problem.
 the following module will be set the currency value
 l10n_be - EUR
 l10n_in - INR
 l10n_br - BRL
 when we installed the following modules then cls.env.user.company_id.currency_id values get changes accordingly

  will lead to this error
  Traceback (most recent call last):
  File /home/odoo/src/odoo/addons/purchase_requisition/tests/common.py, line 70, in setUpClass
    cls.env.user.company_id.currency_id = cls.env.ref(base.USD).id
  File /home/odoo/src/odoo/odoo/fields.py, line 1217, in __set__
    records.write({self.name: write_value})
  File /home/odoo/src/odoo/addons/account/models/company.py, line 301, in write
    raise UserError(_('You cannot change the currency of the company since some journal items already exist'))
  odoo.exceptions.UserError: You cannot change the currency of the company since some journal items already exist
opw-2945581

closes odoo/odoo#98512

Closes: https://github.com/odoo/odoo/pull/98174
X-original-commit: 70b7c57f7ea0a619a149461e0e738ddc25b822f6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-10-05 19:38:45 +02:00
Tiffany Chang (tic) c9ea3fcac6 [IMP] purchase_requsition: convert custom js to OWL
For original specs, see [1].

Some performance changes: the best price/date/unit price fields are now
loaded by JS instead of passed via action context (allows for easier/
consistent reuse of view + now we can refresh without undoing any state
changes due to buttons being pushed).

[1] https://github.com/odoo/odoo/commit/f533e40f0e3f1cd34f1047b70dfdf95837d84501

closes odoo/odoo#101502

X-original-commit: 41ae508c2e6fc3c40b29b1bfc4b5dd7c4440a719
Signed-off-by: Antony Lesuisse <al@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-09-29 12:16:58 +02:00
Martin Trigaux 5150d003fd [I18N] *: export 16.0 source terms
closes odoo/odoo#101053

X-original-commit: 7d4c9d9736cc2ff0ee91dc17ea0f952c9a3dc65a
Related: odoo/enterprise#31752
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-24 15:00:56 +02:00
Martin Trigaux 1a8772769e [I18N] *: export 16.0 source terms
closes odoo/odoo#100573

Related: odoo/enterprise#31507
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-20 13:48:49 +02:00
gawa-odooandHabib 7e3403068f [REF] *: Analytic Apocalypse
The goal of this commit is to get rid of the analytic tags as they were confusing, serving tag purposes as well as distribution on analytic accounts.

Everywhere analytic tags were used as a distribution have been replaced with a new widget that will dispatch distribution on analytic accounts. If there was an analytic account field next to the tags, it has been included in the distribution.

Analytic tags that were used simply as information tags have been removed.

To fill the new widget, there are now 2 kind of rules that will help fill and prefill it.
The first are applicability: previous groups have been removed, and have by replaced by plans. Each account is required to have a plan. These plans define when they are available in the widget: a default applicability per plan and applicability lines that can specify rules following the context of the widget.

The second one are distribution models, that will replace previous default rules but follow the same principles. The accounts (and so the plans) that will be given by the distribution model can override the applicability rules from before.

closes odoo/odoo#98914

Related: odoo/upgrade#3885
Related: odoo/enterprise#30743
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: Habib (ayh) <ayh@odoo.com>
2022-09-20 12:36:01 +02:00
Thibault Delavallée 3cdc217736 [FIX] purchase_requisition: fix usage of message_post_with_view in batch
In order to post on a document, ``message_post_with_view`` should be called
on a singleton recordset. Otherwise it is done as a mass mailing which is
not really what is expected here.

Task-2710804 (Mail: Clean MailThread API)

Part-of: odoo/odoo#100137
2022-09-15 01:23:27 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Denis Ledoux 0501bbd62e [IMP] base: uniform "groups" in back-end view
This revision is to make uniform the behavior of the `groups` attribute
on the Python model fields
and on the node in the view architecture.
In both cases, remove the node from the view completely.

Before this revision,

in a back-end view:
 - In the Python model, if a field has the `groups` attribute set
   and the user is not part of
   the groups, the field is removed, completely, from the view.
 - In the view architecture, if a node has the `groups` attribute set
   and the user is not part of
   the groups, the node is made invisible (not completely removed, just
   made invisible).

in a front-end view:
 - if a node has a "groups" or "t-groups" set and the user
   is not part of the groups, the node is removed from the view.

So it's 2/3 cases removing nodes restricted to a group.
and 1/3 case making invisible nodes restricted to a group.
It's simpler to have a uniform behavior for the 3 cases,
simpler to understandard for developers.

In addition, this will help for the goal to cache back-end views.
It makes possible to convert views using the `groups_id` field
by moving the content of these views directly
in the view to which they add content which is suppose to be completely
removed when the user has not the according group.
By getting rid of the `groups_id` many2many field on `ir.ui.view`,
it makes possible to cache the view architecture without
requiring to use the groups in the cache key.
Currently, if we want to cache the view architecture,
it would be required to use the intersection of the user
groups with the `groups_id` groups of the view,
making it costly to compute the cache key,
therefore altering the performance point to cache the view
architectures.

closes odoo/odoo#95729

Related: odoo/enterprise#29592
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-19 19:10:39 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
MerlinGuillaume 86959e5865 [FIX] purchase_requisition_stock: alternative's RFQ delivery address
When generating an alternative request for quotation from a dropship
purchase, the delivery address is not copied

Steps to reproduce:
1. Install Sales and stock_dropshipping module
2. Go to Settings > General Settings > Users > Manage Users, open user
Mitchell Admin and in the Access Rights tab enable 'Manage Multiple
Stock Locations'
3. Go to Settings > Sales > Quotations & Orders and enable Customer
Addresses
4. Go to Settings > Purchase > Orders and enable Purchase Agreements
5. Go to Sales > Products > Products and edit a product (e.g. 'Acoustic
Bloc Screens')
- In the Inventory tab enable routes 'Buy' and 'Dropship'
6. Create a Sale Order for this product with a different Delivery
Address then the Customer and confirm it
7. Go to the purchase order
8. In the Alternatives tab create an alternative
9. The Dropship Address is not repercuted on the new RFQ

Solution:
Add a method `_get_alternative_values` which sets the dest_address_id
and is extended in `purchase_requisition_stock` to add the
picking_type_id

opw-2880042

closes odoo/odoo#94109

X-original-commit: a7ef5d93650c262497d3a02b934284829cfc5021
Signed-off-by: Adrien Widart <awt@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-06-29 12:19:15 +02:00
Tiffany Chang (tic) f533e40f0e [IMP] purchase_requisition{_stock}: add new alternative POs option
Previously the "call to tender" flow involved creating a
`purchase.requisition` record, creating each RFQ via that record, and
then manually going through each RFQ to compare the prices/dates/etc.
By linking the "call to tender" POs within the POs, we remove an
unnecessary `purchase.requestion` record and makes it easier to track
which RFQs are related to each other as an Alternative RFQ.

On top of this, we add some comparision features to make it easier to
determine the best RFQ, specificially the ability to compare PO lines in
the same view with some visual aids (best price/date colored green +
buttons to check these lines to make them easier to view). We also add
an extra feature to set the qty of selected/non-chosen PO lines to 0 to
aid in the RFQ selection process (only applies to non-confirmed/done/
cancelled POs).

Some other features included with this:
- option to cancel alternative POs when confirming one, which purposely
  does not cancel ones that have already been confirmed/completed.
- new wizard for creating alternative POs so user can select whether or
  not they want to copy the products/qtys from the original PO.

Important Notes:
- JS Customizations:
  - custom many2many widget added so user:
    - can click between alternative POs in same window + keep breadcrumb.
      This is because all alt POs are interconnected and long breadcrumb
      chain is possible (+ we want to avoid windows within windows.) It
      is expected that user will be aware that unsaved changes will
      auto-save when alt PO is clicked on.
    - cannot unlink a PO from itself (this is automagically done during
      the write) since this will remove all of its linked POs and might
      confuse users.
  - custom view js for Comparing Order Lines to help highlight best
    options, including ensuring that the best options are still
    highlighted after clicking on Choose/Clear buttons (since the best
    option can change afterwards, we recalc + update via RPC)
- General implementation warnings:
  - Anytime any button/alternative PO is clicked on within a PO, the
    form will auto-save. This is due to how the current action service
    handles changing views.
  - POs created via "Create Alternative" button purposely:
     - require a vendor to ensure correct lead times/prices
     - show all vendor/product warnings in wizard because we cannot
       reproduce the pop-up warning that would occur in the PO when
       they are selected. We also purposely block the PO creation when a
       blocking warning is set since we cannot remove the values
       (especially in the case of a blocking vendor message) from a
       newly created PO.
  - Technical purchase.order.group model created to help with difficult
    management of complicated behaviors:
     - unlink from self if a PO is no longer linked to any other POs
     - linkages must be symmetric (i.e. linkage PO1 => PO2 must
       reflect PO2 => PO1 in their form views)
     - don't lose existing linkages (i.e. PO1 => PO2 and PO2 => PO3
       should auto-link PO1 => PO3)
    These last two behaviors are difficult to do without grouping due to
    possibility of remove and adding linkages at the same time. To avoid
    complex code to ensure these complexities hold when when creating a
    new PO, linkaging to alternatives is not allowed when PO is not yet
    saved as a record.

Task: 2695116
Upgrade PR: odoo/upgrade#3586

closes odoo/odoo#87656

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-06-20 12:15:59 +02:00
Tiffany Chang (tic) 863c5090f0 [REF] purchase{_various}: make onchange_quantity computed
Instead of having to repeatedly manually call `onchange_quantity` at
different points in the code, it is better to have it be computed
instead.
- Logic is left unchanged,
- onchange calls from other methods are removed, and
- tests are adjusted to properly handle compute. I.e. remove
'date_planned': datetime.today().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
  from when PO lines are created since this sometimes resulted in
  inconsistent date_planned values for PO line and the PO date_order
  (by 1 sec), which could lead to inconsistently created 'date_deadline'
  values for stock_moves' created by PO line qty changes. Issue
  previously didn't exist because onchange was not always called.

Part of Task: 2695116 (to avoid adding more onchange calls for new
feature)

Part-of: odoo/odoo#87656
2022-06-20 12:15:59 +02:00
Tiffany Chang (tic) 00689e7fc6 [REM] purchase_requisition{_stock}: rem old call to tender pt2
This commit removes the call for tender feature via a
purchase.requisition. This feature is to be replaced with the ability to
directly compare prices/options of POs/RFQs within a PO to remove extra
steps to compare them. The linkage between POs previously provided by a
purchase.requistion is replaced by the POs being directly linked to each
other. Feature to auto-create call to tenders via a product option is
removed and the user is expected to know/be responsible for when they
should do a call to tender themselves.

All references to old Call to Tenders replaced with Blanket Order, and
we remove/rename the menu items since Blanket Order is now the only
purchase.requisition.type option (we expect minimal customizated types).
Follow-on refactoring to switch purchase.requisition to
purchase.blanket.order to come later. Follow-on refactoring to switch
purchase.requisition to purchase.blanket.order to come later.

Part of Task: 2695116
Upgrade PR: odoo/upgrade#3586

Part-of: odoo/odoo#87656
2022-06-20 12:15:58 +02:00
Martin Trigaux 5acb6db891 [I18N] *: export saas-15.4 source terms
closes odoo/odoo#93246

X-original-commit: 5ff6d185f70650c26c28a6aef7dd37c859ab58d2
Related: odoo/enterprise#28218
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-06-10 07:27:26 +02:00