100 Commits
Author SHA1 Message Date
yhu-odoo e2f54d904c [FIX] mrp: wrong manual consumption value in onchange
When `manual_consumption` field on sm is used in any onchange function,
the value will always be computed for the `new_id` record instead of
using the original value stored in database. This results in a different
value in some cases. In this commit, we chech if the compute function is
called from an onchange funtion or not, if so, we use the original value
instead of recomputation.

closes odoo/odoo#140753

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-07 17:57:16 +00:00
yhu-odoo 9028b76e90 [FIX] mrp: set qty not working for manual consumption
When a component is in manual consumption and without picked checked,
set qty button on the warning wizard doesn't work for it. This is
because we didn't set the move picked = True when click set qty button.
Fix it by set the value.

Part-of: odoo/odoo#140753
2023-11-07 17:57:16 +00:00
yhu-odoo 71f77ba67c [FIX] mrp: wrong consumption warning lines
To reproduce:
1. Create an MO of Product with BOM
2. Manually set qty for a component
3. Produce all

Issue:
Two consumtion warning lines are shown, and numbers are wrong

Part-of: odoo/odoo#140753
2023-11-07 17:57:16 +00:00
yhu-odoo 461d311b73 [IMP] mrp: add pre-production rules' delays in _get_lead_days
If there are pre-production rules, their delays should also be added to
the total delay of a manufacture route.

Task-3081481

closes odoo/odoo#137810

Related: odoo/enterprise#48516
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-11-06 13:58:37 +00:00
yhu-odoo 78e44dc5a3 [IMP] mrp{,_subcontracting_purchase}, {purchase_,}stock: add DTPMO to lead days
For subcontracting, we need to consider both vendor lead time and
manufacturing lead time, and DTPMO (Days To Prepare MO) on the BOM.
Subcontracting delay =
    max(Vendor lead time, Manufacturing lead time + DTPMO) + Days to Purchase + Purchase security lead time

Same thing applied to Bom overview, except:
1. Availability state will be computed based on the delay time of it's
   components. DTPMO on the bom won't be take into account.
2. Lead time will use the DTPMO on the BOM. DTPMO will be added to
   the lead time when it's a manufacturing bom or when it's a
   subcontracting bom with Manufacturing Lead Time + DTPMO > Vendor Lead Time

Task-3081481

Part-of: odoo/odoo#137810
2023-11-06 13:58:36 +00:00
yhu-odoo 431d40be34 [IMP] mrp,stock: UI changes
1. Rename 'Reserved' on MO components to 'Quantity'
2. Hide `picked` field on MO compoents by default
3. Add tooltip for `picked` field on sm.

closes odoo/odoo#140150

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-10-27 21:36:57 +00:00
yhu-odoo abb2c6b54f [FIX] mrp: no coloring for manual consumption
Commit a97b352e761b421f6205b03a9b87c79358c128cd removed MrpProductionComponentsX2ManyField
to use MrpProductionComponentsListRenderer for coloring quantity cells
for manual consumption. Correctly extend StockMoveX2ManyField in this
commit.

closes odoo/odoo#140141

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-10-27 21:36:54 +00:00
yhu-odoo dbfbc3a185 [FIX] stock: use quantity from new move_id
`quantity` on sm is depended on `quantity` on sml. When create new
sml, `quantity` of sm will always be 0. To fix it, we use origin sm in
the compute function to get correct value.

closes odoo/odoo#139913

Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-10-27 13:02:15 +00:00
yhu-odoo 7a6d722f59 [FIX] mrp: call correct action in action_view_mos
In 6698406b92a598f24fa0a778a28b6ef727adc008, we removed action
mrp.mrp_production_report. action_view_mos still using this action, we
change it to use mrp.mrp_production_action instead.

closes odoo/odoo#136382

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-09-25 09:38:40 +00:00
yhu-odoo 9e1a0de027 [FIX] mrp: set correct byproduct qty when update bom
When update bom for MO, we records the ratio of (qty on Bom) / (qty on
MO)
https://github.com/odoo/odoo/blob/25502b8513afc9fca0dcdef9df9e814eea2e4ae8/addons/mrp/models/mrp_production.py#L2356-L2361
so when add byproduct, it should be (qty on Bom) / ratio instead of (qty
on Bom) * ratio to get the qty for MO:
https://github.com/odoo/odoo/blob/25502b8513afc9fca0dcdef9df9e814eea2e4ae8/addons/mrp/models/mrp_production.py#L2336

closes odoo/odoo#135691

X-original-commit: 52c03ad19fc8a764cbb362528ae94537c56f2610
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-09-18 10:14:10 +00:00
yhu-odoo a7ec4d60e7 [FIX] mrp: Don't change product_qty/uom when update bom on draft MO
Fix the issue when update the bom on a draft MO, the product_qty and
product_uom_id will be reseted to 1.0 unit.
The original product_qty and product_uom_id hould be kept when update
bom.

X-original-commit: f1a397ede16c56db3410fd9c5fe387dc98c46422
Part-of: odoo/odoo#135691
2023-09-18 10:14:10 +00:00
yhu-odoo 5620e47f80 [IMP] mrp: imporve demo data
1. In mrp settings, check workorder by default
2. Remove stock for Table leg in demo data

