~georgeyk/stoqlib/ideale-henrique

« back to all changes in this revision

Viewing changes to stoqlib/domain/production.py

  • Committer: george
  • Date: 2009-07-16 20:32:02 UTC
  • Revision ID: vcs-imports@canonical.com-20090716203202-delqaizol7x2p4ds
#3603: Implementar esqueleto inicial da aplicacao de producao. (stoqlib)
r=romaia

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# vi:si:et:sw=4:sts=4:ts=4
 
3
 
 
4
##
 
5
## Copyright (C) 2009 Async Open Source <http://www.async.com.br>
 
6
## All rights reserved
 
7
##
 
8
## This program is free software; you can redistribute it and/or modify
 
9
## it under the terms of the GNU Lesser General Public License as published by
 
10
## the Free Software Foundation; either version 2 of the License, or
 
11
## (at your option) any later version.
 
12
##
 
13
## This program is distributed in the hope that it will be useful,
 
14
## but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
## GNU Lesser General Public License for more details.
 
17
##
 
18
## You should have received a copy of the GNU Lesser General Public License
 
19
## along with this program; if not, write to the Free Software
 
20
## Foundation, Inc., or visit: http://www.gnu.org/.
 
21
##
 
22
## Author(s):   George Y. Kussumoto         <george@async.com.br>
 
23
##
 
24
""" Base classes to manage production informations """
 
25
 
 
26
import datetime
 
27
from decimal import Decimal
 
28
 
 
29
from zope.interface import implements
 
30
 
 
31
from stoqlib.database.orm import UnicodeCol, ForeignKey, DateTimeCol, IntCol
 
32
from stoqlib.domain.base import Domain
 
33
from stoqlib.domain.interfaces import IContainer, IDescribable
 
34
from stoqlib.lib.translation import stoqlib_gettext
 
35
 
 
36
_ = stoqlib_gettext
 
37
 
 
38
 
 
39
class ProductionOrder(Domain):
 
40
    """Production Order object implementation.
 
41
 
 
42
    @cvar ORDER_OPENED: The production order is opened, production items might
 
43
                        have been added.
 
44
    @cvar ORDER_WAITING: The production order is waiting some conditions to
 
45
                         start the manufacturing process.
 
46
    @cvar ORDER_PRODUCTION: The production order have already started.
 
47
    @cvar ORDER_CLOSED: The production have finished.
 
48
 
 
49
    @ivar status: the production order status
 
50
    @ivar open_date: the date when the production order was created
 
51
    @ivar close_date: the date when the production order have been closed
 
52
    @ivar description: the production order description
 
53
    @ivar responsible: the person responsible for the production order
 
54
    """
 
55
    implements(IContainer, IDescribable)
 
56
 
 
57
    (ORDER_OPENED,
 
58
     ORDER_WAITING,
 
59
     ORDER_PRODUCING,
 
60
     ORDER_CLOSED) = range(4)
 
61
 
 
62
    statuses = {ORDER_OPENED:         _(u'Opened'),
 
63
                ORDER_WAITING:        _(u'Waiting'),
 
64
                ORDER_PRODUCING:      _(u'Producing'),
 
65
                ORDER_CLOSED:         _(u'Closed')}
 
66
 
 
67
    status = IntCol(default=ORDER_OPENED)
 
68
    open_date = DateTimeCol(default=datetime.datetime.now)
 
69
    close_date = DateTimeCol(default=None)
 
70
    description = UnicodeCol(default='')
 
71
    responsible = ForeignKey('PersonAdaptToEmployee')
 
72
    branch = ForeignKey('PersonAdaptToBranch')
 
73
 
 
74
    #
 
75
    # IContainer implmentation
 
76
    #
 
77
 
 
78
    #TODO: when implement ProductionItem.
 
79
 
 
80
    def get_items(self):
 
81
        return []
 
82
 
 
83
    def add_item(self, sellable, quantity=Decimal(1)):
 
84
        return
 
85
 
 
86
    def remove_item(self, item):
 
87
        return
 
88
 
 
89
    #
 
90
    # IDescribable implementation
 
91
    #
 
92
 
 
93
    def get_description(self):
 
94
        return self.description