diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/product_expiry/models/stock_quant.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/product_expiry/models/stock_quant.py')
| -rw-r--r-- | addons/product_expiry/models/stock_quant.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/addons/product_expiry/models/stock_quant.py b/addons/product_expiry/models/stock_quant.py new file mode 100644 index 00000000..34e31b54 --- /dev/null +++ b/addons/product_expiry/models/stock_quant.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models + + +class StockQuant(models.Model): + _inherit = 'stock.quant' + + removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False) + use_expiration_date = fields.Boolean(related='product_id.use_expiration_date', readonly=True) + + @api.model + def _get_inventory_fields_create(self): + """ Returns a list of fields user can edit when he want to create a quant in `inventory_mode`. + """ + res = super()._get_inventory_fields_create() + res += ['removal_date'] + return res + + @api.model + def _get_inventory_fields_write(self): + """ Returns a list of fields user can edit when he want to edit a quant in `inventory_mode`. + """ + res = super()._get_inventory_fields_write() + res += ['removal_date'] + return res + + @api.model + def _get_removal_strategy_order(self, removal_strategy): + if removal_strategy == 'fefo': + return 'removal_date, in_date, id' + return super(StockQuant, self)._get_removal_strategy_order(removal_strategy) |
