minor fix

This commit is contained in:
Wilson Gomez 2023-08-28 15:42:05 -05:00
parent 3150b5e2dd
commit 7dc4cdaef1
1 changed files with 5 additions and 23 deletions

28
sale.py
View File

@ -39,7 +39,7 @@ class Sale(metaclass=PoolMeta):
cls.write(records, args)
res = {
'record': {'id': args['id']},
'msg': f'Pedido Actualizado!!!',
'msg': 'Pedido Actualizado!!!',
'type': 'success',
}
return res
@ -95,20 +95,20 @@ class Sale(metaclass=PoolMeta):
try:
price_list = args['price_list']['id']
except:
except Exception:
price_list = args.get('price_list', None)
try:
# option kid
party, = Party.browse([args['party']['id']])
except:
except Exception:
# option fastkid
party, = Party.browse([args['party']])
if args.get('shipment_address'):
try:
# option kid
shipment_address_id = args.get('shipment_address')['id']
except:
except Exception:
# option fastkid
shipment_address_id = args.get('shipment_address')
else:
@ -119,7 +119,7 @@ class Sale(metaclass=PoolMeta):
try:
# option kid
agent_id = args['agent']['id']
except:
except Exception:
# option fastkid
agent_id = args['agent']
@ -494,24 +494,6 @@ class Sale(metaclass=PoolMeta):
}
return res
@classmethod
def mark_commanded(cls, args):
"""
This method mark as commanded all products in sale, previous
positive response of local printer
"""
sale = cls(args['sale_id'])
# if sale.state == 'draft':
# sale.quote([sale])
sale.order_status = 'commanded'
if sale.order_status_time:
sale.order_status_time.commanded = datetime.now()
sale.order_status_time.save()
sale.save()
for line in sale.lines:
line.order_sended = True
line.save()
@classmethod
def _set_line(cls, val, context):
del val['id']