def describe_item(self, person_view): details = [] birth_date = (person_view.birth_date and person_view.birth_date.strftime('%x')) for label, value in [ (_("Phone"), person_view.phone_number), (_("Mobile"), person_view.mobile_number), (self._person_l10n.label, person_view.cpf), (self._company_l10n.label, person_view.cnpj), (_("RG"), person_view.rg_number), (_("Birth date"), birth_date), (_("Category"), getattr(person_view, 'client_category', None)), (_("Address"), format_address(person_view))]: if not value: continue details.append('%s: %s' % (label, api.escape(value))) name = "<big>%s</big>" % (api.escape(person_view.get_description()), ) if details: short = name + '\n<span size="small">%s</span>' % ( api.escape(', '.join(details[:1]))) complete = name + '\n<span size="small">%s</span>' % ( api.escape('\n'.join(details))) else: short = name complete = name return short, complete
def __init__(self, payment, bank_info, **kwargs): person = payment.group.payer if person.company: payer_type = 2 doc = person.company.cnpj else: payer_type = 1 doc = person.individual.cpf raw_doc = ''.join(i for i in doc if i in '1234567890') address = person.get_main_address() postal_code = address.postal_code or '-' address_str = format_address(address, include_district=False) kwargs.update( payer_type=payer_type, payer_document=raw_doc, payer_name=person.name, payer_address=address_str, payer_district=address.district, payer_postal_code=postal_code.split('-')[0], payer_postal_code_complement=postal_code.split('-')[1], payer_city=address.city_location.city, payer_state=address.city_location.state, ) super(RecordQ, self).__init__(**kwargs)
def describe_item(self, client_view): details = [] birth_date = (client_view.birth_date and client_view.birth_date.strftime('%x')) for label, value in [ (_("Phone"), client_view.phone_number), (_("Mobile"), client_view.mobile_number), (self._person_l10n.label, client_view.cpf), (self._company_l10n.label, client_view.cnpj), (_("RG"), client_view.rg_number), (_("Birth date"), birth_date), (_("Category"), client_view.client_category), (_("Address"), format_address(client_view))]: if not value: continue details.append('%s: %s' % (label, api.escape(value))) name = "<big>%s</big>" % (api.escape(client_view.name), ) if details: short = name + '\n<span size="small">%s</span>' % ( api.escape(', '.join(details[:1]))) complete = name + '\n<span size="small">%s</span>' % ( api.escape('\n'.join(details))) else: short = name complete = name return short, complete
def __init__(self, payment, bank_info, **kwargs): person = payment.group.payer if person.company: payer_type = 2 doc = person.company.cnpj else: payer_type = 1 doc = person.individual.cpf raw_doc = ''.join(i for i in doc if i.isdigit()) address = person.get_main_address() postal_code = address.postal_code.replace('-', '') address_str = format_address(address, include_district=False) discount_value = bank_info.discount_percentage / 100 * payment.value interest_value = bank_info.interest_percentage / 100 * payment.value kwargs.update( numero_documento=str(payment.identifier), due_date=payment.due_date.strftime('%d%m%y'), value=payment.value, payment_description=payment.description, open_date=payment.open_date.strftime('%d%m%y'), aceite=bank_info.aceite, nosso_numero=bank_info.nosso_numero, # Payer data payer_type=payer_type, payer_document=raw_doc, payer_name=person.name, payer_address=address_str, payer_district=address.district, payer_postal_code=postal_code.split('-')[0], payer_city=address.city_location.city, payer_state=address.city_location.state, # Juros diário (em reais) interest_value=interest_value ) if discount_value: kwargs.update( # Desconto até o pagamento discount_date=payment.due_date.strftime('%d%m%y'), discount_value=discount_value, ) super(ItauPaymentDetail, self).__init__(**kwargs)
def __init__(self, payment, bank_info, **kwargs): person = payment.group.payer if person.company: payer_type = 2 doc = person.company.cnpj else: payer_type = 1 doc = person.individual.cpf raw_doc = ''.join(i for i in doc if i.isdigit()) address = person.get_main_address() postal_code = address.postal_code.replace('-', '') address_str = format_address(address, include_district=False) discount_value = bank_info.discount_percentage / 100 * payment.value interest_value = bank_info.interest_percentage / 100 * payment.value kwargs.update( numero_documento=str(payment.identifier), due_date=payment.due_date.strftime('%d%m%y'), value=payment.value, payment_description=payment.description, open_date=payment.open_date.strftime('%d%m%y'), aceite=bank_info.aceite, nosso_numero=bank_info.nosso_numero, # Payer data payer_type=payer_type, payer_document=raw_doc, payer_name=person.name, payer_address=address_str, payer_district=address.district, payer_postal_code=postal_code.split('-')[0], payer_city=address.city_location.city, payer_state=address.city_location.state, # Juros diário (em reais) interest_value=interest_value) if discount_value: kwargs.update( # Desconto até o pagamento discount_date=payment.due_date.strftime('%d%m%y'), discount_value=discount_value, ) super(ItauPaymentDetail, self).__init__(**kwargs)
def get_address_string(self): """Formats the address as a string :returns: the formatted address """ return format_address(self)