Commit Graph
24 Commits
Author SHA1 Message Date
yhu-odoo 77a8616263 [FIX] mrp_subcontracting_account: subcontract cost don't match the price
When doing subcontracting with standard price product. If
Final procut cost != Components cost + subcontracting cost
When posting account entries for final product, the amount of componets
entry is adjusted for the difference of the two costs.
After this commit, we will post components cost according to it's price
so that it can match the value change of the stock. We adjust the amount
on subcontracting cost for the cost difference.
NOTE: the remaining of subcontracting cost will be post in price
difference account when create vendor bill.

Task-3223451

X-original-commit: 514f5b51ad30cce0048abb4cf343e830f0288b36
Part-of: odoo/odoo#132282
2023-08-19 11:00:59 +02:00
yhu-odoo be911c2c58 [FIX] mrp_subcontracting_account: wrong account subcontracting
When we do subcontracting, components and final products are sent to/
received from production location. The account entries are also post
using the accounting setting on production location like normal
manufacturing which is not correct.
To fix, we use account setting on product categories instead of
production location for subcontracting.

Task-3223451

X-original-commit: 017209068f308e87870e2b352afbdf6febc41da0
Part-of: odoo/odoo#132282
2023-08-19 11:00:57 +02:00
Touati Djamel (otd) fe508b0548 [FIX] mrp_subcontracting: compute bom price into company currency
Steps to reproduce the bug:
- Enable “subcontracting” in the mrp settings
- Create a storable product “P1”:
    - Add a vendor:
    - supplier: “Azure interior”
    - currency: euro
    - price: 20
    - Add a BoM:
        - Type: subcontracting
        - add any product as component
        - Save
- Check that the currency of the company is in dollars
- Click on Compute Price from BoM button in the product form

Problem:
The seller's price is not converted into dollars

opw-3321346

closes odoo/odoo#121327

X-original-commit: f60fac0afa9b87baa68328c5755a7fe84494cb10
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-05-17 14:47:15 +02:00
William Henrotin 5e5d92ef79 [IMP] stock: picking flow reworked
This commit changes the process flow of stock pickings. A new picking will
always be created in immediate transfer mode and 'ready' state. From
their, it can be validated directly or 'reset to draft'. This second action
switch the immediate mode to planned mode and reset the state as draft.
From their the classical workflow is processed
confirm -> (assigned ->) validated

Task: 3256447
Part-of: odoo/odoo#117513
2023-05-17 13:37:47 +02:00
yhu-odoo 1eb2e7c814 [IMP] {,mrp_,stock_}account, *: add default stock accounts and production cost
account

1. We introduced a new Production Cost account that can be set on
locations with Production type. When products move into/out of a
production location. The account entry will be post on this account
instead of previous Stock in/out account.

2. On the accounting setting page, we can now set the default values for
all stock accounts. Users can also disable automatically accounting for
stock there.

Task-3046333

closes odoo/odoo#113973

Related: odoo/enterprise#37653
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-05-10 15:19:32 +02:00
yhu-odoo f7a681abff [IMP] mrp_subcontracting{, _dropshipping}: split subcontracting account move
Considering a subcontracting use case where:
 component cost = 50
 service cost = 100

we post:
|account,              |debit,         |credit
-----------------------------------------------
Receipt Component from vendor
|Stock Valuation       |50             |
|Stock Input           |               |50
-----------------------------------------------
Invoice Component from vendor
|Stock Input           |50             |
|Payable               |               |50
-----------------------------------------------
Resupply Component to subcontractor
|Stock Valuation       |               |50
|Stock Output          |50             |
----------------------------------------------
Receive Final from subcontractor
|Stock Valuation       |150            |
|Stock Input           |               |150
----------------------------------------------
Invoice Final from subcontractor
|Stock Input           |100            |
|Payable               |               |100
-----------------------------------------------
Deliver Final to client
|Stock Valuation       |               |150
|Stock Output          |150            |
-----------------------------------------------
Invoice Client
|Stock Output          |               |150
|Receivable            |150            |

Stock Input/Output account are not balanced.
In this commit, we split the credit value when received final from
subcontractor to make them balanced.

|account,              |debit,         |credit
-----------------------------------------------
Receipt Component from vendor
|Stock Valuation       |50             |
|Stock Input           |               |50
-----------------------------------------------
Invoice Component from vendor
|Stock Input           |50             |
|Payable               |               |50
-----------------------------------------------
Resupply Component to subcontractor
|Stock Valuation       |               |50
|Stock Output          |50             |
----------------------------------------------
Receive Final from subcontractor
|Stock Valuation       |150            |
|Stock Input           |               |100
|Stock Output          |               |50
----------------------------------------------
Invoice Final from subcontractor
|Stock Input           |100            |
|Payable               |               |100
-----------------------------------------------
Deliver Final to client
|Stock Valuation       |               |150
|Stock Output          |150            |
-----------------------------------------------
Invoice Client
|Stock Output          |               |150
|Receivable            |150            |
---

closes odoo/odoo#113853

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-03-03 17:05:07 +01:00
yhu-odoo ba4e24b932 [FIX] mrp_account: missing employee cost when calculate bom cost
Adapt community to make it possible to add employee cost when calculate
bom cost.

closes odoo/odoo#105645

X-original-commit: a239802249b2af2cc3fc2b3bb9fdfd0a408d887a
Related: odoo/enterprise#33898
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2022-11-14 13:01:57 +01: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
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
Nicolas Pierre 99b56ec706 [IMP] mrp_subcontracting: subcontracting portal
Creation of a subcontracting portal to let the subcontractor register himself
all the components that were used for the production. The portal is
reusing the backend view of the stock picking where components were
registered before.

closes odoo/odoo#83465

Task: 2645298
Community-pr:  https://github.com/odoo/odoo/pull/83465
Enterprise-pr: https://github.com/odoo/enterprise/pull/24647
Related: odoo/upgrade#3402
Related: odoo/enterprise#24647
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-04-11 11:01:50 +02:00
William HenrotinandAdrien Widart 7ef48801bb [FIX] mrp_subcontracting_account: read price unit at validation
In a subcontracting flow, the extra_cost on the subcontracted production
is read on the purchase line (via _get_price_unit() ) at the production
creation. In case the price unit on this purchase line change before the
validation, the stock valuation layer linked to the production will not
take this new value into account.

This commit ensures the price unit is the right one at validation

Note: the first version of the current fix broke a use case. The test
`test_tracked_compo_and_backorder` has been added to protect that use
case.

closes odoo/odoo#87817

X-original-commit: 1ff1b4a9a2b9ab27b29fdcac93731fa053c77cc7
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
Co-authored-by: William Henrotin (whe) <whe@odoo.com>
Co-authored-by: Adrien Widart <awt@odoo.com>
2022-04-08 10:37:56 +02:00
William Henrotin db8f9967c5 [FIX] mrp_{subcontracting_}account: read price unit at validation
In a subcontracting flow, the extra_cost on the subcontracted production
is read on the purchase line (via _get_price_unit() ) at the production
creation. In case the price unit on this purchase line change before the
validation, the stock valuation layer linked to the production will not
take this new value into account.

This commit ensures the price unit is the right one at validation

closes odoo/odoo#87726

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-04-05 12:23:50 +02:00
William Henrotin 6a23b9bcd6 [REF] *stock*: rename model stock.production.lot into stock.lot
Task: 2648449
Part-of: odoo/odoo#80434
2021-12-07 16:20:05 +00:00
Adrien Widart dc54341dc0 [FIX] mrp_subcontracting_account: always return PU of subcontracted SM
When using AVCO and subcontracting without any additional cost, the
valuation of the finished product is incorrect

To reproduce the issue:
1. Create a Product Category PC:
    - Costing Method: AVCO
2. Create two products P_compo and P_finished:
    - Both:
        - Type: Storable
        - Category: PC
    - P_compo:
        - Cost: 10
        - Routes: Resupply Subcontractor
3. Update P_compo's quantity: 2
4. Create a Bill of Materials BO:
    - Product: P_finished
    - Type: Subcontracting
    - Subcontractor: a partner P
    - Component: 1 x P_compo
5. In Inventory, create a planned Receipt R:
    - From: P
    - Operations: 1 x P_finished
6. Mark R as To Do
7. Process the delivery of P_compo
8. Validate R
9. Repeat steps 5-8
10. Open the Inventory Valuation

Error: There are two valuation lines for P_finished: one line has a
value of $10, which is correct (this is the cost of the component).
However, the value of the second line is $20, it should be $10 too.

Here are a part of the values used to generate the related MO:
https://github.com/odoo/odoo/blob/2d12fb8fb94c0f2acade7222cfedbec34114a8e9/addons/mrp_subcontracting_account/models/stock_picking.py#L21-L25
In the above case, an extra cost is defined on the MO and is based on
the unit price of the subcontracted SM. However, `_get_price_unit` will
return an incorrect value:
https://github.com/odoo/odoo/blob/251be6b943ea8c3f274bb0863d0af3f7c6b8d10d/addons/stock_account/models/stock_move.py#L39
After step 8, the standard price of P_finished is $10. Also, in the
above case, there isn't any subcontracting cost, so there isn't any unit
price defined on the SM. Therefore, `_get_price_unit` returns the
standard price of P_finished ($10). As a result, when computing the
value of the finished stock move:
https://github.com/odoo/odoo/blob/4fc2ec31861d4602357f130066ec3507b96d8dc8/addons/mrp_account/models/mrp_production.py#L39-L42
It uses the extra cost of the MO + the component cost. This explains
where the $20 come from.

OPW-2641339

closes odoo/odoo#80889

X-original-commit: 0567536f8b66c71f6860041926542f88026793b1
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2021-12-06 10:34:45 +00:00
William Henrotin 3a1473c75c [REF] *stock*: rename move_lines into move_ids in stock.picking
closes odoo/odoo#78732

Task: 2673000
Related: odoo/enterprise#21815
Related: odoo/upgrade#2956
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-10-27 15:48:51 +00:00
William Henrotin f3fe2d50d9 [REF] *: rename name into partner_id on supplierinfo
Task: 2673000
Part-of: odoo/odoo#78732
2021-10-27 15:48:51 +00:00
Rémy Voet (ryv) ff4d25a427 [IMP] mrp_subcontracting: allow flexible consumption
Take in account the bom consumption of subcontracting BoM:
- In flexible and warning we can now record extra component
(even if there isn't tracked component).
- In the warning case, we get a warning issue in during the recording
of component if we consume more than expected
- In case of script consumption, we cannot record component expected
if some are tracked. In this case we can consume more than expected
only if the user is a mrp manager.

Also fix "Set quantities" Button for the subcontracting

task-2486811

closes odoo/odoo#75041

Related: odoo/enterprise#20350
Related: odoo/upgrade#2750
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-09-03 10:37:48 +00:00
Rémy Voet (ryv) 6aa8b7dd67 [IMP] mrp_subcontracting: improve mrp bom report
- The "BoM Structure & Cost" takes now in account
the subcontracting cost.
The subcontracting cost depends of the best supplier info in product
and subcontractor register in the BoM.
- Also add this subcontracting cost (to the cost field) when we click on
"Compute Price from BoM" in the product view.

task-2486811

Part-of: odoo/odoo#75041
2021-09-03 10:37:46 +00:00
Xavier-Do 288595f558 [FIX] *: add explicit license to all manifest
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.

closes odoo/odoo#74245

Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-07-26 13:09:57 +00:00
William Henrotin 67e575e6fd [FIX] mrp_account: copy extra_cost to backorder
In a subcontracting flow, a production order is created to reflect the
subcontractor work. An extra cost is set on this production order
corresponding to the purchase order line price unit. If the
subcontracting product is tracked, we may create some backorder to save
all the lot/serial numbers. As the extra_cost is not copied, the first
lot/serial number will have the corresponding stock valuation layer with
the correct quantity. The following ones will only have the cost of the
components as value.

closes odoo/odoo#69245

Opw: 2487450
X-original-commit: 262c2ba8773c698ccde499b095794ab0fc780699
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-04-14 15:05:37 +00:00
fw-bot 4bc3c9303a [FIX] mrp_subcontracting_account: update inventory valuation
This reverts commit cfd68df.
The fix was to not value the subcontracting location while it has to be
valued.

closes odoo/odoo#68499

X-original-commit: b1ba8b48f69919d18b946e4f602b9a136e835d51
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-03-29 18:09:59 +00:00
Adrien Widart b986b116da [FIX] mrp_subcontracting_account: update inventory valuation
When buying a subcontracted product, if the inventory valuation of the
product category is automated, the product delivery does not create a
new journal entry, i.e. the automated inventory valuation is not done.

To reproduce the error:
(Need account_accountant,purchase)
1. In Settings, enable "Subcontracting"
2. Create a product category PC
    - Parent: All
    - Inventory Valuation: Automated
3. Create a product P
    - Must be storable
    - In category PC
    - Set a positive cost
4. Add a BoM to P
    - Type: Subcontracting
5. Create a RfQ
    - Vendor: BoM's subcontractor
    - Product: P
6. Confirm & Receive Products
7. Go to Accounting > Accounting > Miscellaneous > Journal Entries

Error: There isn't any journal entry about the new product. This is an
error because the inventory valuation for this product is automated, so
there should be a line with the P-product and the cost set on step 3.

When validating the delivery, the server checks the stock move lines
considered as incoming:
https://github.com/odoo/odoo/blob/5098cb25accce91347760cbd2f6427c07265fa00/addons/stock_account/models/stock_move.py#L61-L65
Problem is that `_should_be_valued` for subcontractor's location returns
`True`, therefore the stock move line will not be added.
=> The `mrp_subcontracting` module needs to add a condition:
A location can be valued if it is not subcontractor's location.

OPW-2446298

closes odoo/odoo#66004

X-original-commit: beb7159980f7ed29323d99fd4b72de3fa187f455
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-02-11 16:31:01 +00:00
Arnaud Baes 0c6488a95a [REF] stock: Set action_done on pickings private
`action_done`on pickings should be a private method,
and called only trough the picking validation process.

task-1938108

closes odoo/odoo#39174

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-10-23 07:43:01 +00:00
Arnold Moyaux 5d809fd6b4 [MOV] purchase_mrp_subcontracting -> mrp_subcontracting_account 2019-08-19 15:03:59 +00:00