def objects(): #~ yield organisationType('Firma','Firma') #~ yield organisationType('asbl','asbl') #~ yield organisationType('A.S.B.L.','A.S.B.L.') #~ yield organisationType('sprl','sprl') #~ yield organisationType('GmbH','GmbH') #~ yield organisationType('AG','AG') #~ yield organisationType('S.A.','S.A.') #~ yield organisationType('S.C.','S.C.') #~ yield organisationType('V.o.G.','V.o.G.') #~ yield organisationType('G.o.E.','G.o.E.') #~ yield organisationType('A.S.B.L.','Association sans but lucratif') #~ yield organisationType('Maison','Maison') #~ yield organisationType('Fachklinik','Fachklinik') #~ yield organisationType("Centre d'Accueil d'Urgence","Centre d'Accueil d'Urgence") #~ yield organisationType(**babel_values('name', #~ en=u"Public Limited Company", #~ nl=u'NV (Naamloze Vennootschap)', #~ fr=u'SA (Société Anonyme)', #~ de=u"AG (Aktiengesellschaft)")) for ct in COMPANY_TYPES: yield organisationType(**ct) yield roletype(**babel_values('name', en="Manager", fr=u'Gérant', de=u"Geschäftsführer", et=u"Manager")) yield roletype(**babel_values('name', en="Director", fr=u'Directeur', de=u"Direktor", et=u"Direktor")) yield roletype(**babel_values('name', en="Secretary", fr=u'Sécrétaire', de=u"Sekretär", et=u"Sekretär")) yield roletype(**babel_values('name', en="IT Manager", fr=u'Gérant informatique', de=u"EDV-Manager", et=u"IT manager")) I = Instantiator('system.HelpText', 'content_type field help_text').build Person = resolve_model("partners.Person") t = ContentType.objects.get_for_model(Person)
def C(en, de, fr='', nl='', jargon=None, obsoletes=None, **kw): texts = dict(en=en, de=de, fr=fr, nl=nl) name = dict() abbr = dict() for lang in 'en', 'de', 'fr', 'nl': t = texts.get(lang) if t: mo = abbrRE.match(t) if mo: abbr[lang] = mo.group(1).strip() name[lang] = mo.group(2).strip() else: name[lang] = t kw.update(dbutils.babel_values('name', **name)) kw.update(dbutils.babel_values('abbr', **abbr)) obj = Concept(**kw) yield obj if obsoletes is not None: if isinstance(obsoletes, dd.Model): obsoletes = [obsoletes] for obsoleted in obsoletes: yield Link(parent=obsoleted, child=obj, type=LinkTypes.obsoletes) if jargon is not None: if isinstance(jargon, dd.Model): jargon = [jargon] for domain in jargon: yield Link(parent=domain, child=obj, type=LinkTypes.jargon)
def objects(): ptype = Instantiator('properties.PropType').build division = ptype(**babel_values('name',**dict(en="Division",fr="Division",de=u"Abteilung"))) yield division divchoice = Instantiator('properties.PropChoice','value',type=division).build yield divchoice('1',**babel_values('text',**dict(en="Furniture",de=u"Möbel",fr=u"Meubles"))) yield divchoice('2',**babel_values('text',**dict(en="Web hosting",de=u"Hosting",fr=u"Hosting")))
def objects(): Person = resolve_model("contacts.Person") Company = resolve_model("contacts.Company") if not isinstance(Company,UnresolvedModel): roletype = Instantiator('links.LinkType', a_type=ContentType.objects.get_for_model(Company), b_type=ContentType.objects.get_for_model(Person) ).build yield roletype(**babel_values('name',en="Manager",fr=u'Gérant',de=u"Geschäftsführer",et=u"Manager")) yield roletype(**babel_values('name',en="Director",fr=u'Directeur',de=u"Direktor",et=u"Direktor")) yield roletype(**babel_values('name',en="Secretary",fr=u'Sécrétaire',de=u"Sekretär",et=u"Sekretär")) yield roletype(**babel_values('name',en="IT Manager",fr=u'Gérant informatique',de=u"EDV-Manager",et=u"IT manager"))
def objects(): mailType = Instantiator('notes.NoteType').build yield mailType(**babel_values('name', en="Enrolment", fr=u'Inscription',de=u"Einschreibeformular")) yield mailType(**babel_values('name', en="Timetable", fr=u'Horaire',de=u"Stundenplan")) yield mailType(**babel_values('name', en="Letter", fr=u'Lettre',de=u"Brief"))
def objects(): yield sales.InvoicingMode(**babel_values('name',en='Default',de=u"Standard",fr=u"Standard")) if ledger: Invoice = dd.resolve_model('sales.Invoice') InvoiceItem = dd.resolve_model('sales.InvoiceItem') vt = ledger.VoucherTypes.get_for_model(Invoice) JOURNALS = Cycler(vt.get_journals()) PARTNERS = Cycler(Partner.objects.all()) USERS = Cycler(settings.SITE.user_model.objects.all()) PRODUCTS = Cycler(products.Product.objects.all()) ITEMCOUNT = Cycler(1,2,3) for i in range(20): jnl = JOURNALS.pop() invoice = Invoice(journal=jnl, partner=PARTNERS.pop(), user=USERS.pop(), date=settings.SITE.demo_date(-30+2*i)) yield invoice for j in range(ITEMCOUNT.pop()): item = InvoiceItem(voucher=invoice, #~ account=jnl.get_allowed_accounts()[0], product=PRODUCTS.pop(), ) item.product_changed(REQUEST) item.before_ui_save(REQUEST) #~ if item.total_incl: #~ print "20121208 ok", item #~ else: #~ if item.product.price: #~ raise Exception("20121208") yield item invoice.register(REQUEST) invoice.save()
def Account(ref, type, fr, de, en, **kw): kw.update(babel_values('name', de=de, fr=fr, en=en)) return accounts.Account( chart=chart, group=current_group, ref=ref, type=accounts.AccountTypes.get_by_name(type), **kw)
def Group(ref, type, fr, de, en): global current_group current_group = accounts.Group( chart=chart, ref=ref, account_type=accounts.AccountTypes.get_by_name(type), **babel_values('name', de=de, fr=fr, en=en)) return current_group
def objects(): ptype = Instantiator('properties.PropType').build yield ptype(id=1, **babel_values('name', **dict( en="Present or not", de=u"Vorhanden oder nicht", fr=u"Présent ou pas", et=u"Olemas või mitte", nl=u"Ja of niet", ))) yield ptype(id=2, choicelist=properties.HowWell.actor_id, default_value=properties.HowWell.default.value, **babel_values('name', **dict( en="Rating", de=u"Bewertung", et=u"Hinnang", fr=u"Appréciation(?)", nl=u"Hoe goed", )))
def objects(): if False and notes: NoteType = dd.resolve_model('notes.NoteType') yield NoteType( template="Letter.odt", build_method="appyodt", body_template="payment_reminder.body.html", **babel_values('name', en="Payment reminder", fr="Rappel de paiement", de="Zahlungserinnerung"))
def objects(): n = 0 for code, kw in LANGUAGES.items(): iso2 = kw['iso2'] kw = babel_values('name', **kw) if kw.get('name'): n += 1 kw.update(iso2=iso2) yield Language(id=code, **kw) else: logger.debug("%r : no name for default site language %s", code, settings.SITE.DEFAULT_LANGUAGE.django_code)
def objects(): Language = Instantiator('languages.Language', "id").build yield Language('ger', **babel_values('name', de=u"Deutsch", fr=u'Allemand', en=u'German', nl=u'Duits', et=u'Saksa', )) yield Language('fre', **babel_values('name', de=u"Französisch", fr=u'Français', en=u'French', nl=u'Frans', et=u'Prantsuse', )) yield Language('eng', **babel_values('name', de=u"Englisch", fr=u'Anglais', en=u'English', nl=u'Engels', et=u'Inglise', )) yield Language('dut', **babel_values('name', de=u"Niederländisch", fr=u'Néerlandais', en=u'Dutch', nl=u'Nederlands', et=u'Hollandi', )) yield Language('est', **babel_values('name', de=u"Estnisch", fr=u'Estonien', en=u'Estonian', et=u'Eesti', ))
def objects(): n = 0 Country = settings.SITE.modules.countries.Country """ """ fn = os.path.join(os.path.dirname(__file__), 'countries.xml') logger.debug("Reading %s", fn) dom = minidom.parse(fn) #~ print dom.documentElement.__class__ #~ print dom.documentElement for coun in dom.documentElement.getElementsByTagName('coun:country'): names = {} for name in coun.getElementsByTagName('coun:name'): assert len(name.childNodes) == 1 #~ print [n.data for n in ] #~ print name.firstChild.data names[str(name.attributes['lang'].value)] = name.firstChild.data kw = babel_values('name', **names) iso2 = coun.getElementsByTagName('coun:alpha2')[0].childNodes[0].data if Country.objects.filter(pk=iso2).count() > 0: logger.debug("ISO code %r already exists %s", iso2, coun) continue kw.update( isocode=iso2, iso3=coun.getElementsByTagName( 'coun:alpha3')[0].childNodes[0].data, ) if not 'name' in kw: kw['name'] = names['en'] if kw['name']: #~ kw.update(iso3=iso3) n += 1 yield Country(**kw) else: logger.warning( "%r : no name for default site language %s", coun, settings.SITE.DEFAULT_LANGUAGE.django_code) for ln in TABLE2.splitlines(): ln = ln.strip() if ln: code1, code2, code3, name = ln.split(None, 3) n += 1 yield Country(isocode=code1, name=name) logger.info("Installed %d countries", n)
def objects(): productcat = Instantiator('products.ProductCat').build product = Instantiator('products.Product', "cat name").build food = productcat(**babel_values( 'name', en="Food", et="Toit", de="Lebensmittel", fr="Alimentaire")) yield food yield product(food, "Le petit Fagnard", **babel_values( 'description', en="Handmade cheese from Hautes Ardennes", et="Käsitsi valmistatud juust Ardenne'idest", de="Handgemachter Käse aus den Hohen Ardennen", fr="Fromage artisanal au lait cru des Hautes Ardennes")) if False: # we need an address parser which either returns or # creates the city. Here we don't want to know whether # `countries.fixtures.be` has been loaded. company = Instantiator( 'contacts.Company', "name country:isocode city:zip_code").build yield company("Fromagerie du Troufleur", "BE", "4950 Waimes")
def objects(): if False: guest_role = Instantiator('cal.GuestRole').build yield guest_role(**babel_values('name', de=u"Teilnehmer", fr=u"Participant", en=u"Participant", et=u"Osavõtja", )) yield guest_role(**babel_values('name', de=u"Reiseführer", fr=u"Guide", en=u"Guide", et=u"Reisijuht", )) yield guest_role(**babel_values('name', de=u"Vorsitzender", fr=u"Président", en=u"Presider", et=u"Eesistuja", )) yield guest_role(**babel_values('name', de=u"Protokollführer", fr=u"Greffier", en=u"Reporter", et=u"Sekretär", )) if False: place = Instantiator('cal.Room').build yield place(**babel_values('name', de=u"Büro", fr=u"Bureau", en=u"Office", )) yield place(**babel_values('name', de=u"Beim Klienten", fr=u"Chez le client", en=u"A the client's", )) yield place(**babel_values('name', de=u"beim Arbeitgeber", fr=u"chez l'employeur", en=u"at employer's", ))
def objects(): n = 0 """ """ fn = os.path.join(os.path.dirname(__file__),'countries.xml') dom = minidom.parse(fn) #~ print dom.documentElement.__class__ #~ print dom.documentElement for coun in dom.documentElement.getElementsByTagName('coun:country'): #~ print coun.toxml() #~ print c.attributes['coun:alpha2'] names = {} for name in coun.getElementsByTagName('coun:name'): assert len(name.childNodes) == 1 #~ print [n.data for n in ] #~ print name.firstChild.data names[str(name.attributes['lang'].value)] = name.firstChild.data kw = babel_values('name',**names) kw.update( isocode = coun.getElementsByTagName('coun:alpha2')[0].childNodes[0].data, iso3 = coun.getElementsByTagName('coun:alpha3')[0].childNodes[0].data, ) if kw['name']: #~ kw.update(iso3=iso3) n += 1 yield Country(**kw) else: logger.debug("%r : no name for default site language %s", code,settings.SITE.DEFAULT_LANGUAGE.django_code) for ln in TABLE2.splitlines(): ln = ln.strip() if ln: code1, code2, code3, name = ln.split(None,3) n += 1 yield Country(isocode=code1,name=name)
def objects(): countries = dd.resolve_app('countries') city = Instantiator(countries.Place, "zip_code name", country='BE', type=countries.PlaceTypes.city).build for ln in belgian_cities.splitlines(): ln = ln.strip() if ln and ln[0] != '#': args = ln.split(None, 1) o = city(*args) # print "%r %r" % (o.zip_code, o.name) yield o #~ print __name__, "20121114" #~ return for ln in belgian_cities_nl_fr.splitlines(): ln = ln.strip() if ln and ln[0] != '#': args = ln.split('|') if len(args) != 4: raise Exception("Invalid format : \n%s" % ln) args = [x.strip() for x in args] o = city(zip_code=args[0], **babel_values('name', nl=args[1], fr=args[2], de=args[3], en=args[3])) yield o
def objects(): # ~ add = Instantiator('cal.EventStatus','ref').build # ~ yield add('0',**babel_values('name',en=u"tentative",de=u"Vorschlag", fr=u"proposition")) # ~ yield add('1',**babel_values('name',en=u"confirmed",de=u"bestätigt", fr=u"confirmé")) # ~ yield add('2',**babel_values('name',en=u"cancelled",de=u"storniert", fr=u"annulé")) # ~ yield add('3',**babel_values('name',en=u"rescheduled",de=u"verschoben", fr=u"reporté")) # ~ yield add('4',**babel_values('name',en=u"absent",de=u"abwesend", fr=u"absent")) # ~ add = Instantiator('cal.TaskStatus','ref').build # ~ yield add('0',**babel_values('name',en=u"needs action",de=u"zu erledigen", fr=u"à traîter")) # ~ yield add('1',**babel_values('name',en=u"in process",de=u"begonnen", fr=u"commencée")) # ~ yield add('2',**babel_values('name',en=u"completed",de=u"erledigt", fr=u"complétée")) # ~ yield add('3',**babel_values('name',en=u"cancelled",de=u"storniert", fr=u"annulée")) # ~ add = Instantiator('cal.AccessClass','ref').build # ~ yield add('0',**babel_values('name',en=u"Public",de=u"Öffentlich", fr=u"Public")) # ~ yield add('1',**babel_values('name',en=u"Private",de=u"Privat", fr=u"Privé")) # ~ yield add('2',**babel_values('name',en=u"Confidential",de=u"Vertraulich", fr=u"Confidentiel")) add = Instantiator("cal.Priority", "ref").build yield add("1", **babel_values("name", en="very urgent", de="sehr dringend", fr="très urgent")) yield add("2", **babel_values("name", en="quite urgent", de="recht dringend", fr="relativement urgent")) yield add("3", **babel_values("name", en="relatively urgent", de="ziemlich dringend", fr="relativement urgent")) yield add("4", **babel_values("name", en="relatively urgent", de="ziemlich dringend", fr="relativement urgent")) yield add("5", **babel_values("name", en="normal", de="normal", fr="normal")) yield add("6", **babel_values("name", en="not very urgent", de="nicht sehr niedrig", fr="pas très urgent")) yield add("7", **babel_values("name", en="not urgent", de="nicht dringend", fr="pas urgent")) yield add("8", **babel_values("name", en="not urgent", de="nicht dringend", fr="pas urgent")) yield add( "9", **babel_values("name", en="not urgent at all", de="überhaupt nicht dringend", fr="pas urgent du tout") ) calendar = Instantiator("cal.Calendar").build general = calendar(**dd.babelkw("name", de="Allgemein", fr="Général", en="General")) yield general settings.SITE.site_config.site_calendar = general # ~ settings.SITE.site_config.holiday_event_type = holidays yield settings.SITE.site_config event_type = Instantiator("cal.EventType").build holidays = event_type(all_rooms=True, **dd.babelkw("name", de="Feiertage", fr="Jours fériés", en="Holidays")) yield holidays RecurrentEvent = dd.resolve_model("cal.RecurrentEvent") add = Instantiator(RecurrentEvent, event_type=holidays).build def holiday(month, day, en, de, fr): return add( every_unit=cal.Recurrencies.yearly, monday=True, tuesday=True, wednesday=True, thursday=True, friday=True, saturday=True, sunday=True, every=1, start_date=datetime.date(year=cal.DEMO_START_YEAR, month=month, day=day), **dd.babelkw("name", en=en, de=de, fr=fr) ) yield holiday(1, 1, "New Year's Day", "Neujahr", "Jour de l'an") yield holiday(5, 1, "International Workers' Day", "Tag der Arbeit", "Premier Mai") yield holiday(7, 21, "National Day", "Nationalfeiertag", "Fête nationale") yield holiday(8, 15, "Assumption of Mary", "Mariä Himmelfahrt", "Assomption de Marie") yield holiday(10, 31, "All Souls' Day", "Allerseelen", "Commémoration des fidèles défunts") yield holiday(11, 1, "All Saints' Day", "Allerheiligen", "Toussaint") yield holiday(11, 11, "Armistice with Germany", "Waffenstillstand", "Armistice") yield holiday(12, 25, "Christmas", "Weihnachten", "Noël") summer = holiday(07, 01, "Summer holidays", "Sommerferien", "Vacances d'été") summer.end_date = summer.start_date.replace(month=8, day=31) yield summer ar = settings.SITE.login() for obj in RecurrentEvent.objects.all(): if not obj.update_reminders(ar): raise Exception("Oops, %s generated no events" % obj)
def be_city(zip_code, de=None, fr=None, nl=None, en=None, **kw): kw.update(babel_values('name', de=de, fr=fr, nl=nl, en=en)) kw.setdefault('type', PlaceTypes.city) return Place(country=BE, zip_code=zip_code, **kw)
def be_province(de, fr, nl): return Place(country=BE, type=PlaceTypes.province, **babel_values('name', de=de, fr=fr, nl=nl, en=fr))
def objects(): #~ dblogger.info("Installing countries few_cities fixture") countries = dd.resolve_app('countries') #~ Place = resolve_model('countries.Place') Place = countries.Place Country = countries.Country PlaceTypes = countries.PlaceTypes city = Instantiator(Place, 'name country').build def make_city(country_id, name=None, **kw): kw.setdefault('type', PlaceTypes.city) flt = dbutils.lookup_filter( 'name', name, country__isocode=country_id, **kw) if name == "Rapla" and kw['type'].name == 'county': logger.info("20140611 fld is %s", flt) try: return Place.objects.get(flt) # return Place.objects.exclude(type__in=[ # PlaceTypes.county, PlaceTypes.province]).get(flt) except MultipleObjectsReturned: #~ qs = Place.objects.exclude(type=PlaceTypes.county).filter(country__isocode=country_id,name=name) raise Exception("Oops, there are multiple cities for %r", name) except Place.DoesNotExist: obj = city(name, country_id, **kw) obj.full_clean() obj.save() if name == "Rapla" and kw['type'].name == 'county': logger.info("20140611 DoesNotExist --> %s", obj) return obj BE = Country.objects.get(pk='BE') DE = Country.objects.get(pk='DE') FR = Country.objects.get(pk='FR') eupen = make_city('BE', 'Eupen', zip_code='4700') yield eupen yield make_city('BE', 'Nispert', type=PlaceTypes.township, parent=eupen) reuland = make_city('BE', 'Burg-Reuland ', zip_code='4790') yield make_city('BE', 'Ouren', type=PlaceTypes.township, parent=reuland) yield Place(country=BE, zip_code='4720', type=PlaceTypes.city, **babel_values('name', de='Kelmis', fr='La Calamine', en="Kelmis")) yield make_city('BE', 'Kettenis', zip_code='4701', type=PlaceTypes.village) yield make_city('BE', 'Raeren', zip_code='4730', type=PlaceTypes.village) yield make_city('BE', 'Angleur', zip_code='4031') yield make_city('BE', 'Ans', zip_code='4430') yield make_city('BE', 'Ottignies', zip_code='1340') yield make_city('BE', 'Thieusies', zip_code='7061') yield make_city('BE', 'Cuesmes', zip_code='7033') yield make_city('BE', 'La Reid', zip_code='4910') yield make_city('BE', 'Blégny ', zip_code='4670') yield make_city('BE', 'Trembleur ', zip_code='4670') yield make_city('BE', 'Mortier ', zip_code='4670') yield make_city('BE', 'Cerfontaine', zip_code='5630') yield make_city('BE', 'Burdinne', zip_code='4210') def be_province(de, fr, nl): return Place(country=BE, type=PlaceTypes.province, **babel_values('name', de=de, fr=fr, nl=nl, en=fr)) def be_city(zip_code, de=None, fr=None, nl=None, en=None, **kw): kw.update(babel_values('name', de=de, fr=fr, nl=nl, en=en)) kw.setdefault('type', PlaceTypes.city) return Place(country=BE, zip_code=zip_code, **kw) yield be_province("Antwerpen", "Anvers", "Antwerpen") yield be_province("Luxemburg", "Luxembourg", "Luxemburg") yield be_province("Namür", "Namur", "Namen") prov = be_province("Limburg", "Limbourg", "Limburg") yield prov yield make_city('BE', 'Aalst-bij-Sint-Truiden', zip_code='3800', parent=prov, type=PlaceTypes.village) prov = be_province("Lüttich", "Liège", "Luik") yield prov yield be_city('4000', "Lüttich", "Liège", "Luik", "Liège", parent=prov) yield be_city('4750', "Bütgenbach", "Butgenbach", "Butgenbach", "Butgenbach", parent=prov) yield be_city('4760', "Büllingen", "Bullange", "Büllingen", "Büllingen", parent=prov) yield be_city('4780', "Sankt Vith", "Saint-Vith", "Sankt Vith", "Sankt Vith", parent=prov) yield be_city('4780', "Recht", "Recht", "Recht", "Recht", parent=prov) yield be_city('4837', "Baelen", "Baelen", "Baelen", "Baelen", parent=prov) yield be_province("Hennegau", "Hainaut", "Henegouwen") yield be_province("Wallonisch-Brabant", "Brabant wallon", "Waals-Brabant") yield be_province("Flämisch-Brabant", "Brabant flamant", "Vlaams-Brabant") prov = be_province("Ostflandern", "Flandre de l'Est", "Oost-Vlaanderen") yield prov aalst = be_city('9300', "Aalst", "Alost", "Aalst", "Aalst", parent=prov) yield aalst yield be_city('9308', name="Gijzegem", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Baardegem ", parent=aalst, type=PlaceTypes.village) yield be_city('9320', name="Erembodegem", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Herdersem", parent=aalst, type=PlaceTypes.village) yield be_city('9308', name="Hofstade", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Meldert", parent=aalst, type=PlaceTypes.village) yield be_city('9320', name="Nieuwerkerken", parent=aalst, type=PlaceTypes.village) yield be_city('9310', name="Moorsel", parent=aalst, type=PlaceTypes.village) yield be_province("Westflandern", "Flandre de l'Ouest", "West-Vlaanderen") yield be_city('1000', "Brüssel", "Bruxelles", "Brussel", "Brussels") yield be_city('7000', "Bergen", "Mons", "Bergen", "Mons") yield be_city('8400', "Ostende", "Ostende", "Oostende", "Ostende") yield be_city('5000', "Namür", "Namur", "Namen", "Namur") harjumaa = make_city('EE', 'Harju', type=PlaceTypes.county) yield harjumaa parnumaa = make_city('EE', 'Pärnu', type=PlaceTypes.county) yield parnumaa raplamaa = make_city('EE', 'Rapla', type=PlaceTypes.county) yield raplamaa yield make_city('EE', 'Vigala', type=PlaceTypes.municipality, parent=raplamaa) yield make_city('EE', 'Rapla', type=PlaceTypes.town, parent=raplamaa) yield make_city('EE', 'Tallinn', type=PlaceTypes.city, parent=harjumaa) yield make_city('EE', 'Pärnu', type=PlaceTypes.town, parent=parnumaa) yield make_city('EE', 'Tartu', type=PlaceTypes.town) yield make_city('EE', 'Narva', type=PlaceTypes.town) yield make_city('EE', 'Ääsmäe', type=PlaceTypes.town, parent=harjumaa) #~ yield make_city(u'Aachen','DE') yield Place(country=DE, type=PlaceTypes.city, **babel_values('name', de='Aachen', fr='Aix-la-Chapelle', nl="Aken", en="Aachen")) yield Place(country=DE, type=PlaceTypes.city, **babel_values('name', de='Köln', fr='Cologne', nl="Keulen", en="Cologne")) yield make_city('DE', 'Berlin') yield make_city('DE', 'Hamburg') yield Place(country=DE, type=PlaceTypes.city, **babel_values('name', de='München', fr='Munich', en="Munich")) yield Place(country=DE, type=PlaceTypes.city, **babel_values('name', de='Monschau', fr='Montjoie', en="Monschau")) yield make_city('NL', 'Maastricht') yield make_city('NL', 'Amsterdam') yield make_city('NL', 'Den Haag') yield make_city('NL', 'Rotterdam') yield make_city('NL', 'Utrecht') yield make_city('NL', 'Breda') yield Place(country=FR, type=PlaceTypes.city, **babel_values('name', de='Paris', fr='Paris', en="Paris", et="Pariis", nl="Parijs")) yield Place(country=FR, type=PlaceTypes.city, **babel_values('name', de='Nizza', fr='Nice', en="Nice")) yield make_city('FR', 'Metz') yield make_city('FR', 'Strasbourg') yield make_city('FR', 'Nancy') yield make_city('FR', 'Marseille')
def P(en,de,fr): return Product(**babel_values('name',en=en,de=de,fr=fr))
def objects(): Role = resolve_model('households.Role') Type = resolve_model('households.Type') #~ yield Role(**babel_values('name', #~ de=u"Vater", #~ fr=u"père", #~ en=u"father", #~ )) #~ yield Role(**babel_values('name', #~ de=u"Mutter", #~ fr=u"mère", #~ en=u"mother", #~ )) #~ yield Role(**babel_values('name', #~ de=u"Tochter", #~ fr=u"fille", #~ en=u"daughter", #~ )) #~ yield Role(**babel_values('name', #~ de=u"Sohn", #~ fr=u"fils", #~ en=u"son", #~ )) kw = babel_values('name', de=u"Haushaltsvorstand", fr=u"Chef de ménage", en=u"Head of household", ) yield Role(name_giving=True,**kw) kw = babel_values('name', de=u"Ehepartner", fr=u"Conjoint", en=u"Spouse", ) yield Role(name_giving=True,**kw) kw = babel_values('name', de=u"Partner", fr=u"Partenaire", en=u"Partner", ) yield Role(name_giving=True,**kw) kw = babel_values('name', de=u"Mitbewohner", fr=u"Cohabitant", en=u"Cohabitant", ) yield Role(**kw) kw = babel_values('name', de=u"Kind", fr=u"Enfant", en=u"Child", ) #~ kw.update(babel_values('male', #~ de=u"Sohn", #~ fr=u"Fils", #~ en=u"Son", #~ )) #~ kw.update(babel_values('female', #~ de=u"Tochter", #~ fr=u"Fille", #~ en=u"Daughter", #~ )) yield Role(**kw) kw = babel_values('name', de=u"Adoptivkind", fr=u"Enfant adopté", en=u"Adopted child", ) #~ kw.update(babel_values('male', #~ de=u"Adoptivsohn", #~ fr=u"Fils adoptif", #~ en=u"Adopted son", #~ )) #~ kw.update(babel_values('female', #~ de=u"Adoptivtochter", #~ fr=u"Fille adoptive", #~ en=u"Adopted daughter", #~ )) yield Role(**kw) yield Type(**babel_values('name', de=u"Ehepaar", fr=u"Couple marié", en=u"Married couple", )) yield Type(**babel_values('name', de=u"Familie", fr=u"Famille", en=u"Family", )) yield Type(**babel_values('name', de=u"Faktischer Haushalt", fr=u"Ménage de fait", en=u"Factual household", )) yield Type(**babel_values('name', de=u"Legale Wohngemeinschaft", fr=u"Cohabitation légale", en=u"Legal cohabitation", ))
def P(en, de, fr, cat): return Product(category=cat, **babel_values('name', en=en, de=de, fr=fr))
def objects(): chart = accounts.Chart(**babel_values('name', en="Minimal Accounts Chart", fr="Plan comptable réduit", de="Reduzierter Kontenplan")) yield chart #~ account = Instantiator(accounts.Account,"ref name").build def Group(ref, type, fr, de, en): global current_group current_group = accounts.Group( chart=chart, ref=ref, account_type=accounts.AccountTypes.get_by_name(type), **babel_values('name', de=de, fr=fr, en=en)) return current_group def Account(ref, type, fr, de, en, **kw): kw.update(babel_values('name', de=de, fr=fr, en=en)) return accounts.Account( chart=chart, group=current_group, ref=ref, type=accounts.AccountTypes.get_by_name(type), **kw) yield Group('10', 'capital', "Capital", "Kapital", "Capital") yield Group('40', 'assets', "Créances commerciales", "Forderungen aus Lieferungen und Leistungen", "Commercial receivable(?)") obj = Account(CUSTOMERS_ACCOUNT, 'assets', "Clients", "Kunden", "Customers", clearable=True) yield obj if sales: settings.SITE.site_config.update(clients_account=obj) obj = Account(SUPPLIERS_ACCOUNT, 'liabilities', "Fournisseurs", "Lieferanten", "Suppliers", clearable=True) yield obj if vat: settings.SITE.site_config.update(suppliers_account=obj) yield Group('45', 'assets', "TVA à payer", "Geschuldete MWSt", "VAT to pay") obj = Account(VAT_DUE_ACCOUNT, 'incomes', "TVA due", "Geschuldete MWSt", "VAT due", clearable=True) yield obj if sales: settings.SITE.site_config.update(sales_vat_account=obj) obj = Account( VAT_DEDUCTIBLE_ACCOUT, 'assets', "TVA déductible", "Abziehbare MWSt", "VAT deductible", clearable=True) yield obj if ledger: settings.SITE.site_config.update(purchases_vat_account=obj) # PCMN 55 yield Group('55', 'assets', "Institutions financières", "Finanzinstitute", "Banks") yield Account(BESTBANK_ACCOUNT, 'bank_accounts', "Bestbank", "Bestbank", "Bestbank") yield Account(CASH_ACCOUNT, 'bank_accounts', "Caisse", "Kasse", "Cash") yield Group('58', 'assets', "Transactions en cours", "Laufende Transaktionen", "Running transactions") yield Account(PO_BESTBANK_ACCOUNT, 'bank_accounts', "Ordres de paiement Bestbank", "Zahlungsaufträge Bestbank", "Payment Orders Bestbank", clearable=True) # TODO: use another account type than bank_accounts: yield Account(VATDCL_ACCOUNT, 'bank_accounts', "TVA à declarer", "MWSt zu deklarieren", "VAT to declare") yield Group('6', 'expenses', u"Charges", u"Aufwendungen", "Expenses") yield Account(PURCHASE_OF_GOODS, 'expenses', "Achat de marchandise", "Wareneinkäufe", "Purchase of goods", purchases_allowed=True) yield Account(PURCHASE_OF_SERVICES, 'expenses', "Services et biens divers", "Dienstleistungen", "Purchase of services", purchases_allowed=True) yield Account(PURCHASE_OF_INVESTMENTS, 'expenses', "Investissements", "Anlagen", "Purchase of investments", purchases_allowed=True) yield Group('7', 'incomes', "Produits", "Erträge", "Revenues") obj = Account(SALES_ACCOUNT, 'incomes', "Ventes", "Verkäufe", "Sales", sales_allowed=True) yield obj if sales: settings.SITE.site_config.update(sales_account=obj) if sales: MODEL = sales.Invoice #~ yield sales.Orders.create_journal("VKR",'sales',name=u"Aufträge") else: MODEL = ledger.AccountInvoice kw = babel_values('name', de="Verkaufsrechnungen", fr="Factures vente", en="Sales invoices", et="Müügiarved") yield MODEL.create_journal('sales', ref="S", chart=chart, **kw) yield ledger.AccountInvoice.create_journal( 'purchases', chart=chart, ref="P", **babel_values('name', de="Einkaufsrechnungen", fr="Factures achat", en="Purchase invoices", et="Ostuarved")) if finan: yield finan.BankStatement.create_journal( chart=chart, name="Bestbank", account=BESTBANK_ACCOUNT, ref="B") kw = babel_values( 'name', de="Zahlungsaufträge", fr="Ordres de paiement", en="Payment Orders", et="Maksekorraldused") yield finan.PaymentOrder.create_journal( 'purchases', chart=chart, account=PO_BESTBANK_ACCOUNT, ref="PO", **kw) kw = babel_values( 'name', en="Cash", de="Kasse", fr="Caisse", et="Kassa") yield finan.BankStatement.create_journal( chart=chart, account=CASH_ACCOUNT, ref="C", **kw) kw = babel_values( 'name', en="Miscellaneous Journal Entries", de="Diverse Buchungen", fr="Opérations diverses") yield finan.JournalEntry.create_journal( chart=chart, ref="M", dc=accounts.DEBIT, **kw) if declarations: kw = babel_values( 'name', en="VAT declarations", de="MWSt-Erklärungen", fr="Déclarations TVA", et="Käibemaksu deklaratsioonid") yield declarations.Declaration.create_journal( chart=chart, ref="V", account=VATDCL_ACCOUNT, **kw)
def objects(): productcat = Instantiator('products.ProductCat').build product = Instantiator('products.Product', "sales_price cat").build furniture = productcat(id=1, **babel_values('name', en="Furniture", et="Mööbel", de="Möbel", fr="Meubles")) yield furniture # print "foo", furniture.id, furniture hosting = productcat(id=2, **babel_values('name', en="Website Hosting", et="Veebimajutus", de="Website-Hosting", fr="Hébergement de sites Internet")) yield hosting kw = babel_values('name', en="Wooden table", et=u"Laud puidust", de="Tisch aus Holz", fr=u"Table en bois") kw.update(babel_values('description', en="""\ This table is made of pure wood. It has **four legs**. Designed to fit perfectly with **up to 6 wooden chairs**. Product of the year 2008.""", et="""\ See laud on tehtud ehtsast puust. Sellel on **neli jalga**. Disainitud sobida kokku **kuni 6 puidust tooliga**. Product of the year 2008.""", de="""\ Dieser Tisch ist aus echtem Holz. Er hat **vier Beine**. Passt perfekt zusammen mit **bis zu 6 Stühlen aus Holz**. Produkt des Jahres 2008.""", fr="""\ Cette table est en bois authentique. Elle a **quatre jambes**. Conçue pour mettre jusqu'à **6 chaises en bois**. Produit de l'année 2008.""", )) yield product("199.99", 1, **kw) yield product("99.99", 1, **babel_values('name', en="Wooden chair", et="Tool puidust", de="Stuhl aus Holz", fr="Chaise en bois")) yield product("129.99", 1, **babel_values('name', en="Metal table", et="Laud metallist", de="Tisch aus Metall", fr="Table en métal")) yield product("79.99", 1, **babel_values('name', en="Metal chair", et="Tool metallist", de="Stuhl aus Metall", fr="Chaise en métal")) hosting = product("3.99", 2, **babel_values('name', en="Website hosting 1MB/month", et="Majutus 1MB/s", de="Website-Hosting 1MB/Monat", fr="Hébergement 1MB/mois")) yield hosting yield product("30.00", 2, **babel_values('name', en="IT consultation & maintenance", et=u"IKT konsultatsioonid & hooldustööd", de=u"EDV Konsultierung & Unterhaltsarbeiten", fr=u"ICT Consultation & maintenance")) yield product("35.00", 2, **babel_values('name', en="Server software installation, configuration and administration", et="Serveritarkvara installeerimine, seadistamine ja administreerimine", de="Server software installation, configuration and administration", fr="Server software installation, configuration and administration")) yield product("40.00", 2, **babel_values('name', en="Programming", et="Programmeerimistööd", de="Programmierung", fr="Programmation")) yield product("25.00", 2, **babel_values('name', en="Image processing and website content maintenance", et="Pilditöötlus ja kodulehtede sisuhaldustööd", de="Bildbearbeitung und Unterhalt Website", fr="Traitement d'images et maintenance site existant"))
def objects(): def country(isocode, **kw): try: return Country.objects.get(isocode=isocode) except Country.DoesNotExist: # return build_country(isocode, **kw) return Country(isocode=isocode, **kw) yield country('EE', **babel_values('name', de=u"Estland", fr=u'Estonie', en=u"Estonia", nl=u'Estland', et=u'Eesti', )) yield country('BE', **babel_values('name', de=u"Belgien", fr=u'Belgique', en=u"Belgium", nl=u'Belgie', et=u'Belgia', )) yield country('DE', **babel_values('name', de=u"Deutschland", fr=u'Allemagne', en=u"Germany", nl=u'Duitsland', et=u'Saksamaa', )) yield country('FR', **babel_values('name', de=u"Frankreich", fr=u'France', en=u"France", nl=u'Frankrijk', et=u'Prantsusmaa', )) yield country('NL', **babel_values('name', de=u"Niederlande", fr=u'Pays-Bas', en=u"Netherlands", nl=u'Nederlande', et=u'Holand', )) yield country('MA', **babel_values('name', de=u"Marokko", fr=u'Maroc', en=u"Maroc", nl=u'Marocco', et=u'Marokko', )) yield country('RU', **babel_values('name', de=u"Russland", fr=u'Russie', en=u"Russia", nl=u'Rusland', et=u'Venemaa', )) yield country('CD', **babel_values('name', de=u"Kongo (Demokratische Republik)", fr=u'Congo (République Démocratique)', en=u"Congo (Democratic Republic)", nl=u'Congo (Democratische Republiek)', et=u'Kongo (Demokraatlik Vabariik)', ))
def objects(): global COUNT COUNT += 1 dblogger.info("Started contacts demo fixture %d",COUNT) #~ yield addresstype(**babel_values('name',en="Default",fr=u'Gérant',de=u"Geschäftsführer",et=u"Manager")) yield role(**babel_values('name',en="Manager",fr=u'Gérant',de=u"Geschäftsführer",et=u"Manager")) yield role(**babel_values('name',en="Director",fr=u'Directeur',de=u"Direktor",et=u"Direktor")) yield role(**babel_values('name',en="Secretary",fr=u'Sécrétaire',de=u"Sekretär",et=u"Sekretär")) yield role(**babel_values('name',en="IT Manager",fr=u'Gérant informatique',de=u"EDV-Manager",et=u"IT manager")) yield company(u"Rumma & Ko OÜ", 'EE','10115','Tallinn',u'Tartu mnt','71') yield company(u'Bäckerei Ausdemwald', 'BE', '4700', 'Eupen', u'Vervierser Straße','45') yield company(u'Bäckerei Mießen', 'BE', '4700', 'Eupen', u'Gospert','103') yield company(u'Bäckerei Schmitz', 'BE', '4700', 'Eupen', u'Aachener Straße','53') yield company(u'Garage Mergelsberg', 'BE', '4720', 'Kelmis', u'Kasinostraße','13') yield company(u'Donderweer BV', 'NL', '4816 AR','Breda', 'Edisonstraat','12') yield company(u'Van Achter NV', 'NL', '4836 LG','Breda', 'Hazeldonk','2') yield company(u'Hans Flott & Co', 'DE', '22453','Hamburg',u'Niendorfer Weg','532') yield company(u'Bernd Brechts Bücherladen','DE', '80333',u'München',u'Brienner Straße','18') yield company(u'Reinhards Baumschule','DE', '12487 ',u'Berlin',u'Segelfliegerdamm','123') yield company(u'Moulin Rouge', 'FR', '75018','Paris',u'Boulevard de Clichy','82') yield company(u'Auto École Verte','FR', '54000 ','Nancy',u'rue de Mon Désert','12') #~ yield person(u'Luc', u'Saffre', gender=Gender.male) yield person(u'Andreas', u'Arens', 'BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Annette', u'Arens','BE','4700','Eupen', gender=mixins.Genders.female) yield person(u'Hans', u'Altenberg','BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Alfons', u'Ausdemwald','BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Laurent', u'Bastiaensen','BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Charlotte', u'Collard','BE','4700','Eupen', gender=mixins.Genders.female) yield person(u'Ulrike', u'Charlier','BE','4700','Eupen', gender=mixins.Genders.female) yield person(u'Marc', u'Chantraine','BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Daniel', u'Dericum','BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Dorothée', u'Demeulenaere','BE','4700','Eupen', gender=mixins.Genders.female) yield person(u'Berta', u'Ernst','BE','4700','Eupen', gender=mixins.Genders.female) yield person(u'Bernd', u'Evertz','BE','4700','Eupen', gender=mixins.Genders.male) yield person(u'Eberhart', u'Evers','BE','4700','Eupen', gender=Gender.male) yield person(u'Daniel', u'Emonts','BE','4700','Eupen', gender=Gender.male) yield person(u'Edgar', u'Engels','BE','4700','Eupen', gender=Gender.male) yield person(u'Luc', u'Faymonville','BE','4700','Eupen', gender=Gender.male) yield person(u'Gérard', u'Gernegroß','BE','4700','Eupen', gender=Gender.male) yield person(u'Werner', u'Groteclaes','BE','4700','Eupen', gender=Gender.male) yield person(u'Grete', u'Hilgers','BE','4700','Eupen', gender=Gender.female) yield person(u'Hans', u'Hilgers','BE','4700','Eupen', gender=Gender.male) yield person(u'Irene', u'Ingels','BE','4700','Eupen', gender=Gender.female) yield person(u'Jérémy', u'Jansen','BE','4700','Eupen', gender=Gender.male) yield person(u'Jean-Pierre', u'Jacob','BE','4700','Eupen', gender=Gender.male) yield person(u'Herbert', u'Johnen','BE','4700','Eupen', gender=Gender.male) yield person(u'Johannes', u'Jonas','BE','4700','Eupen', gender=Gender.male) yield person(u'Jan', u'Jousten','BE','4700','Eupen', gender=Gender.male) yield person(u'Karl', u'Kaivers','BE','4700','Eupen', gender=Gender.male) yield person(u'Guido', u'Lambertz','BE','4700','Eupen', gender=Gender.male) yield person(u'Luc', u'Laschet','BE','4700','Eupen', gender=Gender.male) yield person(u'Line', u'Lazarus','BE','4700','Eupen', gender=Gender.female) yield person(u'Josefine', u'Leffin','BE','4700','Eupen', gender=Gender.female) yield person(u'Marc', u'Malmendier','BE','4700','Eupen', gender=Gender.male) yield person(u'Leo', u'Meessen','BE','4700','Eupen', gender=Gender.male) yield person(u'Franz', u'Mießen','BE','4700','Eupen', gender=Gender.male) yield person(u'Marie-Louise', u'Meier','BE','4700','Eupen', gender=Gender.female) yield person(u'Erich', u'Emonts', 'BE','4730','Raeren', gender=Gender.male) yield person(u'Erwin', u'Emontspool', 'BE','4730','Raeren', gender=Gender.male) yield person(u'Erna', u'Emonts-Gast', 'BE','4730','Raeren', gender=Gender.female) yield person(u'Alfons', u'Radermacher','BE','4730','Raeren', gender=Gender.male) yield person(u'Berta', u'Radermacher','BE','4730','Raeren', gender=Gender.female) yield person(u'Christian', u'Radermacher','BE','4730','Raeren', gender=Gender.male) yield person(u'Daniela', u'Radermacher','BE','4730','Raeren', gender=Gender.female) yield person(u'Edgard', u'Radermacher','BE','4730','Raeren', gender=Gender.male) yield person(u'Fritz', u'Radermacher','BE','4730','Raeren', gender=Gender.male) yield person(u'Guido', u'Radermacher','BE','4730','Raeren', gender=Gender.male) yield person(u'Hans', u'Radermacher','BE','4730','Raeren', gender=Gender.male) yield person(u'Hedi', u'Radermacher','BE','4730','Raeren', gender=Gender.female) yield person(u'Inge', u'Radermacher','BE','4730','Raeren', gender=Gender.female) yield person(u'Jean', u'Radermacher','BE','4730','Raeren', gender=Gender.male) # special challenges for alphabetic ordering yield person(u'Elio', u'di Rupo') yield person(u'Leonardo', u'da Vinci') yield person(u'Herman', u'van Veen') yield person(u'Rein', u'Õunapuu') yield person(u'Otto', u'Östges') yield person(u'Erna', u'Ärgerlich') yield person(u'Bernard',u'Bodard',title='Dr.') yield person(u'Jean',u'Dupont') yield person(u'Mark',u'Martelaer') yield person(u'Rik',u'Radermecker') yield person(u'Marie-Louise',u'Vandenmeulenbos') yield person(u'Emil',u'Eierschal') yield person(u'Lisa',u'Lahm') yield person(u'Bernd',u'Brecht') yield person(u'Karl',u'Keller') yield person(u'Robin',u'Dubois') yield person(u'Denis',u'Denon') yield person(u'Jérôme',u'Jeanémart') s = u"""\ Aachener Straße Akazienweg Alter Malmedyer Weg Am Bahndamm Am Berg Am Waisenbüschchen Auenweg Auf dem Spitzberg Auf'm Rain August-Thonnar-Str. Bahnhofsgasse Bahnhofstraße Bellmerin Bennetsborn Bergkapellstraße Bergstraße Binsterweg Brabantstraße Buchenweg Edelstraße Euregiostraße Favrunpark Feldstraße Fränzel Gewerbestraße Gospert Gülcherstraße Haagenstraße Haasberg Haasstraße Habsburgerweg Heidberg Heidgasse Heidhöhe Herbesthaler Straße Hisselsgasse Hochstraße Hook Hostert Hufengasse Hugo-Zimmermann-Str. Hütte Hütterprivatweg Im Peschgen In den Siepen Industriestraße Johannesstraße Judenstraße Kaperberg Kaplan-Arnolds-Str. Karl-Weiß-Str. Kehrweg Kirchgasse Kirchstraße Klinkeshöfchen Kügelgasse Langesthal Lascheterweg Limburgerweg Lindenweg Lothringerweg Malmedyer Straße Maria-Theresia-Straße Marktplatz Monschauer Straße Mühlenweg Neustraße Nikolausfeld Nispert Noereth Obere Ibern Obere Rottergasse Oestraße Olengraben Panorama Paveestraße Peter-Becker-Str. Rosenweg Rot-Kreuz-Str. Rotenberg Rotenbergplatz Schilsweg Schlüsselhof Schnellewindgasse Schönefeld Schorberg Schulstraße Selterschlag Simarstraße Steinroth Stendrich Stockbergerweg Stockem Theodor-Mooren-Str. Untere Ibern Vervierser Straße Vossengasse Voulfeld Werthplatz Weserstraße """ streets_of_eupen = [ line.strip() for line in s.splitlines() if len(line.strip()) > 0 ] if settings.SITE.abstract_address: nr = 1 #~ CITIES = Cycler(City.objects.all()) eupen = City.objects.get(name="Eupen") STREETS = Cycler(streets_of_eupen) for p in Person.objects.filter(city=eupen): p.street = STREETS.pop() p.street_no = str(nr) p.save() nr += 1 else: nr = 1 for street in streets_of_eupen: for i in range(3): yield address('BE','4700','Eupen',street,str(nr)) nr += 1 ADDRESSES = Cycler(Address.objects.all()) for p in Person.objects.all(): p.address = ADDRESSES.pop() p.save() PERSONS = Cycler(contacts.Person.objects.all()) COMPANIES = Cycler(contacts.Company.objects.all()) ROLES = Cycler(contacts.Role.objects.all()) for i in range(100): com = COMPANIES.pop() yield contact(com,PERSONS.pop(),role=ROLES.pop()) yield contact(com,PERSONS.pop(),role=ROLES.pop()) rumma = contacts.Company.objects.get(name=u"Rumma & Ko OÜ") def user(first_name,last_name,**kw): p = Person(first_name=first_name,last_name=last_name) p.save() return User(person=p,company=rumma,**kw) #~ yield user("Alice","Imedemaal",is_superuser=True) yield user("Alice","Imedemaal",profile=UserProfiles.admin) yield user("Bert","Sesamestreet") yield user("Charles","Braun") dblogger.info("Done contacts demo fixture")
def objects(): if False: Role = resolve_model('households.Role') kw = babel_values('name', de=u"Familienoberhaupt", fr=u"Chef de ménage", en=u"Head of household" ) yield Role(name_giving=True, **kw) kw = babel_values('name', de=u"Ehepartner", fr=u"Conjoint", en=u"Spouse", ) yield Role(name_giving=True, **kw) kw = babel_values('name', de=u"Partner", fr=u"Partenaire", en=u"Partner", ) yield Role(name_giving=True, **kw) kw = babel_values('name', de=u"Mitbewohner", fr=u"Cohabitant", en=u"Cohabitant", ) yield Role(**kw) kw = babel_values('name', de=u"Kind", fr=u"Enfant", en=u"Child", ) yield Role(**kw) kw = babel_values('name', de=u"Verwandter", fr=u"Membre de famille", en=u"Relative", ) yield Role(**kw) kw = babel_values('name', de=u"Adoptivkind", fr=u"Enfant adopté", en=u"Adopted child", ) yield Role(**kw) Type = resolve_model('households.Type') yield Type(**babel_values('name', de=u"Ehepaar", fr=u"Couple marié", en=u"Married couple", )) yield Type(**babel_values('name', de=u"Familie", fr=u"Famille", en=u"Family", )) yield Type(**babel_values('name', de=u"Faktischer Haushalt", fr=u"Ménage de fait", en=u"Factual household", )) yield Type(**babel_values('name', de=u"Legale Wohngemeinschaft", fr=u"Cohabitation légale", en=u"Legal cohabitation", ))
def objects(): group = Instantiator('debts.AccountGroup').build g = group(account_type=AccountType.income,**babel_values('name', de=u"Monatliche Einkünfte", fr=u"Revenus mensuels", en=u"Monthly incomes" )) yield g account = Instantiator('debts.Account',group=g).build yield account(required_for_person=True,**babel_values('name', de=u"Gehälter", fr=u"Salaires", en=u"Salaries" )) yield account(required_for_person=True,**babel_values('name', de=u"Renten", fr=u"Pension", en=u"Pension" )) yield account(required_for_person=True,**babel_values('name', de=u"Integrationszulage", fr=u"Allocation d'intégration", en=u"Integration aid" )) g = group(account_type=AccountType.income,**babel_values('name', de=u"Jährliche Einkünfte", fr=u"Revenus annuels", en=u"Yearly incomes" )) yield g account = Instantiator('debts.Account',group=g).build yield account(required_for_person=True,**babel_values('name', de=u"Urlaubsgeld", fr=u"Congé payé", en=u"Paid holiday" )) yield account(required_for_person=True,**babel_values('name', de=u"Jahresendzulage", fr=u"Prime de fin d'année", en=u"Year-end prime" )) g = group(account_type=AccountType.expense,**babel_values('name', de=u"Monatliche Ausgaben", fr=u"Dépenses mensuelles", en=u"Monthly expenses" )) yield g account = Instantiator('debts.Account',group=g).build yield account(required_for_household=True,**babel_values('name', de=u"Miete", fr=u"Loyer", en=u"Rent" )) yield account(required_for_household=True,**babel_values('name', de=u"Strom", fr=u"Electricité", en=u"Electricity" )) g = group(account_type=AccountType.expense,**babel_values('name', de=u"Steuern", fr=u"Taxes", en=u"Taxes" )) yield g account = Instantiator('debts.Account',group=g,periods=12).build yield account(required_for_household=True,**babel_values('name', de=u"Müllsteuer", fr=u"Taxe déchets", en=u"Waste tax" )) g = group(account_type=AccountType.asset,**babel_values('name', de=u"Aktiva, Vermögen, Kapital", fr=u"Actifs", en=u"Assets" )) yield g account = Instantiator('debts.Account',group=g).build yield account(**babel_values('name', de=u"Vermögen", fr=u"Propriété", en=u"Assets" )) account = Instantiator('debts.Account',group=g).build yield account(**babel_values('name', de=u"Haus", fr=u"Maison", en=u"House" )) yield account(**babel_values('name', de=u"Auto", fr=u"Voiture", en=u"Car" )) g = group(account_type=AccountType.liability,**babel_values('name', de=u"Guthaben, Schulden, Verbindlichkeit", fr=u"Créances et dettes", en=u"Liabilities" )) yield g account = Instantiator('debts.Account',group=g).build yield account(**babel_values('name', de=u"Kredite", fr=u"Crédits", en=u"Loans" )) yield account(**babel_values('name', de=u"Schulden", fr=u"Emprunts", en=u"Debts" )) yield account(**babel_values('name', de=u"Gerichtsvollzieher", fr=u"Juge", en=u"Judge" )) yield account(**babel_values('name', de=u"Zahlungsrückstände", fr=u"Factures à payer", en=u"Invoices to pay" )) #~ budget = Instantiator('debts.Budget').build #~ from lino.modlib.users.models import User #~ root = User.objects.get(username='******') User = resolve_model('users.User') kerstin = User(username="******", first_name="Kerstin",last_name=u"Küpper", profile=UserProfiles.kerstin) yield kerstin Household = resolve_model('households.Household') Budget = resolve_model('debts.Budget') Actor = resolve_model('debts.Actor') for hh in Household.objects.all(): #~ sub_budgets = [] for p in hh.member_set.all(): yield Budget(partner_id=p.person.id,user=kerstin) #~ sub_budgets.append(b) #~ yield b yield Budget(partner_id=hh.id,user=kerstin) #~ yield b #~ for sb in sub_budgets: #~ yield Actor(budget=b,sub_budget=sb) Budget = resolve_model('debts.Budget') #~ Debt = resolve_model('debts.Debt') Entry = resolve_model('debts.Entry') Account = resolve_model('debts.Account') Company = resolve_model('contacts.Company') AMOUNTS = Cycler([i*5.24 for i in range(10)]) PARTNERS = Cycler(Company.objects.all()) ACCOUNTS = Cycler(Account.objects.filter(type=AccountType.liability)) for b in Budget.objects.all(): #~ n = min(3,b.actor_set.count()) for e in b.entry_set.all(): #~ for i in range(n): e.amount = n2dec(AMOUNTS.pop()) e.save() for i in range(3): a = int(AMOUNTS.pop()*5) yield Entry(budget=b, account=ACCOUNTS.pop(), partner=PARTNERS.pop(),amount=a, monthly_rate=n2dec(a/20))