I have the init_sale variable but when calling a method that has nothing to do with the variable, it changes the variable value
Class Code
def get(self, nro_order):
order = Order().get_by_order(nro_order)
if order is None:
nro_order)
)
return None
init_sale = self.get_init_sale(nro_order) #this change after call calculate sale
nationalized = self.get_nationalized(order)
data = {
'init_sale': init_sale,
'nationalized': nationalized,
'sale': self.calculate_sale(init_sale, nationalized)
}
return data
def calculate_sale(self, init_sale, nationalized):
sale = init_sale
for item in sale:
for nat in nationalized:
if item['detalle_pedido_factura'] == nat['detalle_pedido_factura']:
item['nro_cajas'] -= nat['nro_cajas']
return sale
init_sale before call calculate_sale:
[{'detalle_pedido_factura': 1164, 'cod_contable': '01011080050317010750', 'nro_cajas': 1145, 'costo_caja': 18.5}]
init_sale after call calculate_sale:
[{'detalle_pedido_factura': 1164, 'cod_contable': '01011080050317010750', 'nro_cajas': 0, 'costo_caja': 18.5}]
nro_cajas value change
Thanks