[IMP] stock,purchase_requisiton: remove some warning messages

This commit removes some warning messages displayed in some wizard and
removes the fields used to display or not those warning
messages.

task-3356114

closes odoo/odoo#124820

Related: odoo/upgrade#4899
Related: odoo/enterprise#42472
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Xavier Bol (xbo)
2023-10-10 12:34:56 +00:00
parent e3bc974ea4
commit 6d195397e4
6 changed files with 3 additions and 24 deletions
@@ -224,7 +224,8 @@ class TestPurchaseRequisition(TestPurchaseRequisitionCommon):
action = orig_po.button_confirm()
warning_wiz = Form(self.env['purchase.requisition.alternative.warning'].with_context(**action['context']))
warning_wiz = warning_wiz.save()
self.assertEqual(warning_wiz.alternative_po_count, 1, "POs not in a RFQ status should not be listed as possible to cancel")
self.assertEqual(len(warning_wiz.alternative_po_ids), 1,
"POs not in a RFQ status should not be listed as possible to cancel")
warning_wiz.action_cancel_alternatives()
self.assertEqual(alt_po_1.state, 'cancel', "Alternative PO should have been cancelled")
self.assertEqual(orig_po.state, 'purchase', "Original PO should have been confirmed")
@@ -10,12 +10,6 @@ class PurchaseRequisitionAlternativeWarning(models.TransientModel):
po_ids = fields.Many2many('purchase.order', 'warning_purchase_order_rel', string="POs to Confirm")
alternative_po_ids = fields.Many2many('purchase.order', 'warning_purchase_order_alternative_rel', string="Alternative POs")
alternative_po_count = fields.Integer(compute="_compute_alternative_po_count")
@api.depends("alternative_po_ids")
def _compute_alternative_po_count(self):
for wizard in self:
wizard.alternative_po_count = len(wizard.alternative_po_ids)
def action_keep_alternatives(self):
return self._action_done()
@@ -6,10 +6,6 @@
<field name="model">purchase.requisition.alternative.warning</field>
<field name="arch" type="xml">
<form string="Alternative Warning">
<div>
<field name="alternative_po_count"/>
alternative requests for quotation are still open, do you want to cancel them?
</div>
<field name="alternative_po_ids" nolabel="1" readonly="1">
<tree create="0" delete="0" edit="0">
<field name="currency_id" column_invisible="1"/>
@@ -240,7 +240,7 @@ class TestPurchaseRequisitionStock(TestPurchaseRequisitionCommon):
warning_wiz = Form(
self.env['purchase.requisition.alternative.warning'].with_context(**action['context']))
warning_wiz = warning_wiz.save()
self.assertEqual(warning_wiz.alternative_po_count, 1,
self.assertEqual(len(warning_wiz.alternative_po_ids), 1,
"POs not in a RFQ status should not be listed as possible to cancel")
warning_wiz.action_cancel_alternatives()
self.assertEqual(orig_po.state, 'cancel', "Original PO should have been cancelled")
@@ -8,16 +8,8 @@ class StockInventoryAdjustmentName(models.TransientModel):
_name = 'stock.inventory.adjustment.name'
_description = 'Inventory Adjustment Reference / Reason'
def default_get(self, fields_list):
res = super().default_get(fields_list)
if self.env.context.get('default_quant_ids'):
quants = self.env['stock.quant'].browse(self.env.context['default_quant_ids'])
res['show_info'] = any(not quant.inventory_quantity_set for quant in quants)
return res
quant_ids = fields.Many2many('stock.quant')
inventory_adjustment_name = fields.Char(default="Quantity Updated", string="Inventory Reason")
show_info = fields.Boolean('Show warning')
def action_apply(self):
quants = self.quant_ids.filtered('inventory_quantity_set')
@@ -7,12 +7,8 @@
<field name="arch" type="xml">
<form>
<div>
<div invisible="not show_info">
Some selected lines don't have any quantities set, they will be ignored.
</div>
<group>
<field name="inventory_adjustment_name"/>
<field name="show_info" invisible="1"/>
</group>
</div>
<footer>