|
|
@ -11,7 +11,7 @@ class PosOrderLine(models.Model): |
|
|
|
# ------------------------------------------------------ |
|
|
|
# Fields declaration |
|
|
|
# ------------------------------------------------------ |
|
|
|
|
|
|
|
caisse_id = fields.Char('Id de la caisse') |
|
|
|
# ------------------------------------------------------ |
|
|
|
# SQL Constraints |
|
|
|
# ------------------------------------------------------ |
|
|
@ -34,13 +34,18 @@ class PosOrderLine(models.Model): |
|
|
|
@api.model |
|
|
|
def create(self, values): |
|
|
|
res = super(PosOrderLine, self).create(values) |
|
|
|
if not res.order_id.config_id.is_balance_free: |
|
|
|
if res.container_id: |
|
|
|
today = datetime.today().isoformat('T')[:19] |
|
|
|
|
|
|
|
weight_str = str(int(res.qty * 1000)) |
|
|
|
# weight_str = str(res.qty * 1000).zfill(5) |
|
|
|
|
|
|
|
if res.product_id.default_code: |
|
|
|
prod = (res.product_id.default_code).zfill(5) |
|
|
|
else: |
|
|
|
prod = "12345" |
|
|
|
|
|
|
|
ean13 = "26" + prod + weight_str.zfill(5) + "4" |
|
|
|
|
|
|
|
weight_brut_str = str(int((res.container_weight + res.qty) * 1000)) |
|
|
@ -70,6 +75,7 @@ class PosOrderLine(models.Model): |
|
|
|
"ean13": ean13_digit, |
|
|
|
"ean13_verif": ean13_verif_digit, |
|
|
|
"is_pos": True, |
|
|
|
"balance_id": res.caisse_id |
|
|
|
} |
|
|
|
self.env['pos.transaction'].create(vals) |
|
|
|
return res |
|
|
|