mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-23 15:52:08 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class SnailmailConfirm(models.AbstractModel):
|
||||
_name = 'snailmail.confirm'
|
||||
_description = 'Snailmail Confirm'
|
||||
|
||||
model_name = fields.Char()
|
||||
|
||||
@api.model
|
||||
def show_warning(self):
|
||||
return not self.env['ir.config_parameter'].sudo().get_param('%s.warning_shown' % self._name, False)
|
||||
|
||||
def action_open(self):
|
||||
view = self.env.ref('snailmail.snailmail_confirm_view')
|
||||
return {
|
||||
'name': _('Snailmail'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': self._name,
|
||||
'views': [(view.id, 'form')],
|
||||
'view_id': view.id,
|
||||
'target': 'new',
|
||||
'res_id': self.id,
|
||||
'context': self.env.context
|
||||
}
|
||||
|
||||
def action_confirm(self):
|
||||
self.env['ir.config_parameter'].sudo().set_param('%s.warning_shown' % self._name, True)
|
||||
self._confirm()
|
||||
return self._continue()
|
||||
|
||||
def action_cancel(self):
|
||||
self.env['ir.config_parameter'].sudo().set_param('%s.warning_shown' % self._name, True)
|
||||
return self._continue()
|
||||
|
||||
"""
|
||||
Called whether the user confirms or cancels posting the letter, e.g. to continue the action
|
||||
"""
|
||||
def _continue(self):
|
||||
pass
|
||||
|
||||
"""
|
||||
Called only when the user confirms sending the letter
|
||||
"""
|
||||
def _confirm(self):
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue