minor fix
This commit is contained in:
parent
6dd9b772c8
commit
7b9cf1f7b0
18
sale.py
18
sale.py
|
@ -30,6 +30,7 @@ class Sale(metaclass=PoolMeta):
|
|||
delivery_time = fields.Numeric('Delivery Time (Min)', help="In Minutes")
|
||||
delivery_way = fields.Selection(DELIVERY_WAY, 'Delivery Way')
|
||||
shipping_time = fields.Time('Shipping Time')
|
||||
consumer = fields.Many2One('party.consumer', 'Consumer')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -202,20 +203,31 @@ class Sale(metaclass=PoolMeta):
|
|||
consumer = Consumer(id)
|
||||
for key, value in fields.items():
|
||||
Consumer.write([consumer], {key: value})
|
||||
return {'msg': 'ok'}
|
||||
return cls._get_object(consumer)
|
||||
|
||||
@classmethod
|
||||
def create_consumer(cls, args, context):
|
||||
Consumer = Pool().get('party.consumer')
|
||||
consumer = None
|
||||
if args.get('fields'):
|
||||
print(args)
|
||||
consumer, = Consumer.create([args['fields']])
|
||||
if consumer:
|
||||
return {'msg': 'ok'}
|
||||
return cls._get_object(consumer)
|
||||
else:
|
||||
return {'msg': 'error'}
|
||||
|
||||
@classmethod
|
||||
def _get_object(cls, consumer):
|
||||
obj_ = {
|
||||
'party': None,
|
||||
'consumer': consumer.id,
|
||||
'msg': 'ok'
|
||||
}
|
||||
if consumer.party:
|
||||
obj_['party'] = consumer.party.id
|
||||
return obj_
|
||||
|
||||
|
||||
@classmethod
|
||||
def _create_productions(cls, lines):
|
||||
pool = Pool()
|
||||
|
|
|
@ -16,4 +16,9 @@ copyright notices and license terms. -->
|
|||
<label name="shipping_time"/>
|
||||
<field name="shipping_time"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='info']/field[@name='comment']"
|
||||
position="after">
|
||||
<label name="consumer"/>
|
||||
<field name="consumer"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue