mirror of
https://bitbucket.org/presik/trytonpsk-sale_pos_frontend_rest.git
synced 2023-12-14 06:12:59 +01:00
Minor fix
This commit is contained in:
parent
1a70013d4d
commit
45343dcd89
31
sale.py
31
sale.py
|
@ -1,7 +1,7 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from __future__ import unicode_literals
|
||||
from datetime import date
|
||||
from datetime import date, datetime
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.model import fields
|
||||
from trytond.pyson import Eval
|
||||
|
@ -24,18 +24,22 @@ class Sale(metaclass=PoolMeta):
|
|||
consumer = fields.Many2One('party.consumer', 'Consumer')
|
||||
table_assigned = fields.Many2One('sale.shop.table', 'Table Assigned',
|
||||
domain=[
|
||||
('shop', '=', Eval('shop'))
|
||||
('shop', '=', Eval('shop')),
|
||||
])
|
||||
productions = fields.Function(fields.One2Many('production', None, 'Productions'), 'get_productions')
|
||||
delivery_time = fields.Numeric('Delivery Time (Min)', help="In Minutes")
|
||||
# kind = fields.Selection([
|
||||
# ('', ''),
|
||||
# ('delivery', 'Delivery'),
|
||||
# ('take_away', 'Take Away'),
|
||||
# ('to_table', 'To Table'),
|
||||
# ], 'Kind Order')
|
||||
# kind_string = kind.translated('kind')
|
||||
shipping_time = fields.Time('Shipping Time')
|
||||
order_status = fields.Selection([
|
||||
('', ''),
|
||||
('draft', 'Draft'),
|
||||
('commanded', 'Commanded'),
|
||||
('in_preparation', 'In Preparation'),
|
||||
('dispatched', 'Dispatched'),
|
||||
('delivered', 'Delivered'),
|
||||
('rejected', 'Rejected'),
|
||||
('cancelled', 'Cancelled'),
|
||||
], 'Order Status')
|
||||
order_status_string = order_status.translated('order_status')
|
||||
shipping_time = fields.DateTime('Shipping Time')
|
||||
waiting_time = fields.Function(fields.Integer('Shipping Time',
|
||||
help="In Minutes"), 'get_waiting_time')
|
||||
|
||||
|
@ -48,9 +52,14 @@ class Sale(metaclass=PoolMeta):
|
|||
'message_error': 'Error: %s',
|
||||
},)
|
||||
|
||||
@staticmethod
|
||||
def default_order_status():
|
||||
return 'draft'
|
||||
|
||||
def get_waiting_time(self, name=None):
|
||||
now = datetime.now()
|
||||
if self.state in ('draft', 'quotation', 'confirmed', 'processing'):
|
||||
delta = int((self.write_date - self.create_date).seconds / 60)
|
||||
delta = int((now - self.create_date).seconds / 60)
|
||||
return delta
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -9,6 +9,8 @@ copyright notices and license terms. -->
|
|||
<field name="kind"/>
|
||||
<label name="consumer"/>
|
||||
<field name="consumer"/>
|
||||
<label name="order_status"/>
|
||||
<field name="order_status"/>
|
||||
<label name="table_assigned"/>
|
||||
<field name="table_assigned" widget="selection"/>
|
||||
<label name="delivery_time"/>
|
||||
|
|
Loading…
Reference in a new issue