closes odoo/odoo#133758

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-08-31 14:15:05 +00:00
yhu-odoo 6faafdefa3 [REM] mrp: remove report "Manufacturing Order"
The report "Manufacturing Orders" is just the graph/pivot view of MO,
most of the infomation can be found on a more accurate report
"Production Analysis".
In this commit, we removed "Manufacturing Orders" from the report view.
Users can still access it from Operations -> Manfacturing Orders ->
graph/pivot view.

Task-2695732

closes odoo/odoo#130342

Related: odoo/enterprise#44912
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-08-23 18:55:03 +02:00
yhu-odoo f9867a5fa5 [IMP] mrp, *stock*: change move quantity reporting
Currently on stock moves, product_uom_qty indicates the demand qty
before the move is done and it indicates the acutual done qty when
the move is done.
As a result,  when validate a stock move with qty_done !=
product_uom_qty, a new move is always created for the difference.
And the product_uom_qty of the original move will be changed to match
qty_done.

In this commit, we change to that product_uom_qty will always indicate
the demand qty, and qty_done will always indicate actually done
quantity.
To do that, when underconsumption, we won't split the move when no
backorder. and when overconsumption, we will always merge the extra move
back to the original move.

Task-2695732

Part-of: odoo/odoo#130342
2023-08-23 18:55:02 +02:00
yhu-odoo a8977a7c76 [FIX] mrp: manual_consumption field can't save
The field manual_consumption field on mrp.bom is computed,
`readonly=False` should be added to make sure it's changable.
Also on the form view, `force_save="1"` should be added to make sure the
value will be saved since we make it readonly in some cases on the view.

closes odoo/odoo#132600

X-original-commit: 4bdfd0d1e0d95af92a1afae5888e9e587fc4994e
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-08-22 20:00:15 +02:00
yhu-odoo 6624cbf75b [FIX] mrp_subcontracting_purchase, purchase_stock: price difference
entry wrong when resupply subcontractor

In case product is using standard price and automated inventory valuation.
We post account entries in price difference account when the price on
purchase order is different from the cost of product. However, when we
do subcontracting and resupply our subcontractor, the cost is not just
the price on purchase order, but also the cost of the components we sent
to the subcontractor. Currently, we didn't take the components cost in
to account when post price difference entries. Fix it in this commit.

Task-3223451

closes odoo/odoo#132282

X-original-commit: e771535b487e76f4e5a23b767d220d7f640292a6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-08-19 11:01:00 +02:00
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
yhu-odoo 5401733912 [FIX] purchase_mrp: wrong data when merge orig links
In _prepare_merge_orig_links, default value set() is set as default
value for created_purchase_line_ids:
https://github.com/odoo/odoo/blob/31f134cbdc5fa7a50b88bea7faec682e83cb5fe0/addons/purchase_mrp/models/mrp_production.py#L52
When no data for created_purchase_line_ids, the empty set is not
handled:
https://github.com/odoo/odoo/blob/31f134cbdc5fa7a50b88bea7faec682e83cb5fe0/addons/purchase_mrp/models/mrp_production.py#L54-L55
However, empty set is not an acceptable value for m2m fields, error will
raise in this case.
To fix, we replace empty set by empty list.

closes odoo/odoo#125994

X-original-commit: 116238c4d832897a407069daec75334bec020cc8
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-06-22 09:50:41 +02:00
yhu-odoo 9955064415 [FIX] purchase_stock: valuation layer wrong when different currency
To reproduce:
1. Create a storable product with ordered quantities policy for purchase and with a category set as FIFO automated
2. Create a purchase order in a different currency and set quantities for partial deliveries
3. Create a partial delivery
4. Fully invoice the purchase order
5. Create the delivery of the complementary units
6. Check the stock valuation layer
The valuation of backorder is wrong.

The value on valuation layer is in company's currency, while the value
on invoice line is in the PO's currency. When create valuation line for
backorder, we didn't convert them to same currency.

opw-3300266

closes odoo/odoo#125206

X-original-commit: c2de679fcba7f153201dde5b3aa989eb3f329910
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-06-15 19:59:18 +02:00
yhu-odoo fc61ea4acb [FIX] stock_account: valuation layer is zero when return dropshipping
To reproduce:
1. Create a Sales Order for a product whose product category is set to
   FIFO and automated. Use route "dropship".
2. Confirm the PO created.
3. Deliver the products (DS transfer)
4. Create the customer invoice
5. Return, for example, 1 unit of product
6. Add a credit note to the invoice for that 1 unit returned (reset to
   draft then change qty and post)
Issues:
The value on the valuation layers of the returned picking is 0, posted
entries for COGS and stock interim (delivered) account for credit note
is also 0.

Since #85751, When create valuation layer for return, we take all svls
of origin_returned_move_id into account to calculate the price unit.
However, then dropshiping, 2 svls are created for the original move, and
the sum of them is 0 since there is no impact of the stock when
dropshiping. So when return, the price unit will be calculated as 0.

To fix, when calculate price unit for return of dropshiping, we only
take non-negative svls into account. Note that we use non-negative ones
instead of positive ones because when subcontract dropshiping,
additional negative svls will be added for the cost of the components.

opw-3283436

closes odoo/odoo#124856

X-original-commit: 1c6c163f72301cab29c2f26021bb1ae6fb20dc7f
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-06-13 16:58:51 +02:00
yhu-odoo efbd51560e [FIX] purchase: join() result is not Markup object
When Markup objects are joined by a str, the result will be a str.
So, here:
https://github.com/odoo/odoo/blob/5f3db6683ab191cb68af4c8d6bb2e86a5b114ee1/addons/purchase/models/account_invoice.py#L137
altought refs is all markup objects, join will return a normal str
object that will be escaped.
To fix, we join them by markup object.

