Cantidad de empaques al facturar
This commit is contained in:
parent
06170cb054
commit
c9f9ea526f
|
@ -23,6 +23,7 @@ import hashlib
|
|||
import io
|
||||
import json
|
||||
import locale
|
||||
import math
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
|
@ -3764,3 +3765,7 @@ def validate_rfc(value):
|
|||
def parse_xml2(xml_str):
|
||||
return etree.fromstring(xml_str.encode('utf-8'))
|
||||
|
||||
|
||||
def round_up(value):
|
||||
return int(math.ceil(value))
|
||||
|
||||
|
|
|
@ -3504,7 +3504,7 @@ class Productos(BaseModel):
|
|||
def actualizar(cls, values, id):
|
||||
values['cuenta_predial'] = values.get('cuenta_predial', '')
|
||||
values['codigo_barras'] = values.get('codigo_barras', '')
|
||||
# ~ values['cantidad_empaque'] = values.pop('cant_by_packing', 0.0)
|
||||
|
||||
fields, taxes = cls._clean(cls, values)
|
||||
obj_taxes = SATImpuestos.select().where(SATImpuestos.id.in_(taxes))
|
||||
with database_proxy.transaction():
|
||||
|
@ -4306,6 +4306,8 @@ class Facturas(BaseModel):
|
|||
tax_locales = Configuracion.get_bool('chk_config_tax_locales')
|
||||
tax_locales_truncate = Configuracion.get_bool('chk_config_tax_locales_truncate')
|
||||
tax_decimals = Configuracion.get_bool('chk_config_tax_decimals')
|
||||
use_packing = Configuracion.get_bool('chk_use_packing')
|
||||
|
||||
subtotal = 0
|
||||
descuento_cfdi = 0
|
||||
totals_tax = {}
|
||||
|
@ -4333,6 +4335,10 @@ class Facturas(BaseModel):
|
|||
precio_final = valor_unitario - descuento
|
||||
importe = round(cantidad * precio_final, DECIMALES)
|
||||
|
||||
if use_packing:
|
||||
product['empaques'] = util.round_up(
|
||||
cantidad / float(p.cantidad_empaque))
|
||||
|
||||
product['cantidad'] = cantidad
|
||||
product['valor_unitario'] = valor_unitario
|
||||
product['descuento'] = round(descuento * cantidad, DECIMALES)
|
||||
|
|
Loading…
Reference in New Issue