Commit e3a11cec authored by WhilelM's avatar WhilelM
Browse files

éclaircissement nom variable Tiers

parent 778effc8
......@@ -122,47 +122,47 @@ class HledgerBankEntry(HledgerEntry):
entries = dolibarr_alchemy.session.query(Bank).order_by(Bank.datev, Bank.num_releve).all()
return [cls(dolibarr_alchemy, e) for e in entries]
# get_third_code: retrieve the third code corresponding to the entry. It could be
# get_thirdparty_code: retrieve the third party code corresponding to the entry. It could be
# a supplier payment
# a tax payment
# a customer payment
# a value-added tax payment
# any payment defined in the function PC_REFS['fn_custom_codes']
@classmethod
def get_third_code(cls, e):
third_code = ""
def get_thirdparty_code(cls, e):
thirdparty_code = ""
if e.url_payment_supplier:
if e.url_company:
third_code = e.url_company.societe.code_compta_fournisseur
thirdparty_code = e.url_company.societe.code_compta_fournisseur
if e.url_payment_sc:
code = e.url_payment_sc.payment_sc.cotisation_sociale.type.code
if code in settings.get('SOCIAL_REFS'):
third_code = settings.get('SOCIAL_REFS')[code]
thirdparty_code = settings.get('SOCIAL_REFS')[code]
if e.url_payment:
if e.url_company:
third_code = e.url_company.societe.code_compta
thirdparty_code = e.url_company.societe.code_compta
if e.payment_tva:
third_code = settings.get('PC_REFS')['tva_a_decaisser']
thirdparty_code = settings.get('PC_REFS')['tva_a_decaisser']
if third_code == "":
if thirdparty_code == "":
fns = settings.get('PC_REFS')['fn_custom_codes']
for fn in fns:
try:
third_code = fn(e)
if third_code is None or not isinstance(third_code, basestring):
third_code = ""
thirdparty_code = fn(e)
if thirdparty_code is None or not isinstance(thirdparty_code, basestring):
thirdparty_code = ""
except:
third_code = ""
if third_code != "":
thirdparty_code = ""
if thirdparty_code != "":
break
if third_code == "":
third_code = cls.pc_default_tier
if thirdparty_code == "":
thirdparty_code = cls.pc_default_tier
return third_code
return thirdparty_code
# get_description: retrieve the description of the payment
@classmethod
......@@ -203,7 +203,7 @@ class HledgerBankEntry(HledgerEntry):
'description': s_description
}
third_code = self.get_third_code(self.e)
thirdparty_code = self.get_thirdparty_code(self.e)
ba_code = e.account.account_number
if ba_code == "":
......@@ -214,7 +214,7 @@ class HledgerBankEntry(HledgerEntry):
'amount': self._value(-e.amount)
}
s += " %(account)s \t %(amount)s\n" % {
'account': settings.get_ledger_account(third_code),
'account': settings.get_ledger_account(thirdparty_code),
'amount': self._value(e.amount)
}
if self.tva_type != 'none':
......@@ -592,15 +592,15 @@ class HledgerSocialEntry(HledgerEntry):
entries = dolibarr_alchemy.session.query(CotisationsSociales).order_by(CotisationsSociales.date_ech).all()
return [cls(dolibarr_alchemy, e) for e in entries]
# get_third_code: return the third accounting code for this entry
# get_thirdparty_code: return the third party accounting code for this entry
@classmethod
def get_third_code(cls, e):
third_code = ""
def get_thirdparty_code(cls, e):
thirdparty_code = ""
if e.type.code in settings.get('SOCIAL_REFS'):
third_code = settings.get('SOCIAL_REFS')[e.type.code]
if third_code == "":
third_code = cls.pc_default_supplier
return third_code
thirdparty_code = settings.get('SOCIAL_REFS')[e.type.code]
if thirdparty_code == "":
thirdparty_code = cls.pc_default_supplier
return thirdparty_code
# get_social_code: return the social accounting code for this entry
@classmethod
......@@ -619,7 +619,7 @@ class HledgerSocialEntry(HledgerEntry):
if self.get_social_code(self.e) == self.pc_default_expense:
pc_missing.append("expenses: %s" % (e.libelle))
if self.get_third_code(self.e) == self.pc_default_supplier:
if self.get_thirdparty_code(self.e) == self.pc_default_supplier:
pc_missing.append("tiers: %s (%s)" % (e.libelle, e.type.code))
return pc_missing
......@@ -635,11 +635,11 @@ class HledgerSocialEntry(HledgerEntry):
'description': e.libelle + " - " + e.type.libelle
}
third_code = self.get_third_code(self.e)
thirdparty_code = self.get_thirdparty_code(self.e)
s_code = self.get_social_code(self.e)
s += " %(account)s \t %(amount)s\n" % {
'account': settings.get_ledger_account(third_code),
'account': settings.get_ledger_account(thirdparty_code),
'amount': self._value(e.amount)
}
......
Supports Markdown
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