closes odoo/odoo#122268

X-original-commit: cc4a50091e540ddcc8b46ee77277bd53e634d536
Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-06-06 16:22:42 +02:00
yhu-odoo 317798107a [FIX] mrp: can't provide bom when _get_lead_deys
In _get_lead_days, it always try to use the first bom of the product.
After 6825c44, days_to_prepare_mo is moved from product to bom. To
correctly calculet the lead days, we sometimes need to provide the bom.
Make this possible in this commit.

Task-3078049

closes odoo/odoo#121813

X-original-commit: cbbd370eb653e0023d1173039787055590ba680b
Related: odoo/enterprise#41256
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-05-19 16:42:08 +02:00
yhu-odoo 0171f4a1e4 [FIX] {,purchase_}mrp: add missing days when calculate DTPMO
When calculate Days to Prepare Manufacturing Order, we didn't take into
account Days to Purchase and Security Lead times for Purchaseing of the
company. In this commmit, if the (sub-)bom has company_id set, these two
days will added to the calculation.

Task-3078049

X-original-commit: bf59aedad649dec350f091bb074d3ef1e51d5fcb
Part-of: odoo/odoo#121813
2023-05-19 16:42:07 +02:00
yhu-odoo 8b09cd722f [FIX] mrp: duplicate lot when auto-generate serial
Previous commit 1b840d066999bde1f05563567f439967770701ca tried to fix
the issue action_generate_serial may try to generate a existing lot.
But it made the lot number completely product specific. This change is
too big for stable, we revert the change in this commit.

Also to fix the issue, when action_generate_serial tries to generate a
lot, we always try the result from ir.sequence frist, only when the lot
already exists, we then try create one based on the product's lastest
lot number.

Task-3187003

closes odoo/odoo#121214

X-original-commit: 95214ab6c133553371926804e788766edab2b8ca
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-05-12 13:00:50 +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 ff342d9e93 [FIX] mrp: duplicate lot when auto-generate serial.
To reproduce:
1. Manually create lot "0000001" for a lot product
2. Create a MO for this product and click generate-serial button.
Validation error raised since we are trying to generate lot/sn "0000001"
again.

When useing action_generate_serial, ir.sequence always try create a
lot/sn in form "00000dd". If user already created the same one, the
generation will fail.

We already tried to avoid this issue for sn in _get_next_serial() by
finding the latest sn and create new one base on it.

To fix, we also allow _get_next_serial to be applied to lot.

Part of Tast-3187003

closes odoo/odoo#118481

X-original-commit: dc69748ea2698077782d839cf7da48e987f17ffc
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-04-13 17:57:42 +02:00
yhu-odoo 129f3d949d [FIX] mrp: manual consumption wrong when backorder/split/merge
Fix the isuue that manual consumption is not correctly calculated when
backorder/split/merge.

closes odoo/odoo#115429

X-original-commit: d72ddd80d8a6aaa808c07db685972a1c05e8d6a4
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-03-16 09:37:14 +01:00
yhu-odoo dc1dd645b6 [FIX] stock: Difference not counted when Enter with 0
In odoo/odoo#112978, it missed the case when 0 is entered (and no
Counted Quantity already set).

On inventory adjustments, when Counted Quantity is 0 and then press
"enter" or "tab", the difference will always set to 0. The compute
function for inventory_diff_quantity is not triggered in this
situation. We manually update the value in this case to trigger the
compute function.

opw-3177578

closes odoo/odoo#115252

X-original-commit: b4b90ff5702d18cc17d74d04e12e3cf11e205e9f
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-03-15 09:54:59 +01:00
yhu-odoo b6dd4beea6 [FIX] mrp: cancelled workorder considered when plan workorder
when plan workorder, cancelled/done workorders are taken in to account
when they block current workorder. In this fix, we ignore then when plan
workorder.

Task-3126569

closes odoo/odoo#114940

X-original-commit: 1b629659cb651c62fdd2c880ae591f9a9bb2e1eb
Related: odoo/enterprise#38020
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-03-10 14:39:05 +01: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 f00c2d364d [IMP] mrp: Set quantity in consumption warning
In consumption warning, we add a new button that can correct all
qty_done according to should_consumed_qty.

closes odoo/odoo#113538

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-03-01 17:01:17 +01:00
yhu-odoo 9c5e80fb32 [IMP] mrp: improve Produce All
Currently, if the user change qty_done on any raw moves without
changing qty_producing on the MO, it's not possible to validate the
order. In this commit, we make it possible to validate the order as an
immediate production.

When qty_producing is 0 and validate the MO:
1. manual consumption moves: current consumed qty will be kept when
process the MO.
2. non-manual consumption moves: For tracked components, if
use_auto_consume_compoents_lots checked, and there is enough products
reserved, the qty_done will be filled, otherwise, an error will be
raise to ask user to fill in lot/sn. For non-tracked components,
qty_done will be filled.

Task-3116125

Part-of: odoo/odoo#113538
2023-03-01 17:01:17 +01:00
yhu-odoo ba7bf97444 [FIX] mrp: always no manual consumption when use_auto_consume_components_lots
When use_auto_consume_components_lots is on, it's always no manual
consumption on a MO even when the product is no tracked. Fix it

