Commit Graph
36 Commits
Author SHA1 Message Date
Tiffany Chang (tic) 5ebf1f5dbe [IMP] product_expiry: Add delivery slip expiration dates
This commit adds the option to have lot/serial number expiration
dates be included in a delivery report (via settings). This is only
applicable for stock.picking where 'State=Done', when 1 or more
lot/serial numbers are used, and 1 or more lot/serial number expiration
dates exist.

This completes subsection 4 of overall Improve delivery slip task.

Task: 2039720
2020-07-03 11:54:08 +00:00
Pratima Gupta d8702a4419 [FIX] product_expiry: changed removal date visibility on inventory report
1) removal_date in inventory report should be readonly if
product tracking is none or use_expiration_date of product
is false.

2) removal_date should be editable in inventory mode.

Fixes-2273732

closes odoo/odoo#52827

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-06-17 09:56:29 +00:00
svs-odoo 4ec07602aa [FIX] product_expiry: update quantity on hand
Before this commit, when the user tries to create a new quant, even if
the product doesn't use an expiration date, he/she will not be able to
create the quant.
The issue was as `removal_date` field is added by `product_expiry` in
the quant list view, the field is on the values used to create a new
quant but not in the list of accepted field for quant creation.
So, it raises an UserError.

task-2260085

closes odoo/odoo#51482

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-05-18 15:35:08 +00:00
yhu-odoo 86f091c0c6 [IMP]stock,product_expiry: improve error message for sn number check
=======
PURPOSE
=======

Improve duplicated serial number message to show more information.

=======
SPEC
=======

In this commit, we show full information about all invalide product name
and lot/sn number when the user enters duplicated ones.

- Change the sql constraint for checking duplicate sn/lot to python
constraint to support customised error message.
- Create lot in batch to show all invalide ones in error message.

=======
LINKS
=======

task 2083605
pr #44366

Related: odoo/upgrade#954
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-03-17 12:40:26 +00:00
Simon Lejeune b9334c53b8 [REF] stock: move line: some guidelines
- move all the constrains at the same place, make sure they are private
- move all the onchanges at the same place, make sure they are private
- move `_get_similar_move_lines` helper at the bottom of the file with
  the other helpers
2020-01-20 14:01:21 +00:00
svs-odoo 5f62ec0b5c [FIX] product_expiry: default expiration_date
Before this commit, the default `expiration_date` wasn't set when the
move line was created with the help of multiple assign serial numbers
button or when user wrote/copy-pasted a list of SN/LN.

task-2166230

closes odoo/odoo#42809

X-original-commit: ff6126e8077031fb20eada5f3f9d8fd8a4a4c56a
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-01-06 19:46:05 +00:00
svs-odoo d67b1471a3 [FIX] product_expiry: editable expiration_date
Before this commit, in the move line view, the  field `expiration_date`
was readonly even when it must be editable. It was because the condition
who defines if the field is readonly or not was wrong.
Also, removed the field `expiration_date_readonly` as it mainly referred
to `picking_type_use_existing_lots`, and use this latter instead.

task-2166230

X-original-commit: f1b8426919dc049df447d50ed3ac365eec2897c3
2020-01-06 19:46:04 +00:00
Hetashree ChauhanandHiral Bhavsar 4c36a35bf1 [IMP] sale(_stock): add wizard to cancel the confirmed SO
Purpose of the task is be able to cancel an order if the products have
been delivered or if an invoice has already been confirmed

-the remaining pickings (back orders) should be cancelled.
-the draft invoices should be cancelled too.

[IMP] product_expiry: compute method should iterate on self

