This commit contains the core of the new MRP. It contains a whole refactoring
of the MRP application, with improved and new features, written in new API.
Among other here are the main manufacturing workflow improvements :
- Picking type not only for pickings but also for manufacturing orders
- Properties replaced by picking type
- BoM can only be produced with its routing (no other)
- Either produce without routing with only production orders, or produce with
routing
- By default, there is an order in the work orders (serially), but you can
override it to be able to work in parallel
- Time clocking on work orders and block time on work centers with reporting
on OEE, performance, losses, ...
- Real-time adaptation of timings on operations
- Lots/serial numbers can be inputted like in the pickings on manufacturing
orders. It is also possible to input them in the work orders.
- Material availability independent of production order state (possibility to
start production when only part of it is there)
- Work sheets on work orders
- Put messages on work orders to make your workers pay attention to something
- Full traceability link to see for each produced piece of stock, the
consumed pieces, ...
- Separate scrap object (a scrap is not done based on an original move
anymore)
- Separate unbuild system (if you want to unbuild into its original
components)
Thanks to all people that helped during this development, notably but not
limited to Chirag A Dodiya (cod@odoo.com), Gaurav Panchal (gan@odoo.com),
Jignesh Rathod (jir@odoo.com), Mansi Trivedi (mtr@odoo.com), Pariket Trivedi
(ptr@odoo.com).
The billed quantity field on the purchase order line
must exclude the cancelled invoice, as a cancelled invoice
is not considered as invoiced.
`draft` could be considered as well, but we do not
take the chance now, as this field is used
when creating a new invoice, to determine the
quantity to invoice. Therefore, if there are
draft invoices with some quantities invoiced,
it can make sense to reduce the quantity
in this new invoice. Nevertheless, it must not be the case
for cancelled invoices.
opw-679363
PURPOSE:
The source document should be in the chatter and clickable
NEW MAIL TEMPLATE:
mail: new template 'message_origin_link' with clickable link to origin
Variables to pass:
- origin: the record from which the current record had been created
- self: The current record
Optional:
- edit: If true, the record has been modified. Otherwise it has been created
from the origin
SPECIFICATION:
Source Document is available in following models
1) After creating SO then Sale to Invoice -> Source Document (After creating Sales Order and then clicking on Create invoice)
2) When procurement is created after SO or MO or Order Point(procurement.order) - > Source Document
3) Stock.picking -> Source Document ( After Creating SO or PO)
4) When Manufacturing Order is Created (mrp.production) -> Source Document (Coming after creating a sale order of product)
5) Event -> Attendees(event.registration) -> Source Document
6) Request For Quotation -> Source Document (After creating Purchase Tender, SO)
7) In Purchase Tender(purchase.requisition) -> Source Document (When a new Purchase Tender is Created)
8) After creating PO then create invoice(vendor bill)-> Source Document
9) After creating Invoice from contract (subscription) - > source Document.
10) Refund invoice from Invoice --> Source Document.
11) Return picking from picking --> Source Document.
12) sale use POS to create invoice and picking --> Source Document.
MESSAGES TO DISPLAY:
-In Customer Invoice, there is a source document of Sale Order.
"This Invoice has been created from Sale Order(s): SO001, SO002"
-In Procurement, the source document can be either of Sale Order or Manufacturing Order or Order Point.
"This procurement is created from: SO001 or MO0001 or OP/0001"
-In Stock Picking, the source document can be either of Sale Order or Purchase Order.
"This transfer has been created from sales order(s): SO001 or PO0001"
-Create new Sales order of manufactured product , there will be Source Document with that Sale Order number
"This production has been created from procurement(s): WH: Stock -> CustomersMTO"
-When registering for Event from website, Sale Order is Created and it is stored in Source Document,
"The attendee has been created from Sale order: SO001"
-In RFQ, the source document can be either Purchase Tender or Sale Order or Order Point,
"This purchase order has been created from purchase requisition(s): TE0001 or SO001 or OP/0001"
-In Purchase Tender, the source document can be either of Sale Order/ Manufacturing Order/ Order Point.
"This Purchase Requisition has been created from: WH: Stock -> CustomersMTO"
-In Vendor bill, there is a source document of Purchase Order.
"This Vendor bill has been created from Purchase Order(s): PO0001, PO002"
-When creating refund of invoice
"This customer invoices refund has been created from customer invoices: INV/2016/0001"
-when create invoice and picking form pos.
"This invoce has been create from point of sale: MainXX"
By default, when reading a m2m field, entries that are
deactivated in the destination table are not included.
This behavior is desirable in some cases (e.g. for
"tags" or "categories", but not for entries that
significantly impact other field values in the parent
record, such as taxes.
The problem is rather obvious: when displaying a
paid invoice that used taxes that are now deactivated,
the taxes are hidden while they still affect the
computed amount. And after cancelling + resetting
to draft, the tax is not taken into account anymore,
while still being linked.
Forcing the field-level (python) domain to include
both active and inactive entries solves the problem:
- when reading, displaying and recomputing values,
deactivated taxes will be included.
- when trying to pick a tax, deactivated entries
will still be ignored, as expected.
This commit applies the technique to all m2m
fields that refer to taxes.
Fixes#12066
opw-677751
Used case:
-Configure admin as multi-company user
-Create 2 fiscal positions (one for company "Odoo BE" and one for company "Odoo US")
-Set admin on company "Odoo BE"
-On supplier (Asustek) configure fiscal position Odoo BE
-Set admin on company "Odoo US"
-On supplier (Asustek) configure fiscal position Odoo US
-Configure a product (Laptop E5023) with:
*route "Buy"
*supplier (Asustek) without company
*reordering rules (min qty: 20, max qty: 40)
-Set admin on company "Odoo BE"
-Run scheduler via the cron
Behavior before the fix:
-Fiscal position on the created PO is the fiscal position for "Odoo BE" (and PO is for the company "Odoo US")
Behavior after the fix:
-Fiscal position on the create PO is the fiscal position for "Odoo US".
Closes#11537
opw:673288
When creating an invoice from a SO or PO with a line containing a product with a
deferred revenue type or an asset type, this information is not copied in the
related invoice line.
Inspired from 564fda4
opw:677098
Move model is migrated to new API. No change is performed to code
structure or functional structure. Some code cleaning may be performed when
migrating to simplify the code. Other files may be updated due to the move
towards the new API.
General remarks concerning cleaning commits preparing the stock migration
=========================================================================
Small update / cleaning before moving and migrating. This commit contains
the cleaning of stock_picking_type and stock_picking models.
The first cleaning performed is to clean methods having a browse record or
a list of records replacing ids parameter. Those are converted into classic
old API methods using cr, uid, ids. This eases the migration as they are
then migrated into multi methods.
Another cleaning concerns naming things. Some methods are renamed to ease
the code readability. Some parameters are also renamed as well as some
variables. This kind of change is performed only when the readability
is improved. Otherwise the code is kept as it is to avoid rewriting too
much of the code.
Finally unnecessary stuff is also removed. This concerns dead code (methods
not used in community nor in enterprise) and unnecessary code splitting
(tools methods called once without real added value are directly put into
their called method).
- stock.move: no specific changes; note that a method called only in mrp
has been moved to mrp.
- product: no specific changes
- config settings: no specific changes
- wizards: no specific changes
stock.quant main changes
========================
- ``apply_removal_strategy`` method updated to return only the removal
strategy instead of having a mix of several things (overrides updated)
- ``quants_get_**`` methods renamed to ease code understanding
- quants_unreserve from stock.quant to stock.move model because its primary
record is a move, not quants
stock.inventory and stock.inventory.line main changes
=====================================================
- stock.inventory: ``move_ids_exist`` field remove. Unused.
stock.picking and stock.picking.type main changes
=================================================
- stock.picking: ``move_lines_related`` is removed. Indeed it is used only
to display a slightly different view of moves contained inside a picking.
However this field causes a lot of issues when migrated into the new API.
The view is updated to keep the same look and feel while avoiding an
unnecessary field.
- stock.picking.type: complete_name field is removed. Using display_name is
sufficient for the existing use cases.
stock.warehouse and stock.orderpoint main changes
=================================================
- stock.warehouse: removed ``resupply_from_wh``, unused field
stock.pack.operation main changes
=================================
- stock.pack.operation: ``processed_boolean`` fields renamed to ``is_done``
to match its use in the code.
stock.location main changes
===========================
Note that in this commit a strange override in create has been replaced by a
cleaner override in default_get in order to have something more understandable
procurement main changes
========================
- in this commit some code located in procurement has been moved to the
orderpoint model. Indeed those methods take an orderpoint as main
argument, making it more orderpoint methods than procurement methods
- ``_prepare_orderpoint_procurement`` method has been merged with its
strange override in stock_calendar to have something a bit more modular
In v8.0, when a procurement is cancelled and the quantity remaining on
the PO line is zero, the line is deleted. It was not the case anymore
after the Purchase refactoring.
opw-675493
When a PO is created from a reordering rule, we should make sure to use
the purchase UoM of the product. Any PO line automatically created or
modified will be a PO line in the purchase UoM.
opw-673309