Part-of: odoo/odoo#113538
2023-03-01 17:01:17 +01:00
yhu-odoo 7fb27bd8b1 [IMP] mrp: untick manual consumption when remove operation_id
On the BOM, we add "Consumed in Operation" to a line, manual consumption
will be ticked automatically. In this commit, we make it that when
remove "Consumed in Operation" on a line, manual consumption will be
automatically unticked.

Task-3116125

Part-of: odoo/odoo#113538
2023-03-01 17:01:17 +01:00
yhu-odoo 5bb0f96f19 [IMP] mrp: manual consumption improvement
Previously we set a component on MO to be manual consumption by comparing
the To Consume and Consumed, if they are not the same, we consider it a
manual consumption. Now if any input activity in the Consumed cell, we
will consider it a manual consumption.

Note that in the code, we make the css class change happended in the
list renderer instead of the field widget. We do that because we want to
change the background color of the whole cell not just the text of the
field.

Task-3116125

Part-of: odoo/odoo#113538
2023-03-01 17:01:16 +01:00
yhu-odoo 439ba7d945 [FIX] mrp: show manual consumption when workorder not enabled
In 49bc9aac201136e684cac9d84df97f80d217afa4, when we need operation_id
when we check if manual_consumption is readonly or not, so
groups="mrp.group_mrp_routings" was added for manual_consumption.
As a result, we can't see manual_consumption on BOM when workorder is
not enabled.
To fix, we add a computed field as a workaround.

Task-3116125

Part-of: odoo/odoo#113538
2023-03-01 17:01:16 +01:00
yhu-odoo 48fceb2253 [FIX] stock: prevent change cancelled move
After unlock a picking/MO, it's possible to change the qty_done of a
cancelled move. This change won't have any result on product's stock.
In this commit, we raise an error when user changing cancelled moves.
We advise user to create a new line instead.

Task-3116125

closes odoo/odoo#111910

X-original-commit: c6c3e5984c3fa0fc1810ae490bd4ce10390eebd8
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-02-06 10:18:51 +01:00
yhu-odoo 5e2b97b47f [FIX] mrp: workorder cost not included in price
When auto-fill the duration of workorders in immediate production, the
workorder cost is not included in the price of the product.
It happens becuase we calculate the price in _post_inventory but we set
the duration after _post_inventory. To fix, we set the duration of the
workorders in before _post_inventory.

closes odoo/odoo#111898

X-original-commit: 707769478b9f63319689ff2347d300ce1800d1d0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-02-03 17:41:21 +01:00
yhu-odoo 603b0ee228 [FIX] purchase,sale: Error when no partner_ids
Since #106658,
https://github.com/odoo/odoo/blob/348265db3ddb90a982b0fb60f2d8b1085ceaaf2a/addons/purchase/models/purchase.py#L338
https://github.com/odoo/odoo/blob/348265db3ddb90a982b0fb60f2d8b1085ceaaf2a/addons/sale/models/sale_order.py#L1198
trigger error when no partner_ids in kwargs.
Fix them.

closes odoo/odoo#107521

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-12-08 18:00:21 +01:00
yhu-odoo 589622e82e [FIX] mrp: qty_remaining missing dependancy
To reproduce:
Create a MO without product_id, then add a new line in work orders.
Error raises.

Since cab8d8fe7f744fb4dd0cd61b624f6f4519eb8d8d, we started to show
qty_remaining of WO on MO form. It triggered the compute function of
qty_remaining. Since we don't set product_id, production_id.product_uom_id
is not provided when doing the calculation.

To fix, add production_id.product_uom_id as dependancy of qty_remaining,
and don't do the calculation without it.

opw-3092723

closes odoo/odoo#107434

X-original-commit: 0b10241c0bcbecda73dae04c8a5f1ceb8033a388
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2022-12-08 13:38:00 +01:00
yhu-odoo df6d309a14 [IMP] mrp: make productivity show by default on workorder form
When manualy create a productivity log on the workorder form, you are
always asked to choose a time_id(productivity). But by default, the
field is hidden. Make this field shown by default for better use
exprience.

closes odoo/odoo#106007

X-original-commit: 84cde486c700420c8898847342f158393c02649c
Related: odoo/enterprise#34098
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2022-11-18 14:00:11 +01:00
yhu-odoo 0961a54eca [IMP] mrp_account: adapt tests
Adapt tests for other moudules to use

ENT PR odoo/enterprise#33399

X-original-commit: 88cad50cac8130e1ff66a21ab63d53b41488a74a
Part-of: odoo/odoo#106007
2022-11-18 14:00:11 +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
yhu-odoo 19b653f784 [FIX] mrp_subcontracting: prevent open on portal
When click action_show_details button on portal, the field product_id
and product_qty are clickable. Fix it

closes odoo/odoo#103346

X-original-commit: 717d501cbf7e321124ddbe9d9061221ea97787b5
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-10-18 14:15:02 +02:00
yhu-odoo 70810919da [FIX] mrp_subcontracting: portal should be readonly
1. Except for registering components, the portal should be readonly
2. Don't open sm form when click it.

closes odoo/odoo#102935

X-original-commit: 4c5ba480e91b7e06c49b3683c36ff0a9aac9b60f
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2022-10-11 15:52:02 +02:00
yhu-odoo 885fa4301c [FIX] mail: missing check of actions
Reproduce:
Click "send_reminder_preview" button on purchase form and error raise.

Missing check if actions are None or not before get its length.

