mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 15:52:01 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -1,10 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from datetime import datetime
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class ConfirmExpiry(models.TransientModel):
|
||||
class ExpiryPickingConfirmation(models.TransientModel):
|
||||
_name = 'expiry.picking.confirmation'
|
||||
_description = 'Confirm Expiry'
|
||||
|
||||
|
|
@ -21,13 +22,13 @@ class ConfirmExpiry(models.TransientModel):
|
|||
# For multiple expired lots, they are listed in the wizard view.
|
||||
self.description = _(
|
||||
"You are going to deliver some product expired lots."
|
||||
"\nDo you confirm you want to proceed ?"
|
||||
"\nDo you confirm you want to proceed?"
|
||||
)
|
||||
else:
|
||||
# For one expired lot, its name is written in the wizard message.
|
||||
self.description = _(
|
||||
"You are going to deliver the product %(product_name)s, %(lot_name)s which is expired."
|
||||
"\nDo you confirm you want to proceed ?",
|
||||
"You are going to deliver the product %(product_name)s, %(lot_name)s which is expired or should at least be removed from stock."
|
||||
"\nDo you confirm you want to proceed?",
|
||||
product_name=self.lot_ids.product_id.display_name,
|
||||
lot_name=self.lot_ids.name
|
||||
)
|
||||
|
|
@ -42,12 +43,9 @@ class ConfirmExpiry(models.TransientModel):
|
|||
return True
|
||||
|
||||
def process_no_expired(self):
|
||||
""" Don't process for concerned pickings (ones with expired lots), but
|
||||
process for all other pickings (in case of multi). """
|
||||
# Remove `self.pick_ids` from `button_validate_picking_ids` and call
|
||||
# `button_validate` with the subset (if any).
|
||||
""" Remove the expired mls and confirm the picking. """
|
||||
pickings_to_validate = self.env['stock.picking'].browse(self.env.context.get('button_validate_picking_ids'))
|
||||
pickings_to_validate = pickings_to_validate - self.picking_ids
|
||||
if pickings_to_validate:
|
||||
return pickings_to_validate.with_context(skip_expired=True).button_validate()
|
||||
return True
|
||||
self.picking_ids.move_line_ids.filtered(
|
||||
lambda ml: ml.use_expiration_date and ml.removal_date and ml.removal_date < datetime.now()
|
||||
).unlink()
|
||||
return pickings_to_validate.button_validate()
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
<field name="description"/>
|
||||
</p>
|
||||
<field name="show_lots" invisible="1"/>
|
||||
<field name="lot_ids" attrs="{'invisible': [('show_lots', '=', False)]}">
|
||||
<tree string="Expired Lot(s)">
|
||||
<field name="lot_ids" invisible="not show_lots">
|
||||
<list string="Expired Lot(s)">
|
||||
<field name="product_id"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
<footer>
|
||||
<button name="process"
|
||||
|
|
@ -22,13 +22,13 @@
|
|||
data-hotkey="q"
|
||||
class="btn-primary"/>
|
||||
<button name="process_no_expired"
|
||||
string="Proceed except for expired one"
|
||||
string="Proceed except expired"
|
||||
type="object"
|
||||
data-hotkey="w"
|
||||
class="btn-secondary"/>
|
||||
<button string="Discard"
|
||||
class="btn-secondary"
|
||||
special="cancel" data-hotkey="z"/>
|
||||
special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue