def _params(self): cur_p = self.old_db.open() cur_p.execute( "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_facture' and paramName in ('ModeTVA','DefaultCompteVente','compteTVAVente','CompteRemise','CompteFraisBank','CompteCaisse')") for param_name, param_value in cur_p.fetchall(): pname = '' if param_name == 'ModeTVA': pname = 'invoice-vat-mode' if param_value == '': param_value = '0' elif param_name == 'DefaultCompteVente': pname = 'invoice-default-sell-account' param_value = convert_code(param_value) elif param_name == 'compteTVAVente': pname = 'invoice-vatsell-account' param_value = convert_code(param_value) elif param_name == 'CompteRemise': pname = 'invoice-reduce-account' param_value = convert_code(param_value) elif param_name == 'CompteFraisBank': pname = 'payoff-bankcharges-account' param_value = convert_code(param_value) elif param_name == 'CompteCaisse': pname = 'payoff-cash-account' param_value = convert_code(param_value) if pname != '': self.print_debug( "=> parameter of invoice %s - %s", (pname, param_value)) Parameter.change_value(pname, param_value) Params.clear()
def _params(self): cur_p = self.old_db.open() cur_p.execute( "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_membres' and paramName in ('EquipeEnable', 'EquipeText', 'ActiviteEnable', 'ActiviteText', 'AgeEnable', 'LicenceEnabled', 'FiltreGenre', 'Numero', 'Naissance', 'compteTiersDefault', 'connexion')") for param_name, param_value in cur_p.fetchall(): pname = '' if param_name == "EquipeEnable": pname = "member-team-enable" if param_name == "EquipeText": pname = "member-team-text" if param_name == "ActiviteEnable": pname = "member-activite-enable" if param_name == "ActiviteText": pname = "member-activite-text" if param_name == "AgeEnable": pname = "member-age-enable" if param_name == "LicenceEnabled": pname = "member-licence-enabled" if param_name == "FiltreGenre": pname = "member-filter-genre" if param_name == "Numero": pname = "member-numero" if param_name == "Naissance": pname = "member-birth" if param_name == "compteTiersDefault": pname = "invoice-account-third" param_value = convert_code(param_value) if param_name == "connexion": pname = "member-connection" if pname != '': self.print_debug( "=> parameter of invoice %s - %s", (pname, param_value)) Parameter.change_value(pname, param_value) Params.clear()
def _params(self): cur_p = self.old_db.open() cur_p.execute( "SELECT paramName,value FROM CORE_extension_params WHERE extensionId LIKE 'fr_sdlibre_copropriete' and paramName in ('frequenceAppel','defautCompteCopro')") for param_name, param_value in cur_p.fetchall(): pname = '' if param_name == 'defautCompteCopro': pname = 'condominium-default-owner-account' param_value = convert_code(param_value) if pname != '': self.print_debug( "=> parameter of invoice %s - %s", (pname, param_value)) Parameter.change_value(pname, param_value) Parameter.change_value('condominium-old-accounting', True) Params.clear()
def _setowner(self): set_mdl = apps.get_model("condominium", "Set") set_mdl.objects.all().delete() self.set_list = {} owner_mdl = apps.get_model("condominium", "Owner") owner_mdl.objects.all().delete() self.owner_list = {} partition_mdl = apps.get_model("condominium", "Partition") partition_mdl.objects.all().delete() self.partition_list = {} cur_s = self.old_db.open() cur_s.execute( "SELECT id, nom,budget,imputationProduit,analytique FROM fr_sdlibre_copropriete_ensemble") for setid, nom, budget, imputation_produit, analytique in cur_s.fetchall(): self.print_debug("=> SET %s", (nom,)) self.set_list[setid] = set_mdl.objects.create( name=nom, budget=budget, revenue_account=convert_code(imputation_produit)) if analytique in self.old_db.objectlinks['costaccounting'].keys(): self.set_list[setid].cost_accounting = self.old_db.objectlinks[ 'costaccounting'][analytique] self.set_list[setid].save() cur_o = self.old_db.open() cur_o.execute( "SELECT DISTINCT tiers FROM fr_sdlibre_copropriete_partition") for tiers, in cur_o.fetchall(): if tiers in self.old_db.objectlinks['third'].keys(): self.print_debug("=> OWNER %s", (tiers,)) self.owner_list[tiers] = owner_mdl.objects.create( third=self.old_db.objectlinks['third'][tiers]) cur_p = self.old_db.open() cur_p.execute( "SELECT id, tiers,ensemble,part FROM fr_sdlibre_copropriete_partition") for partid, tiers, ensemble, part in cur_p.fetchall(): if (tiers in self.owner_list.keys()) and (ensemble in self.set_list.keys()): self.print_debug( "=> PARTITION %s,%s=>%s", (tiers, ensemble, part)) self.partition_list[partid] = partition_mdl.objects.get( set=self.set_list[ensemble], owner=self.owner_list[tiers]) self.partition_list[partid].value = part self.partition_list[partid].save() for current_set in set_mdl.objects.all(): current_set.convert_cost()
def _payoff(self): payoff_mdl = apps.get_model("payoff", "Payoff") payoff_mdl.objects.all().delete() self.payoff_list = {} bank_mdl = apps.get_model("payoff", "BankAccount") bank_mdl.objects.all().delete() self.bank_list = {} cur_b = self.old_db.open() cur_b.execute( "SELECT id, designation,etab,guichet,compte,clef,compteBank FROM fr_sdlibre_facture_compteCheque") for bankid, designation, etab, guichet, compte, clef, compteBank in cur_b.fetchall(): self.print_debug( "=> bank account:%s", (designation,)) reference = "%s %s %s %s" % (etab, guichet, compte, clef) self.bank_list[bankid] = bank_mdl.objects.create( designation=designation, reference=reference, account_code=convert_code(compteBank)) cur_p = self.old_db.open() cur_p.execute( "SELECT id, facture, date, montant, mode, reference, operation, CompteCheque, payeur FROM fr_sdlibre_facture_payement") for payoffid, facture, date, montant, mode, reference, operation, compte_cheque, payeur in cur_p.fetchall(): if facture in self.bill_list.keys(): self.print_debug( "=> payoff bill:%s - date=%s - amount=%.2f", (facture, date, montant)) if mode is None: mode = 4 self.payoff_list[payoffid] = payoff_mdl.objects.create(supporting=self.bill_list[facture], date=date, amount=montant, mode=mode, reference=reference, payer=payeur) if operation in self.old_db.objectlinks['entryaccount'].keys(): self.payoff_list[payoffid].entry = self.old_db.objectlinks[ 'entryaccount'][operation] if compte_cheque in self.bank_list.keys(): self.payoff_list[payoffid].bank_account = self.bank_list[ compte_cheque] self.payoff_list[payoffid].save( do_generate=False, do_linking=False)
def _article(self): article_mdl = apps.get_model("invoice", "Article") article_mdl.objects.all().delete() self.article_list = {} cur_a = self.old_db.open() cur_a.execute( "SELECT id,reference,designation,prix,unit,compteVente,tva,noactive FROM fr_sdlibre_facture_articles") for articleid, reference, designation, prix, unit, compteVente, tva, noactive in cur_a.fetchall(): if unit == 'NULL': unit = '' self.print_debug("=> article %s - %s %s", (reference, prix, unit)) self.article_list[articleid] = article_mdl.objects.create( reference=reference, designation=designation, price=prix, unit=unit, sell_account=convert_code(compteVente), isdisabled=noactive == 'o') if tva != 0: self.article_list[articleid].vat = self.vat_list[tva] self.article_list[articleid].save()