Add mass cancel procurement wizard
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import wizard
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'depends': ['procurement'],
|
'depends': ['procurement'],
|
||||||
'data': [
|
'data': [
|
||||||
'procurement_view.xml',
|
'procurement_view.xml',
|
||||||
|
'wizard/procurement_mass_cancel_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
3
procurement_usability/wizard/__init__.py
Normal file
3
procurement_usability/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import procurement_mass_cancel
|
||||||
18
procurement_usability/wizard/procurement_mass_cancel.py
Normal file
18
procurement_usability/wizard/procurement_mass_cancel.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2021 Akretion France (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models
|
||||||
|
|
||||||
|
|
||||||
|
class ProcurementMassCancel(models.TransientModel):
|
||||||
|
_name = 'procurement.mass.cancel'
|
||||||
|
_description = 'Procurement Order Mass Cancel'
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
assert self.env.context.get('active_model') == 'procurement.order'
|
||||||
|
active_ids = self.env.context.get('active_ids')
|
||||||
|
assert active_ids
|
||||||
|
procs = self.env['procurement.order'].browse(active_ids)
|
||||||
|
procs.cancel() # they already do the filtered on state != done
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="procurement_mass_cancel_form" model="ir.ui.view">
|
||||||
|
<field name="model">procurement.mass.cancel</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<group name="main">
|
||||||
|
<div>This wizard will cancel the selected procurements which are not already in <i>Done</i> state.</div>
|
||||||
|
</group>
|
||||||
|
<footer>
|
||||||
|
<button type="object" name="run" string="Cancel Procurements" class="btn-primary"/>
|
||||||
|
<button special="cancel" string="Close" class="btn-default"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<act_window
|
||||||
|
id="procurement_mass_cancel_action"
|
||||||
|
name="Cancel Procurements"
|
||||||
|
res_model="procurement.mass.cancel"
|
||||||
|
src_model="procurement.order"
|
||||||
|
view_mode="form"
|
||||||
|
target="new"
|
||||||
|
multi="True"
|
||||||
|
key2="client_action_multi"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user