Commit 14547a13 authored by WhilelM's avatar WhilelM
Browse files

Utiliser nouveau nom champs facture.ref au lien de facture.facnumber

parent 5d8221d8
......@@ -60,6 +60,10 @@ class DolibarrSQLAlchemy(object):
def after40(cls):
return cls.metadata.info['dolibarr_version'] > LooseVersion("4.0")
@classmethod
def after90(cls):
return cls.metadata.info['dolibarr_version'] > LooseVersion("9.0")
class Bank(DolibarrBase):
__tablename__ = "llx_bank"
id = Column("rowid", Integer, primary_key=True)
......@@ -194,11 +198,20 @@ class DolibarrSQLAlchemy(object):
__tablename__ = "llx_paiement_facture"
fk_paiement = Column(Integer, ForeignKey('llx_paiement.rowid'), primary_key=True)
fk_facture = Column(Integer, ForeignKey('llx_facture.rowid'), primary_key=True)
facture = relationship(
"Facture",
lazy="subquery",
order_by="Facture.facnumber"
)
if DolibarrBase.after90():
facture = relationship(
"Facture",
lazy="subquery",
order_by="Facture.ref"
)
else:
facture = relationship(
"Facture",
lazy="subquery",
order_by="Facture.facnumber"
)
paiement = relationship(
"Paiement",
lazy="subquery",
......
......@@ -180,7 +180,10 @@ class HledgerBankEntry(HledgerEntry):
"|".join(f_ids),
)
if e.url_payment:
f_ids = sorted([f.facture.facnumber for f in e.url_payment.payment.factures])
if e.after90():
f_ids = sorted([f.facture.ref for f in e.url_payment.payment.factures])
else:
f_ids = sorted([f.facture.facnumber for f in e.url_payment.payment.factures])
s_description = "Règlement facture client - %s - %s" % (
s_nom,
"|".join(f_ids),
......@@ -466,10 +469,16 @@ class HledgerSellEntry(HledgerBillingEntry):
s = ""
# Date et description
s += "%(date)s %(description)s\n" % {
'date': e.datef.strftime("%Y/%m/%d"),
'description': e.facnumber + " - " + e.societe.nom,
}
if e.after90():
s += "%(date)s %(description)s\n" % {
'date': e.datef.strftime("%Y/%m/%d"),
'description': e.ref + " - " + e.societe.nom,
}
else:
s += "%(date)s %(description)s\n" % {
'date': e.datef.strftime("%Y/%m/%d"),
'description': e.facnumber + " - " + e.societe.nom,
}
# ligne pour compte client
s_code = self.get_client_code(self.e)
......@@ -532,7 +541,10 @@ class HledgerSellEntry(HledgerBillingEntry):
description = ed.description.splitlines()[0]
else:
description = ed.description
pc_missing.append("produit: %s - %s - %s" % (e.societe.nom, e.facnumber, description))
if e.after90():
pc_missing.append("produit: %s - %s - %s" % (e.societe.nom, e.ref, description))
else:
pc_missing.append("produit: %s - %s - %s" % (e.societe.nom, e.facnumber, description))
return pc_missing
......@@ -568,12 +580,20 @@ class HledgerSellEntry(HledgerBillingEntry):
total_tva -= ed.total_tva
total_ht -= ed.total_ht
if total_ttc > 1e-10:
print("Erreur dans l'écriture %s: total ttc = %s" % (e.facnumber, total_ttc))
if total_ht > 1e-10:
print("Erreur dans l'écriture %s: total ht = %s" % (e.facnumber, total_ht))
if total_tva > 1e-10:
print("Erreur dans l'écriture %s: total tva = %s" % (e.facnumber, total_tva))
if e.after90():
if total_ttc > 1e-10:
print("Erreur dans l'écriture %s: total ttc = %s" % (e.ref, total_ttc))
if total_ht > 1e-10:
print("Erreur dans l'écriture %s: total ht = %s" % (e.ref, total_ht))
if total_tva > 1e-10:
print("Erreur dans l'écriture %s: total tva = %s" % (e.ref, total_tva))
else:
if total_ttc > 1e-10:
print("Erreur dans l'écriture %s: total ttc = %s" % (e.facnumber, total_ttc))
if total_ht > 1e-10:
print("Erreur dans l'écriture %s: total ht = %s" % (e.facnumber, total_ht))
if total_tva > 1e-10:
print("Erreur dans l'écriture %s: total tva = %s" % (e.facnumber, total_tva))
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment