Feat(WIP): Impresion de Lineas Eliminadas
This commit is contained in:
parent
798a25683c
commit
0b49554eb5
16
sale.py
16
sale.py
@ -203,6 +203,11 @@ class Sale(metaclass=PoolMeta):
|
|||||||
"quantity": line.quantity if line.type != 'title' else None,
|
"quantity": line.quantity if line.type != 'title' else None,
|
||||||
"uom": line.unit.name if line.type != 'title' else None}
|
"uom": line.unit.name if line.type != 'title' else None}
|
||||||
for line in report.lines if not line.impreso]
|
for line in report.lines if not line.impreso]
|
||||||
|
data["deleted_lines"] = [{
|
||||||
|
"product": line.product.name,
|
||||||
|
"quantity": str(-1 * line.quantity),
|
||||||
|
"unit": line.unit.symbol,
|
||||||
|
} for line in report.delete_lines if not line.printed]
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -225,6 +230,10 @@ class Sale(metaclass=PoolMeta):
|
|||||||
line.analytic_accounts = tuple()
|
line.analytic_accounts = tuple()
|
||||||
line.impreso = True
|
line.impreso = True
|
||||||
line.save()
|
line.save()
|
||||||
|
|
||||||
|
for line in record.delete_lines:
|
||||||
|
line.printed = True
|
||||||
|
line.save()
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -269,7 +278,7 @@ class Sale(metaclass=PoolMeta):
|
|||||||
headers = {"accept": 'application/json',
|
headers = {"accept": 'application/json',
|
||||||
'Content-Type': 'application/json'}
|
'Content-Type': 'application/json'}
|
||||||
requests.post(
|
requests.post(
|
||||||
url, data=json.dumps(content), headers=headers)
|
url, data=json.dumps(content), headers=headers, timeout=5)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@ -313,8 +322,9 @@ class Sale(metaclass=PoolMeta):
|
|||||||
'Content-Type': 'application/json'}
|
'Content-Type': 'application/json'}
|
||||||
cls.impreso([record])
|
cls.impreso([record])
|
||||||
|
|
||||||
requests.post(url, data=json.dumps(content),
|
requests.post(
|
||||||
headers=headers)
|
url, data=json.dumps(content),
|
||||||
|
headers=headers, timeout=5)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
Loading…
Reference in New Issue
Block a user