def get_record(self): record = Record(aeat347.PROPERTY_RECORD) record.party_nif = self.party_vat record.representative_nif = self.representative_vat record.party_name = self.party_name record.amount = self.amount record.situation = self.situation record.cadaster_number = self.cadaster_number record.road_type = self.road_type record.street = self.street record.number_type = self.number_type record.number = self.number record.number_qualifier = self.number_qualifier record.block = self.block record.doorway = self.doorway record.stair = self.stair record.floor = self.floor record.door = self.door record.complement = self.complement record.city = self.city record.municipality = self.municipality record.municipality_code = self.municipality_code record.province_code = self.province_code record.zip = self.zip return record
def create_file(self): records = [] record = Record(aeat347.PRESENTER_HEADER_RECORD) record.fiscalyear = str(self.fiscalyear_code) record.nif = self.company_vat record.presenter_name = self.company.party.name record.support_type = self.support_type record.contact_phone = self.contact_phone record.contact_name = self.contact_name record.declaration_number = int('347{}{:0>6}'.format( self.fiscalyear_code, self.auto_sequence())) record.previous_declaration_number = self.previous_number record.party_count = len(self.parties) record.party_amount = self.party_amount record.property_count = len(self.properties) record.property_amount = self.property_amount or Decimal('0.0') record.representative_nif = self.representative_vat records.append(record) for line in itertools.chain(self.parties, self.properties): record = line.get_record() record.fiscalyear = str(self.fiscalyear_code) record.nif = self.company_vat records.append(record) data = retrofix_write(records) data = remove_accents(data).upper() if isinstance(data, str): data = data.encode('iso-8859-1') self.file_ = self.__class__.file_.cast(data) self.save()
def get_record(self): record = Record(aeat347.PARTY_RECORD) record.party_nif = self.party_vat record.community_vat = self.community_vat or '' record.representative_nif = self.representative_vat or '' record.party_name = remove_accents(self.party_name) record.province_code = self.province_code if self.country_code == 'ES': record.country_code = '' else: record.country_code = self.country_code record.operation_key = self.operation_key record.amount = self.amount record.insurance = self.insurance record.business_premises_rent = self.business_premises_rent record.cash_amount = self.cash_amount or _ZERO record.vat_liable_property_amount = self.property_amount \ or Decimal('0.0') record.fiscalyear_cash_operation = str( self.fiscalyear_code_cash_operation or '') record.first_quarter_amount = self.first_quarter_amount record.first_quarter_property_amount = ( self.first_quarter_property_amount) record.second_quarter_amount = self.second_quarter_amount record.second_quarter_property_amount = ( self.second_quarter_property_amount) record.third_quarter_amount = self.third_quarter_amount record.third_quarter_property_amount = ( self.third_quarter_property_amount) record.fourth_quarter_amount = self.fourth_quarter_amount record.fourth_quarter_property_amount = ( self.fourth_quarter_property_amount) record.cash_vat_operation = self.cash_vat_operation record.cash_vat_criteria = (self.cash_vat_criteria or Decimal('0.0') if self.cash_vat_operation else Decimal('0.0')) record.tax_person_operation = self.tax_person_operation record.related_goods_operation = self.related_goods_operation return record