-
-
Notifications
You must be signed in to change notification settings - Fork 341
/
manifest_wizard.py
42 lines (37 loc) · 1.47 KB
/
manifest_wizard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
# Copyright 2015 FactorLibre (http://www.factorlibre.com)
# Ismael Calvo <ismael.calvo@factorlibre.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, exceptions, _
class ManifestWizard(models.TransientModel):
_name = 'manifest.wizard'
_description = 'Delivery carrier manifest wizard'
@api.model
def _get_carrier_type_selection(self):
carrier_obj = self.env['delivery.carrier']
return carrier_obj._get_carrier_type_selection()
carrier_id = fields.Many2one(
comodel_name='delivery.carrier',
string='Carrier',
states={'done': [('readonly', True)]},
required=True
)
carrier_type = fields.Selection(
selection='_get_carrier_type_selection',
related='carrier_id.carrier_type',
string='Carrier Type',
readonly=True,
)
from_date = fields.Datetime('From Date', required=True)
to_date = fields.Datetime('To Date')
file_out = fields.Binary('Manifest', readonly=True)
filename = fields.Char('File Name', readonly=True)
notes = fields.Text('Result', readonly=True)
state = fields.Selection([
('init', 'Init'),
('file', 'File'),
('end', 'END')
], readonly=True, default='init')
def get_manifest_file(self):
raise exceptions.Warning(_("Manifest not implemented for '%s' "
"carrier type.") % self.carrier_type)