def process_one(self, data, fields, store): person = Person( store=store, name=data.name, phone_number=data.phone_number, mobile_number=data.mobile_number) Individual(person=person, store=store, cpf=data.cpf, rg_number=data.rg) ctloc = CityLocation.get_or_create(store=store, city=data.city, state=data.state, country=data.country) streetnumber = data.streetnumber and int(data.streetnumber) or None Address( is_main_address=True, person=person, city_location=ctloc, store=store, street=data.street, streetnumber=streetnumber, district=data.district ) Client(person=person, store=store)
def test_generated_file_with_individual(self): individual = self.create_individual() individual.cpf = u'123.123.123-23' client = Client(person=individual.person, store=self.store) self._create_address(individual.person, street=u"Rua dos Tomates", streetnumber=2666, postal_code=u'87654-321') self._test_generated_files(client)
def create_client(cls, store, name, cpf, address=None): # TODO: Add phone number person = Person(name=name, store=store) Individual(cpf=cpf, person=person, store=store) if address: cls.create_address(person, address) client = Client(person=person, store=store) return client
def test_generated_file_with_company(self): company = self.create_company() company.cnpj = u'123.456.789/1234-00' client = Client(person=company.person, store=self.store) self._create_address(company.person, street=u"Rua dos Tomates", streetnumber=2666, postal_code=u'87654-321') self._test_generated_files(client)
def _create_client(self, store): from stoqlib.domain.address import Address, CityLocation from stoqlib.domain.person import Client, Person person = Person(name=u'Person', store=store) city = CityLocation.get_default(store) Address(store=store, street=u'Rua Principal', streetnumber=123, postal_code=u'12345-678', is_main_address=True, person=person, city_location=city) client = Client(person=person, store=store) client.credit_limit = currency("1000") return client
def _update_sale_client(self): """Update the sale client based on the informed document If the sale does not have a client yet, and the current_document (informed by the ecf plugin) is set, and a person with the given document exists, that client will be associated with this sale. """ if self.model.client or not self.wizard._current_document: return person = Person.get_by_document(self.store, str(self.wizard._current_document)) if not person: return if person.client: self.model.client = person.client else: self.model.client = Client(store=self.store, person=person)
def _create_examples(self): person = Person(name=u'Jonas', store=self.store) Individual(person=person, store=self.store) role = EmployeeRole(store=self.store, name=u'desenvolvedor') Employee(person=person, store=self.store, role=role) self.salesperson = SalesPerson(person=person, store=self.store) Company(person=person, store=self.store) client = Client(person=person, store=self.store) self.branch = Branch(person=person, store=self.store) group = self.create_payment_group() self.sale = Sale(coupon_id=123, client=client, cfop_id=self.sparam.get_object_id('DEFAULT_SALES_CFOP'), group=group, branch=self.branch, salesperson=self.salesperson, store=self.store) self.storable = self.create_storable()
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) client = person.client if client is None: client = Client(person=person, store=store) return client
def create_client(self, name=u'Client'): from stoqlib.domain.person import Client, Individual, Person person = Person(name=name, store=self.store) Individual(person=person, store=self.store) return Client(person=person, store=self.store)