closes odoo/odoo#102563

X-original-commit: 0ba99bd71d47571ac748ab0ecd68c52891cddb9f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2022-10-07 13:37:16 +02:00
yhu-odoo 221ee0cdc3 [IMP] stock, product_expiry: Change how we calculate dates related to
expiration

Previously, we do
{expiration,use,removal,alert}_date = receipt_date + {expiration,use,removal,alert}_time

After this commit, expiration date remains unchange, for the other 3
dates, we calculate them by
{use,removal,alert}_date = expiration_date - {use,removal,alert}_time

Task-2657043

closes odoo/odoo#86760

Related: odoo/enterprise#25419
Signed-off-by: Steve Van Essche <svs@odoo.com>
2022-08-23 16:28:44 +02:00
yhu-odoo 2dd9b0b77a [IMP] barcodes_gs1_nomenclature: add support to search with gs1
Provide a preprocess method to add support to search record with gs1
barcode.

Task-2648993

closes odoo/odoo#83462

Related: odoo/enterprise#23781
Signed-off-by: Steve Van Essche <svs@odoo.com>
2022-06-23 11:15:48 +02:00
yhu-odoo 8d0b087525 [IMP] mrp: enable manual consumption on components
Currently, when changing qty_producing on a MO, consumed number of each
component will always be updated. In this commit, we add a new boolean
field manual_consumption to bom.line. If checked, that line won't be
updated when changing qty_producing.
The same but invisible field manual_consumption is also added to each
line on MO. It will use the value on BOM as defualt value. When user
manually set the consued qty, it will be checked automatically. Also,
when user manually update the SML, the field on SM will also be set to
true.

Task-2687494

closes odoo/odoo#80118

Related: odoo/enterprise#25607
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-03-31 17:24:44 +02:00
yhu-odoo 699957fd19 [REV] mrp: don't suggest qty to produce when start workorder
In 9f7e6d2bb6ae0a6b0257edf26a5aa069cd00d78e , when start a workorder, we
always suggest the qty to produce to be the full qty to produce on MO.
If the previous WO produced less than the full qty to produce on MO,
user won't aware of that when start the WO. We revert it in this committ

Task-2678388

closes odoo/odoo#83389

Related: odoo/enterprise#23961
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-02-03 15:21:35 +00:00
yhu-odoo e08d8a343d [FIX] mrp: skip cancelled WOs in _start_nextworkorder
When start_nextworkorder, if the WO is already cancelled, we
should try to check next one the this WO.

Task-2678388

closes odoo/odoo#83566

X-original-commit: 30fcfcc6c6ebb6fe9620d29475e1a7b6f1a46923
Related: odoo/enterprise#23819
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2022-01-28 16:09:30 +00:00
yhu-odoo a9d9a258e4 [IMP] stock(_picking_batch): improve set/clear qty button
Add a "clear qty" button to revert the change by "set qty" button in
(batch) picking.
On the move, Whenever the qty_done != reserved, we consider it a
manual change from the user. "set/clear qty" buttons won't change the
line with manual change.
Show "set qty" button when there are moves with 0 qty_done and non-zero
reserved. Show "clear qty" button when we don't show "set qty" button
and there are moves with qty done == reserved but the number is not 0.

Task-2659233

closes odoo/odoo#78737

Signed-off-by: Steve Van Essche <svs@odoo.com>
2021-12-07 11:50:45 +00:00
yhu-odoo 31984c8cd9 [IMP] stock: clean onchange for putaway
Clean the code for onchange method with putaway rule applied, merge
them into one onchange method.

Task-2614519

closes odoo/odoo#80519

X-original-commit: 5f562895c4d2f9beac7e0458fcee493b0141f1af
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2021-11-30 14:31:09 +00:00
yhu-odoo 6ac7e776b8 [FIX] stock: ignore the quantity of the current sml when apply putaway
When applying putaway rules, the qty of all existing assigned SM lines are
summed to calculate the incoming  qty of the product to determine if the
capacity has been or will be met. When a SM - that a putaway rule will apply
to - is created, then it will have its SM lines included in this calculation when
it shouldn't. In this case, we need to ignore the qty of those lines

Task-2614519

X-original-commit: 14738c7e5ecfba81e7ccbd401e1204d3bac960aa
Part-of: odoo/odoo#80519
2021-11-30 14:31:09 +00:00
yhu-odoo 14c494c3b3 [FIX] stock: calculate weight of package when apply putaway rule
Now when apply putaway rule on a package with package type, we calculate
the weight of the package according to the product in that package
instead of using the max weight of the package type.

Task-2614519

X-original-commit: 0281ebec36dbb9effd3d2913c0d38c88f9f19920
Part-of: odoo/odoo#80519
2021-11-30 14:31:09 +00:00
yhu-odoo 251e9992c8 [FIX] stock: no check_company on package_type_id
Package won't have a company_id untill the move is validated.
Previously, the package_type_id on package has the check_company to be
true. This forbiden any package type with company_id to be used on a not
validated package. In this commit, we remove check_company to avoid
this.

Task-2614519

X-original-commit: 66cbccb15368713ef04d2ba0f9e8808b72557b41
Part-of: odoo/odoo#80519
2021-11-30 14:31:08 +00:00
yhu-odoo 53852391d3 [FIX] stock: count incoming package number when apply putaway rule
Previously when apply putaway rule, we only count the packages in the
location to check if there is enough space the incoming package. Now we
also count all other assigned incoming packages to that location to
avoid overflow.

Task-2614519

X-original-commit: 21373dbc507e57c3a19b415583a5b0595a66c1a3
Part-of: odoo/odoo#80519
2021-11-30 14:31:07 +00:00
yhu-odoo 87fd6b7692 [FIX] stock: Add missing packaging when find a putaway location
When apply a putaway rule to find a putaway location, we only pass the
product and/or package info to _get_putaway_location. This is not
enough since the putaway rule can also be applied to packaging.

X-original-commit: 9f339938aec075c5385dca349dfc6a7c2d43b6ad
Part-of: odoo/odoo#80519
2021-11-30 14:31:07 +00:00
yhu-odoo 6206b0858b [FIX] stock: improve putaway when put in pack
Put in Pack won't trigger any onchange to use putaway rules. In this
commit, we apply putaway rule in Put in Pack when only one move line
is put in pack. We also check if the ml to put in pack are all in same
package type, if so, we set that package type on the package.

Task-2614519

X-original-commit: 023b69ac2ccac2456bcb1a8b1b66b468e213b86a
Part-of: odoo/odoo#80519
2021-11-30 14:31:07 +00:00
yhu-odoo b9b7bde33d [FIX] stock: add company_id to package type view
We didn't show company_id on package type view, there was no way to
change it. Add it in this commit.
Also made company_id on stock_storage_category form not visible when not
in multi-company.

X-original-commit: 61792e9dc13bf9d326e69eb59efe3a22354f1ca5
Part-of: odoo/odoo#80519
2021-11-30 14:31:06 +00:00
yhu-odoo 152cb2a9f2 [FIX] stock: missing package when create stock move line
When find putaway location while creating new sml, we didn't consider
the package. Add it back.

Task-2614519

X-original-commit: fcbd4c775248f18c71f9cb0e700ed9934babcdfd
Part-of: odoo/odoo#80519
2021-11-30 14:31:06 +00:00
yhu-odoo 22df4c807c [FIX] stock: find putaway location of correct dest_location
Previously when the onchange method find a putaway location for a sml, we
find a putaway location of the location_dest on the sml. However, the
location may already be a result of last computation of putaway
location. In this commit, we always find putaway location of the default
destination location.

Task-2614519

X-original-commit: a96fb8e9d2a57b67666ca3b29c9313aba83cdb91
Part-of: odoo/odoo#80519
2021-11-30 14:31:06 +00:00
yhu-odoo 79b7967785 [FIX] mrp: cancel leftover moves when create backorder
Previously, when underconsumption occured, we split the move (in
post_inventory). And if backorder, the moves not done would be linked to
the new backorder MO (when backorder MO is created).
After 8883c06ada, we create backorder MOs
before _post_inventory, making it so the moves not done will not be
linked to the backorder MOs and reserved qtys are not released.
To fix, we set cancel_backorder to be true to cancel all the leftover
moves and release the reserved qty.

Task-2697611

closes odoo/odoo#80446

X-original-commit: cffb2b455d73f64d96f91b9e0301c346989eae63
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-11-26 12:06:20 +00:00
yhu-odoo 8e599caf7a [FIX] mrp: trigger RR after change product qty
In 1e93c161ca454313436b65427542db961f6ddcdd we trigger RR when
confirming a MO. Same thing should be done if we changed the product qty
for a confirmed MO.

Task-2653116

closes odoo/odoo#79332

X-original-commit: 22eb5c38ff45f4e5cd5d2025d31960efa051ad6b
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2021-11-04 10:22:02 +00:00
yhu-odoo 9040bf33b5 [FIX] stock: avoid non-deterministic order for location
Stock.location is ordered by "complete_name" which is possible to be the
same (i.e. default production locations for different companies). This
may result non-deterministic order. Add "id" to avoid it.

closes odoo/odoo#79181

X-original-commit: 94a8ad3fae914b046064bb7ce17572be8280f6e0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2021-10-29 11:05:56 +00:00
yhu-odoo 7d3221c465 [FIX] repair: search location with company_id
When find a location_id for repair.line, we didn't restrict the location
to have same company_id with the repair.order. Add it.

closes odoo/odoo#78350

X-original-commit: dff911a1b006a542bf9b082c76910a2d8346fef1
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-14 08:13:04 +00:00
yhu-odoo 8742b14110 [IMP] repair: imporve demo data
Improve repair demo data

Task-2657280

closes odoo/odoo#77945

X-original-commit: 24e31a3c6ada0e62b844bbae305dbd4ab205d012
Related: odoo/enterprise#21501
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-10-06 11:32:52 +00:00
yhu-odoo 08ac2111be [FIX] mrp_subcontracting: complete the bom report table structrue
In the bom cost report template, a "tr" is missing and no parent_id for
the subcontructing part. This result in a leftover line each time you
fold the bom. Add them to the tamplate.

Task-2657280

X-original-commit: 6ae623dc2d5131e2b11969f1bc1f8dd6096a9005
Part-of: odoo/odoo#77945
2021-10-06 11:32:51 +00:00
yhu-odoo 38a4062678 [FIX] mrp_account: update reference and name of wo analytic lines
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

closes odoo/odoo#76090

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-09-10 15:00:51 +00:00
yhu-odoo f07ab5f5d5 [FIX] mrp_account: don't duplication analytic_account_line_id
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
2021-09-10 15:00:51 +00:00
yhu-odoo caa908506b [IMP] mrp,stock: count kits product
When a product's has a kits bom, we consider it a kits product.
When a product is a kits product, we count its "on hand" and "forecast"
qty by caculating how many can be produced according to the bom.
We add status button to the show the qty on kit product form.

