Analytic Accounts can be defined in the MO and can be changed in any MO stage. So the analytic account line will also have to be updated to be linked to the new AA
opw-2674347
closesodoo/odoo#79955
X-original-commit: 65a18382c1712968148898998e3778b77f199dea
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Suppose an automated AVCO product category. When confirming an invoice,
if the associated product was a kit and if its BoM has changed during
the process, a traceback can occur.
To reproduce the issue:
(Need sale_management)
1. Create a product category PC:
- Costing Method: AVCO
- Inventory Valuation: Automated
2. Create 3 products P1, P2, P3:
- Product Type: Storable
- Category: PC
3. Update P3's quantity > 0
4. Create two bills of materials:
- BOM01:
- Product: P1
- BoM Type: Kit
- Components: 1 x P2
- BOM02:
- Product: P2
- BoM Type: Kit
- Components: 1 x P3
5. Create a sale order SO with 1 x P1
6. Confirm SO and process the delivery
7. Edit BOM02:
- BoM Type: Manufacture
8. On SO, create the invoice INV
9. Confirm INV
Error: an Odoo Server Error is displayed with a traceback: "[...] in
_compute_average_price, bom_line_data = bom_lines[bom_line] [...]
KeyError: mrp.bom.line(19,)"
On step 7, when changing the BoM type, a new BoM line is created.
Therefore, in `_compute_average_price`, the BoM associated to the move
(i.e., `bom_line`) is not one of the lines in `bom_lines` (i.e., the new
BoM lines). There is already a check in case the line has been deleted,
but not if it has been changed.
OPW-2610685
closesodoo/odoo#78917closesodoo/odoo#79293
X-original-commit: 3ae0b781bcb5c2840f848bc63b9f3f9e1b2812cb
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
In a lot of test class, we use `setUp` instead of
`setUpClass`. `setUp` is execute for each test method and `setUpClass`
will be execute only once by Class (and use savepoint + rollback).
Then change setUp into setUpClass reduce the time to make all tests
and avoid to repeat this error for the future.
closesodoo/odoo#78082
Related: odoo/enterprise#21563
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Steps to reproduce the bug:
- Create a Product A with Costing Method = FIFO
- Create a Product B with Costing Method = FIFO and cost of 10
- Create a BOM of product A > type = Kit
- Add product B in bom line, with qty = 1 and UoM = dozen
- Add product A in `sale.order`
- Confirm order
Problem:
The cost is 10 rather than 120 (10 * 12 = 120)
Solution:
The kit cost must be the total cost of the components multiplied by their unit of measure
opw-2631487
closesodoo/odoo#78086
X-original-commit: 6c48262c8656821aa51669bd77cdf0f35634512f
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
Co-authored-by: fmdl <florent.mirieu@gmail.com>
If a MO created from a MTO doesn't have a BOM with a analytic account
already assigned to it, then propagate the SO analytic account (if it
has one) to the MO.
closesodoo/odoo#77897
Task: 2648460
X-original-commit: 061037fb79f007389408136fd3ed13e5de970908
Related: odoo/enterprise#21477
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
- update MO list status colors: draft = blue, in progress = yellow +
make the WO status colors match (waiting = blue, in progress = yellow)
and make draft MO lines all blue (to follow current design standard)
- cleanup Activity in tree view (no label in tree + "Next Activity" in
column selection dropdown)
- make units of analytic accounting for WO = hours
- make quantity for move_raw_ids products (i.e. components for MOs)
always have positive analytic_account_line.unit_amount (i.e. when
changing a done move's quantity + changing a quantity twice made this
value negative)
- make "Copy Operations" on BOM open the list view in "current" instead
of "new" due to lack of hook to prevent form view (i.e. open BoM in
current view) changing when clicking on lines in the new window's
operations (also ends up being a better UX anyways since being able to
view the operations form view is desired).
Task: 2648460
X-original-commit: 65a2d478197f5b856212225319500ca61b161809
Part-of: odoo/odoo#77897
Issue: With margin enabled and avco for stock valuation, after
confirming a SO with a product variant which is a bom kit,
when we try to change the variant, there is a traceback
Steps to reproduce :
1) Install Stock, Accounting, MRP, Sale,
2) Enable Margins in settings
3) Configure a Product Category with costing method AVCO
4) Configure a Product with 2 variants and that product category
5) [Important: KIT] Create 2 BoM, one for each variant and set those
BoM to KIT
6) Create a SO for that product and one variant
7) Confirm the SO, cancel it, and set to quotation
8) Edit the SO and change the variant, save
-> Traceback
Side-Note:
This issue is due to the fact that we iterate over the stock_moves to
find the quantity of the BoM, but that stock_move correspond to
confirming at step 7, when we change the variant at step 8, the stock
move has not changed, so still contains the previous bom_line_id with
the quantity, but this doesn't reflect with the new state of the SO
which is for a different variant.
For me since the stock move is canceled, it should be taken into
consideration when computing the average price but I might be wrong,
it's up to the reviewer to decide if it makes sense
opw-2639093
closesodoo/odoo#77606
X-original-commit: c0d4ed5ac641d339a6cd4e23db9667048d35360d
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
When the name of a production order changes, we should update the name
and the reference of the analytic accounting lines of its work orders.
Task-2638896
closesodoo/odoo#76090
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Both mo_analytic_account_line_id and wc_analytic_account_line_id are
copied when duplicate the workorder. This is not correct.
Task-2638896
Part-of: odoo/odoo#76090
- 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
Add analytic accounting for MO.
Post expense entries for:
1. raw material cost (change with consumed)
2. work center cost (change with real duration on work order)
Task-2469742
PR #68708
Clean up of some demo data that was referring to old demo data
names/prices. Also add extra demo data so we can have some
stock.valuation.layer values and some data points for enterprise
level reports.
Part 3.3 of task: 2440068
ENT PR: odoo/enterprise#20169closesodoo/odoo#74951
Related: odoo/upgrade#2727
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
For improved cost analysis, byproducts can now have a "cost share" (out
of 100%) indicated. This cost share will by multiplied by the total BoM
cost (i.e. components + operations costs) and reflected in the stock
valuation. The final product will also have the byproducts cost
subtracted from its final stock valuation. This is of course only
applies when costing methods are appropriate (i.e. non-standard price).
Additionally, we can now "Compute Price from BoM" for byproducts (via
its product form) and the BoMs that it is a byproduct of are now counted
towards its # BoMs smart button (we will now also see these BoMs when
clicking on the smart button). Of course when there is no cost share for
byproducts then clicking on "Compute Price for BoM" will not change the
a byproduct's cost and if there are multiple BoMs the prodcut is a
byproduct of, the calculation will only be based on the first BoM it
finds (i.e. same as current logic for manufactured products).
BoM Cost report has been updated to include byproducts with cost shares
(byproducts with cost share = 0 will not show up in report).
Additionally we update the report to display operations only costs now
that BoMs are allowed to have no components in them.
Part 1 of Task: 2440068
Upgrade PR: odoo/upgrade#2727
Related ENT PR: odoo/enterprise#20169
Part-of: odoo/odoo#74951
Hide useless measures:
- "Backorder Sequence"
- "Extra Cost"
- "Quantity to Produce" (same as "Total Quantity", but not standardized
to product's UoM)
Renames confusingly named measures:
- "Quantity Producing" => "Quantity Produced" (i.e. amount actually
produced)
- "Total Quantity" => "Product Quantity" (i.e. amount scheduled to be
produced in product's UoM)
Part 3.1 of task: 2440068
Related ENT PR: odoo/enterprise#20169
Part-of: odoo/odoo#74951
On BoM, a component line can be filter out depending
of the product variant to manufacture
(with "Apply on Variant" field).
Extend this feature to operation and byproduct line.
task-2614126
closesodoo/odoo#74973
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
No need to keep it, it's useless and can confuse translators
closesodoo/odoo#74782closesodoo/odoo#74832
X-original-commit: 40c74e686f23c10e35000be583716d0c093ce3b3
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
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.
closesodoo/odoo#74245
Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
- Enable Margin analysis
- Have a product [TEST] in a category with
- FIFO and Automated Valuation.
- Kit BOM with 3 items (A,B,C)
- Create a SO with [TEST] and confirm.
- Modify the BOM and remove C from the kit.
- Back to the SO, cancel it.
Traceback will show, because there no more a bom_line associated with
the move
opw-2541674
closesodoo/odoo#72696
X-original-commit: 27821b728f409d7e1a69e84d0beb5ac708e6420e
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
The company is not mandatory on the analytic account, and the currency on it
is a related field to the currency of that company, if set. In case it is not
set, we should add a default fallback on the currency of the company of the
manufacturing order.
closesodoo/odoo#72482
X-original-commit: 4fc2ec31861d4602357f130066ec3507b96d8dc8
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
- Activate anglo saxon accounting
- Have a [DEMO] KIT product in a category using automated
Inventory Valuation with costing method AVCO
- The KIT is composed by C1 and C2 in the same product category
- Define a cost on both C1 and C2
- Open a POS session, order [DEMO], Invoice and complete the order
- Close Session, Validate and display Journal Items
COGS entries will be missing.
This does not occur when making the order without invoicing
opw-2481518
opw-2545758
closesodoo/odoo#72460
X-original-commit: 659b455aca7a2c7f0cb41bfd6312bca25917d8a9
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Previous fix f056254d1c5153467b10d9581214ff6d1348be76 didn't take the
situation when production location has its own valuation accounts into
consideration. Fix it in this commit.
opw-2476417
closesodoo/odoo#71064
X-original-commit: 60e83f03b871605b7aa281503269f66ac3ea940b
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Yuchen Huang <yhu-odoo@users.noreply.github.com>
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.
closesodoo/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>
This commit removes stock.inventory(.line) and moves its general
functionality into stock.quant. Some features are lost during this
switch as well.
Feature Additions:
- New single list view for inventory adjustments (no more multiple
inventory adjustment records to keep track of!)
- Improved cyclic counts (annual inventory day setting) + next inventory
dates are immediately viewable in view (vs auto-generated inventories
based only on location)
- Specific quants (i.e. counts) can be assigned to users for more
flexibility (vs only able to restrict by location + product
combinations)
- Counts can be requested (i.e. bulk assigned to user/for a specific
inventory date)
Feature Removals:
- Can no longer look at previous inventory adjustments linked to a
specific record. Each quant has a history button to show inventory
related moves. [relevant account moves are also now harder to see via
stock as well]
Other changes:
- Bulk of changes were for demo/test
- Some changes were done to ensure "Update Quantity"/"Inventory Report"
views still mainly function the same as before with the exception of a
new column added to support updating quant quantities in these views.
Task: 2440026
ENT PR: odoo/enterprise#17329
Upgrade PR: odoo/upgrade#2326closesodoo/odoo#68409
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Some usage of `_bom_find` are performance bottleneck (one request by
product). By example, when the mrp is installed, search products
with fields compute by `_compute_quantities` (e.g. 'Negative forecasted
quantity'). it is due to the override of `_compute_quantities`
in mrp which will make (in the worst case) a `_bom_find` for each
product in the DB.
To avoid this situation the `_bom_find` method become batched
which can handle several products in once. The signature of the method
has changed and uniformize in all module.
Example performance Gain:
------------------------
In a DB with 7000 products (type 'product'), 500 locations, 1800 BoM,
9000 Stock moves, etc. Search in the tree view with filter "Negative
forecasted quantity":
Before: 10879 (nb SQL request) 12.67 +- 0.11 sec (Total RPC Time)
After: 159 (nb SQL request) 1.82 +- 0.03 sec (Total RPC Time)
task-2439019
Usecase to reproduce
- Create a KIT with COMP A (15$) COMP B (25$)
- Enable Margin on SO
- Set the cost on the KIT with compute cost button (40$)
- Create a quotation with the KIT (cost is correct 40$)
- Confirm the quotation -> Cost is updated to 15$ (first component)
It happens because the function to compute the average price doesn't
expect a kit and compute everything from the valuation layer of first
component
opw-2413246
closesodoo/odoo#65301
X-original-commit: 827f65f70634ba7a2e4175f20e5301e514ada0a0
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Currently when unbuild a MO, we create journal entries the same as
receiving components (add credit to input account) and deliver
finished product (add debit to output account). But since the
unbuild is just a revesal of the MO, the journal entries should
alse be revesals.
In this commit, when unbuild a MO, for the journal entry about the
component change, we add credit to the output account, and for the
journal entry of the finished product change, we add debit to input
account make sure the journal entries are also reversals.
Task 2312828
PR #58150closesodoo/odoo#60730
X-original-commit: 83a3230706e1e2f4eaf9718156647821341d192b
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This doesn't make sense anymore: when we record production on a WO, in
any cases everything is processed as we make backorders.
Part of: https://github.com/odoo/odoo/pull/54283
task-2278147
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.
Add sudo for other operations on ir.actions.*
Removed abstract workorder
Removed the integration of expiry wizard in tablet view since it should
be moved in enterprise in the tablet view implementation (not possible
to set consumed lot on workorders on community anymore)
Refactor _set_quantity_done to use ORM command in order to not return a
dict with vals to_create/to_write
task-2241471
Now, by default, a Bill of Material have a flexible
consumption instead of strict consumption. Also
add new consumption choice: a flexible consumption
but with a warning when the bom isn't respected.
Also, now, the strict (a new warning option) consumption
is checked only when we try to mark as done the MO.
task-2241471
Allow to "backorder" a production, meaning create another manufacturing
order with the quantity remaining to produce. We also use the
reservation of the first order on the next ones by using
`post_inventory` on the first one and moving the newly created stock
moves to the backorder.
We introduce a wizard similar to the one in stock.
Backorders have a sub-sequence.
Backorders are linked together through the procurement group.
We allow creating a backorder even if workorders are running by closing
them, the backorder will call `button_plan` and create its own.
task-2241471
Set the operations directly on the Bill of Material.
Duplicate the demo data where a routing was shared.
Adapt the tests.
Remove the following feature:
- set the same routing on parent and kit child bom
- when planning, if the component of the kit have the same operation
than a component of the parent bom, merge these operations
task-2241471
- Rename "Master Data" menu into "Products" in both stock and mrp.
And move not producte reclated menu to configuration menu.
- In the stock setting move all shipping connector in a dedicated
section.
- Improve helper of MO
- Merge filter "Late" and Planning Issue
- Remove badge of duration field in WO.
task-2196687
In case of MTO (+buy) on products used in a MO,
add the link between the MO source and the PO generated.
Also add links between MO's when MTO+manufacturing.
task-1913392
closesodoo/odoo#43366
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Task 2092079
Accounting firms that want to give access to their customers avoiding
mistakes and risks will love this profile that can't do anything
wrong... Maybe as well as companies auditors..?
closesodoo/odoo#39860
Related: odoo/enterprise#6576
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
missing bit from rev[0] and [1]
[0] 7ef11e3
[1] d6c8c34ef6539dad110f1e502eaee2c03d968797
closesodoo/odoo#42621
X-original-commit: 5096e724643ca77568ce2f09a40b138561f4c20f
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Without demo data, for the odoo-master transifex project
closesodoo/odoo#41935
X-original-commit: dab7670b73506fb3a835695ee3bd735e0c5e5c2b
Related: odoo/enterprise#7287
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
The inventory button was shown or hide depending of the product valuation.
As the valuation was previously stored on the stock moves and posting
split the stock moves. Fifo and Avco valuation was not well computed.
The migration to stock valuation layer fixed this behavior. This
commit shows the post inventory button as soon as there are some
finished move to be posted.
task : 54665
closesodoo/odoo#41781
X-original-commit: 5dfa3f817d3a9f47a863a587569a862a40c7d159
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
The valuation stat button was shown only at validation of the manufacturing
order. If an intermediary inventory is posted. A part of the stock moves
are validated so some stock valuation layer are generated.
This commit shows the valuation button as soon as some valuation layers
are linked to those validated stock moves.
Task : 54665
X-original-commit: 7f67af93299c449ba80489a84ed0b13930edff90