1
# -*- coding: utf-8 -*-
2
# vi:si:et:sw=4:sts=4:ts=4
5
## Copyright (C) 2009 Async Open Source <http://www.async.com.br>
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.
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.
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/.
22
## Author(s): George Y. Kussumoto <george@async.com.br>
24
""" Base classes to manage production informations """
27
from decimal import Decimal
29
from zope.interface import implements
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
39
class ProductionOrder(Domain):
40
"""Production Order object implementation.
42
@cvar ORDER_OPENED: The production order is opened, production items might
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.
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
55
implements(IContainer, IDescribable)
60
ORDER_CLOSED) = range(4)
62
statuses = {ORDER_OPENED: _(u'Opened'),
63
ORDER_WAITING: _(u'Waiting'),
64
ORDER_PRODUCING: _(u'Producing'),
65
ORDER_CLOSED: _(u'Closed')}
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')
75
# IContainer implmentation
78
#TODO: when implement ProductionItem.
83
def add_item(self, sellable, quantity=Decimal(1)):
86
def remove_item(self, item):
90
# IDescribable implementation
93
def get_description(self):
94
return self.description