Task-2444000
COM PR odoo/odoo#75555
ENT PR odoo/enterprise#20440
UPG PR odoo/upgrade#2783

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-09-03 08:11:42 +00:00
yhu-odoo fa2231fb0c [ADD] mrp_repair: explode kits in repair
When repair contains kits product(product has kits boms), decompose
it into components.

Task-2444000
COM PR odoo/odoo#75555
ENT PR odoo/enterprise#20440
UPG PR odoo/upgrade#2783
2021-09-03 08:11:42 +00:00
yhu-odoo 5855df867f [IMP] mrp: add kits decription in picking
When recieving a kits product, it will be decomponent in the picking. In
this commit, we add a column in the picking to show the info of the kits
in picking.

Task-2444000
COM PR odoo/odoo#75555
ENT PR odoo/enterprise#20440
UPG PR odoo/upgrade#2783
2021-09-03 08:11:42 +00:00
yhu-odoo a7007748c3 [ADD] project_purchase: Monitoring purchase in project
Show purchase information in project when both use the same analytic
account.

Task-2469742
PR #68708
2021-08-27 16:40:50 +00:00
yhu-odoo f2422345fc [ADD] project_mrp: monitoring mrp in project
Show mrp information in project when both use the same analytic account.

Task-2469742
PR #68708
2021-08-27 16:40:49 +00:00
yhu-odoo 45912aaebd [IMP] analytic, project, *: Improve views
Improve the views of analytic.account and project.project.
Add category to analytic.line.

Task-2469742
PR #68708
2021-08-27 16:40:49 +00:00
yhu-odoo edacd76e21 [IMP] mrp_account: analytic accounting on MO
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
2021-08-27 16:40:49 +00:00
yhu-odoo 49b544a871 [IMP] mrp: no more changes after apply
Hide the edit button to prevent user editing the file again after
applied the eco change.

Task-2466232
PR #69914
ENT PR odoo/enterprise#17960

Related: odoo/upgrade#2427
Signed-off-by: Tiffany Chang <tic@odoo.com>
2021-08-20 13:28:48 +00:00
yhu-odoo af13e76629 [IMP] stock: delivery slip address format
Make delivery slip show addresses the same way as picking operations

Task 2334764

closes odoo/odoo#67776

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-06-24 10:40:35 +00:00
yhu-odoo 825bc6b1d7 [IMP] stock: set partner for inter-warehouse transfers
when we have wh1 resupply form wh2, two transfers will be created. One
delivery from wh2 to transit location, one receipt from transit location
to wh1. Both transders don't have receive from/deviver to. In this
commit, we set the corresponding warehouse address as receive
from/deliver to.

Task 2334764
2021-06-22 13:50:52 +00:00
yhu-odoo 94b9906ce0 [FIX] stock: wrong contact on picking when manual replenish
When do a manual replenishment, we set the responsible persion of the
product to be the partner of the procurement group. Then this parnter_id
is propagated to stock.move and then stock.picking. So the responsible
person will be shown on the picking form as contact person.
To fix, remove it when creating procuremnet group.

Task-2334764
PR #67776
2021-06-22 13:50:52 +00:00
yhu-odoo f3307e201c [FIX] mrp: skip service when compute kit quantities
Since we can't transfer service product, when compute delivered or
received kit quantities, we should skip the service components.

Task-2566373
PR #72306

closes odoo/odoo#72575

X-original-commit: f86c7c0dfa09a2136ed1789a905eae9205de0c03
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-06-28 07:16:55 +00:00
yhu-odoo 47ebaa384b [FIX] mrp: delivered are always 0 when kits with 0 qty component
A kits bom has a component but qty is 0. When sale this kits, the 0 qty
component won't be delivered, and the delivered qty of the kits will
always be 0.
To fix it, we don't find a stock.move and bypass the quantity check
since the stock.move are not generated when bom line quantities are 0.

Task-2580118
PR #72637

closes odoo/odoo#72920

X-original-commit: fad7a15560c1d454be294f1a8d1ce5a57d576900
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-07-01 07:06:42 +00:00
yhu-odoo 2915ac1226 [IMP](stock,mrp)_account: use location valuation account
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

closes odoo/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>
2021-05-19 17:01:08 +00:00
yhu-odoo ee2ded210e [IMP] mrp: no register number check after duplicate MO
To reproduce:
1. create and confirm a MO with register number checks on operations
2. duplicate the MO
The register number checks won't show up in the new MO

We didn't set copy=False for workorder_id on stock.move, when copy a
confirmed MO, the new moves are linked to old WOs on old MO. New WO
didn't link to any moves.
When create quality checks, we only create "register ..." checks for WOs
with move_id. As a result, new WOs without move_id won't have those
checks.
To fix, set copy=False on workorder_id of stock.move

Task 2484939

closes odoo/odoo#71000

X-original-commit: 6aaf337558e59474efcef937f0175ee531b4b477
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-18 16:52:34 +00:00
yhu-odoo e310d92958 [IMP] stock_picking_batch: cancel empty batch picking
As pickings can be moved from a batch into an another one, a batch can suddenly
be emptied or having no more active pickings.In such case, we cancel it.
This way, empty batches won't be displayed by default as there is a default
filter showing only draft or in progress batches.
If we manually remove all pickings from a batch or create a empty batch, we
consider it intentional, and won't cancel it automatically.