task-1919761
Closes #29920

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Co-authored-by: Hiral Bhavsar <hbh@odoo.com>
2019-11-06 13:19:40 +00:00
svs-odoo 4d71fe100d [FIX] product_expiry: expiration date on receipt
How to reproduce:
    - Create a tracked product using expiration dates and don't set the
      `expiration_time` field;
    - Create a receipt for this product (using "Create New Lots/Serial
      Numbers") and confirm it;
    - Create a move line for this product and define an expiration date;
    - Valid the picking -> Traceback.

The issue was as `expiration_time` isn't set on product, the production
lot created on the receipt's validation don't have an `expiration_date`.
So, if the `expiration_date` is set on the receipt move line, the
production lot will try to get a time delta with its unset
`expiration_date`, causing the traceback.

task-2119330

closes odoo/odoo#39795

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-11-05 12:06:37 +00:00
svs-odoo e5d3f2a1ab [IMP] product_expiry: hide removal date on quant
When user goes on product's quants, hides the "Removal Date" field if
the product doesn't use expiration dates.
Also, set it as optional to be hide if the user wants.

closes odoo/odoo#39425

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-10-28 12:31:58 +00:00
svs-odoo 7d7b902eac [IMP] product_expiry: change expiry alert compute
The production lot expiry alert was based on the field `alert_date`.
Now, it will be based on the field `life_date` since if user set only
one field, there is more chance this field will be filled but the field
`alert_date` will not.

Task #1938656
2019-10-25 13:50:37 +00:00
svs-odoo 197ef3ea68 [IMP] product_expiry: expired wizard confirmation
When user tries to validate a picking with expired production lot,
displays a wizard for the confirmation popup. This wizard shows which
lots are expired.

Task #1938656
2019-10-25 13:50:37 +00:00
svs-odoo decef03acf [IMP] product_expiry,stock: expiration_date at receipt
User can now define the lot's field `expiration_date` when he/she
receipts a tracked product using the expiration dates.

Task #1938656
2019-10-25 13:50:36 +00:00
svs-odoo 9559bf90a8 [IMP] product_expiry: onchange on production_lot dates
Computes production_lot date fields when the user manually changes the
`life_date` field.

Task #1938656
2019-10-25 13:36:47 +00:00
svs-odoo ca06bfaf4f [IMP] product_expiry: visual changes
Changes the label and tooltip of expiration date related fields.

Task #1938656
2019-10-25 13:20:38 +00:00
svs-odoo 287f56c5c9 [IMP] product_expiry: add use_expiration_date
Adds new product field, `use_expiration_date`, to know if user wants to
use expiration date on product. Only accessible when product is tracked.

Also, changes fields' name:
    - product.template:     life_time becomes expiration_time
    - stock.production.lot: life_date becomes expiration_date

Task #1938656
2019-10-25 13:20:38 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
Arnaud Baes 689dab3f26 [IMP] stock,product_expiry: lot views cleanup 2019-08-14 12:27:05 +00:00
Victor Feyens f0182a0b16 [FIX] product_expiry: activities generation
This commit improves the performance of product expiry activities generation.
It also removes direct refs to activity types to ensure code stability in case of user deletion of system data.
The xml refs to activity types should only be used through mail methods to ensure fallback strategies can be managed in the mail module only.

closes odoo/odoo#33300

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-05-15 09:13:40 +00:00
Haresh Shyara 93a33e603a [IMP] stock: removed require on responsible field
- when responsible field is empty on the product then next activity should be assigned to the system admin.

Task ID : 1891230
2018-11-26 12:24:13 +00:00
Adrian Torres 3f4f77fd9d [REF] *: adapt code to new related default behaviour
This commit adapts the business code to changes introduced by
the parent commit in order to keep the same behaviour as before.

All readonly=False fields will have to be checked afterwards to confirm
that the business case requires write access to the source field.
2018-09-27 12:10:23 +02:00
Nicolas Vannieuwerburgh edbf129372 [IMP] product_expiry: Schedule an activity on lots when expiration date is reached 2018-07-23 15:57:02 +02:00
Martin Trigaux 56c173af9f [IMP] misc: rephrase
Courtesy of e2f translators
2018-02-27 14:58:29 +01:00
Nicolas Martinelli 6139840796 [FIX] product_expiry: date on lot
- Create a product tracked by lot with some date values != 0
- Create a MO for this product, click on 'Produce'
- Create a new lot.

The various dates are not registered on the lot.

The product ID is located in the context in this case, not in the
values.

opw-803790
2018-01-16 09:09:28 +01:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Simon Lejeune b3180c8411 [REF] stock: new quant implementation
The main idea of this new implementation is that stock.quant is now a
cache of the quantity per location/lot/pack/owner key. We removed every
identity per record, such as `history_ids` or `inventory_value` so that
we can now avoid the linear creation of stock.quant records and are able
to work with only one record per key.

The algorithms to retrieve the quantity per key are made to work with
multiple records, this way we can implement strategies to workaround
postgres locks if concurrent transactions try to work on the same quant
row.

Quants will not be linked to moves anymore, this is in order to be able
to edit stock moves more easily/freely. We removed the links with this
commit and wipe out the `action_assign` on stock move. This will be
implemented in a followup commit, once the relations between stock.move,
stock.pack.operation and stock.quant are clarified.

This commit seems to have unecessary diff, but it was done in order to
run tests on the new implementation.

We adapt the views by removing the fields not present anymore in the
model. This include the complete removal of the inventory valuation
view, as the implementation of stock valuation will be refactored and
moved on stock.move in a following revision.

We wipe out `action_cancel`, `recalculate_move_state`,
`move_quants_by_lot_v10` and `quants_unreserve`.

* `get_removal_strategy` moved from `stock.move` to `stock.quant`

Stock quant model:
  * qty renamed to quantity
  * history_ids: because the quants are not moved
  * inventory_value: implementation moved to stock.move
  * packaging_type_id: doesn't seem to be used (in filters?)
  * propagated_from_id: because we do not split forced quants
  * reservation_id: because the reservation are not linked to
    the stock.move.line

We remove the `lot_ids` computed field, as it depended on the link
between stock moves and quants and could be replaced by a related
to the move lines once the new relation between stock.move,
stock.pack.operation and stock.quant is clarified in a further commit.
Furthermore, the field was not displayed to the user.
2017-07-14 17:08:21 +02:00
kso 555a3c9f20 [IMP] stock: Improve tooltip for Alert date field on production lot
PURPOSE
=======

confusing tooltip on "Alert Date".

SPECIFICATION
=============

Replace the tooltip on alert date by : "Date used to determined what are the expired lots and serial numbers using the filter "Expiration Alerts".
2017-06-14 13:54:04 +02:00
xmo-odoo fffaf735f5 [FIX] P3: list -> iterable builtins (#16811)
In Python 3:

* various builtins and dict methods were changed to return
  view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
  removed altogether

This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).

Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.

issue #8530
2017-05-10 09:39:55 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Christophe Simonis 6c4389df41 [MERGE] forward port branch 10.0 up to 6804085b8c 2017-01-23 14:33:53 +01:00
Goffin Simon f932f4d4f4 [FIX] product_expiry: Setting life_date, use_date, removal_date, alert_date
When setting life_date, use_date, removal_date or alert_date, if one of these
fields are already set, it must be kept.

opw:704962
2017-01-18 15:14:25 +01:00
Ravi Patel 5bd4514c6f [IMP] prodcut_expiry: 'Product Alert Time' improvement
- Hide life_time, use_time, removal_time and alert_time if tracking = no tracking
- Change the tooltip of these fields(life_time, use_time, removal_time, alert_time)
- Add filter 'Expiration Alert' on the Lot/Serial Number list view based on the lot/sn alert date
- Add a tag 'Expiration alert' when the alert_date is reached.
2016-10-20 15:37:51 +02:00
Thibault Delavallée 304c81c91c [CLEAN] stock: pre-migration cleaning
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
2016-04-29 12:18:34 +02:00
Srushti Patel 71fae64534 [MIG] product_expiry: migration to new api
Thanks rgo-odoo for the _get_dates method and the removal of the context abuse.
2016-04-06 16:43:44 +02:00
Srushti Patel 86033b0f93 [MOV] product_expiry: split file product_expiry.py 2016-04-06 16:43:44 +02:00
Srushti Patel 1119681de0 [MOV] product_expiry: reorganizing the directory structure 2016-04-06 16:43:44 +02:00