From 957965bab37cb0a52b436d2505c95579ed858026 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Mon, 24 Jul 2017 22:22:31 +0200 Subject: [PATCH] [ADD] extension wizard + [CLEAN] Abstract class for all wizard related to action on the cooperative status --- beesdoo_shift/__openerp__.py | 1 + beesdoo_shift/models/cooperative_status.py | 17 ++++++++++ beesdoo_shift/views/cooperative_status.xml | 9 +++++- beesdoo_shift/wizard/__init__.py | 3 +- beesdoo_shift/wizard/extension.py | 37 ++++++++++++++++++++++ beesdoo_shift/wizard/extension.xml | 26 +++++++++++++++ beesdoo_shift/wizard/subscribe.py | 32 +++++++++++-------- 7 files changed, 110 insertions(+), 15 deletions(-) create mode 100644 beesdoo_shift/wizard/extension.py create mode 100644 beesdoo_shift/wizard/extension.xml diff --git a/beesdoo_shift/__openerp__.py b/beesdoo_shift/__openerp__.py index ba56969..dc23e2e 100644 --- a/beesdoo_shift/__openerp__.py +++ b/beesdoo_shift/__openerp__.py @@ -32,5 +32,6 @@ "wizard/batch_template.xml", "wizard/assign_super_coop.xml", "wizard/subscribe.xml", + "wizard/extension.xml", ], } diff --git a/beesdoo_shift/models/cooperative_status.py b/beesdoo_shift/models/cooperative_status.py index e8aea50..8256a99 100644 --- a/beesdoo_shift/models/cooperative_status.py +++ b/beesdoo_shift/models/cooperative_status.py @@ -208,5 +208,22 @@ class ResPartner(models.Model): res['context'] = {'default_unsubscribed': True} return res + @api.multi + def manual_extension(self): + return { + 'name': _('Manual Extension'), + 'type': 'ir.actions.act_window', + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'beesdoo.shift.extension', + 'target': 'new', + } + + @api.multi + def auto_extension(self): + res = self.manual_extension() + res['context'] = {'default_auto': True} + res['name'] = _('Trigger Grace Delay') + return res #TODO access right + vue on res.partner #TODO can_shop : Status can_shop ou extempted ou part C diff --git a/beesdoo_shift/views/cooperative_status.xml b/beesdoo_shift/views/cooperative_status.xml index 91c1dd5..b650073 100644 --- a/beesdoo_shift/views/cooperative_status.xml +++ b/beesdoo_shift/views/cooperative_status.xml @@ -15,7 +15,14 @@ ('cooperator_type', '!=', 'share_a'), '|', ('state', '!=', 'suspended'), - ('extension_start_time', '!=', False)]}"/> + ('extension_start_time', '!=', False)]}" /> +