Task-2464457
PR #66600

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-18 12:59:25 +00:00
yhu-odoo d1448b666b [IMP] stock_picking_batch: allow create batch with picking in other
batch

We already allowed the stock.picking.to.batch wizard to create batch
with pickings already in other batches. This commit will also allow you
select pickings that are already in other batches on the batch form.

Task-2464457
PR #66600
2021-05-18 12:47:14 +00:00
yhu-odoo edc372a04e [IMP] (sale_)stock, product: route for packaging
Route is now can be set to apply on packagings. Bravo!

Task-2357259
PR #68654

Related: odoo/upgrade#2444
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-05-06 13:36:34 +00:00
yhu-odoo 02bffa5f40 [IMP] stock: smart putaway for packaging
Apply smart putaway rules on move with packaging.

Task-2357259
PR #68654
2021-05-06 13:36:34 +00:00
yhu-odoo 688d655305 [IMP] {purchase, sale}_stock, product: packaging revamp
1. add packaging to PO lines
2. packaging on PO/SO lines can be propagate to MO
3. add package type to packaging
4. on picking types, we can choose to only reserve full packaging. That
means if you want 1 pallet(100 units) and you have 50 units in stock. It
won't be reserved.
5. suggest suitable packaging for PO/SO/MO line according to the product
qty

Task-2357259
PR #68654
UPG PR odoo/upgrade#2444
2021-05-06 13:36:28 +00:00
yhu-odoo bf26c3c221 [FIX] stock: cleanup picking state
Cleanup unused "none" and "partailly_available" state for stock.picking.

Task-2357259
PR #68654
2021-05-04 15:05:52 +00:00
yhu-odoo 6414a4847e [FIX] stock_account: wrong account when changing cost method
Previously when changing cost method, we always add debit to Expense
account when empty svl. This results in an unneutral change for process
that should be neutral. In this commit, we change to use stock input
account to make it neutral.

Task 2481563

closes odoo/odoo#68083

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-03-18 08:21:50 +00:00
yhu-odoo 92e577d106 [IMP](sale_)stock,mrp: smart putaway rules
We introduced new Smart Putaway Rules.
Locations now can have a storage category, on each storage category,
we can specify the amount of products/packages(with certian package
type) that can be stored in the location.
On putaway rules, we can also set a storage category. Now when apply a
putaway rule, we will find a suitable child location of the out
location according to quantity/weight setting on the storage category.

Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
2021-03-31 09:00:40 +00:00
yhu-odoo 1cd0a138cf [REF] delivery, stock: make delivery product a new model
Currently, delivery packaging and product packaging share the same
model product.packaging. In this commit, we make delivery packaging
a new model stock.package.type. The code is also moved to stock
instead of delivery for compatibility reasons.

Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
2021-03-31 08:55:44 +00:00
yhu-odoo f2b19e4f4d [FIX] stock: don't check parent locations when finding putaway rules
Let's say we have location A, B, and C. A is the parent of B, B is the
parent of C. And we have a putaway rule to move product from A to B. Now
receive product at C, because currently when we can't find a putaway
rule at one location, we will loop to check its parent locations. So the
puteaway rule A -> B will be found, and product received at C will in
the end be stored at B.
After this commit, we don't check the parent locations when we can't
find a putaway rule.

Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
2021-03-31 08:55:44 +00:00
yhu-odoo 93efaa8ce3 [IMP]stock,mrp: merge same components on MO
When adding extra components on MO, merge to one line if we already have
same components

Task 2446915
PR #66583
ENT PR odoo/enterprise#16554

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-03-30 11:49:54 +00:00
yhu-odoo 729db008f5 [IMP] mrp: make mo under consumption consistent with picking
Considering the MO under consumption situation:
  component A, to consume = 2, consumed = 1
Previous, after "mark as done", the MO will have two lines:
  component A, to consume = 1, consumed = 1, state done
  component A, to consume = 0, consumed = 0, state done
Now, after "mark as done", it will be consistent with picking:
  component A, to consume = 1, consumed = 1, state "done"
  component A, to consume = 1, consumed = 0, state "concel"

Task 2446915
PR #66583
ENT PR odoo/enterprise#16554
2021-03-30 11:49:54 +00:00
yhu-odoo 0fc9e8fbcc [IMP] stock: no extra moves when over consumption
This commit is a revert of revert 561b3461a0
and 97ba860fd38c530d3f3678f676754862afad0f11.
Previously we split moves when no picking, now we consider it
unnecessary.

Task 2446915
COM PR #66583
ENT PR odoo/enterprise#16554
2021-03-30 11:49:53 +00:00
yhu-odoo af9b926766 [FIX] purchase_stock: purchase product route can't be triggered
To reproduce:
1. set WH receipt in 3 steps
2. create a "receipt in 2 steps" route for product
3. create a PO with product "receipt in 2 steps"
In inventory, we will see this product still follow the "receipt in 3
steps" route.

This is caused when we create move for PO, we prepare the route_ids
according to warehouse's route_ids. After the move has it's own
route_ids, it will not search for route set on product or product
category (which should has higher priority over warehouse route).
To fix it, we remove the route_ids when create the move for PO. A route
will be found when the move being comfirmed.

Task 2448439
PR #65509

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-02-04 08:31:54 +00:00