Skip to content

Commit

Permalink
Merge 401d356 into 963084d
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaGD committed Dec 12, 2018
2 parents 963084d + 401d356 commit 652e2fa
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 16 deletions.
3 changes: 3 additions & 0 deletions br_payment_cnab/bancos/bradesco.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def _get_segmento(self, line, lot_sequency, num_lot, nome_segmento):
(not line.payment_information_id.cod_recolhimento_fgts)):
return None
segmento.update({
'numero_parcela': int(segmento.get('numero_parcela')[:13]),
'divida_ativa_etiqueta': int(
segmento.get('divida_ativa_etiqueta')[:13]),
'tipo_movimento': int(segmento.get('tipo_movimento')),
'codigo_camara_compensacao': self._string_to_num(
segmento.get('codigo_camara_compensacao')),
Expand Down
3 changes: 3 additions & 0 deletions br_payment_cnab/bancos/itau.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def _get_segmento(self, line, lot_sequency, num_lot, nome_segmento):
line.payment_information_id.payment_type)
del(segmento['codigo_camara_compensacao'])
segmento.update({
'numero_parcela': int(segmento.get('numero_parcela')[:13]),
'divida_ativa_etiqueta': int(
segmento.get('divida_ativa_etiqueta')[:13]),
'identificador_fgts': self._string_to_num(
segmento.get('identificador_fgts')),
'tipo_movimento': int(segmento.get('tipo_movimento')),
Expand Down
5 changes: 4 additions & 1 deletion br_payment_cnab/bancos/santander.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def _get_segmento(self, line, lot_sequency, num_lot, nome_segmento):
(not line.payment_information_id.cod_recolhimento_fgts)):
return None
segmento.update({
'numero_parcela': int(segmento.get('numero_parcela')[:13]),
'divida_ativa_etiqueta': int(
segmento.get('divida_ativa_etiqueta')[:13]),
'tipo_identificacao_contribuinte': 2, # CNPJ
'tipo_identificacao_contribuinte_alfa': '2', # CNPJ
'favorecido_conta': self._string_to_num(
Expand Down Expand Up @@ -117,6 +120,6 @@ def segments_per_operation(self):
"17": ["SegmentoN_GPS"],
"16": ["SegmentoN_DarfNormal"],
"18": ["SegmentoN_DarfSimples"],
"22": ["SegmentoN_GareSP"],
"22": ["SegmentoN_GareSP", "SegmentoW"],
})
return segments
3 changes: 3 additions & 0 deletions br_payment_cnab/models/payment_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def name_get(self):
('09', 'Real')],
string="Currency code", default='09')

numero_parcela_icms = fields.Integer('Número da parcela/notificação')
divida_ativa_etiqueta = fields.Integer('Dívida ativa/número da etiqueta')

message1 = fields.Char(string='Note Header', size=40, default='')

credit_hist_code = fields.Selection(
Expand Down
4 changes: 4 additions & 0 deletions br_payment_cnab/models/payment_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class PaymentMode(models.Model):

cod_recolhimento = fields.Integer('Código de Recolhimento do FGTS')

conec_social_dv_fgts = fields.Integer("DV do conectividade Social")

conec_social_fgts = fields.Integer("Lacre do conectividade social")

percentual_receita_bruta_acumulada = fields.Char(
string='Percentual de Receita Bruta Acumulada',
help='Percentual decorrente da receita bruta acumulada a ser aplicado\
Expand Down
13 changes: 12 additions & 1 deletion br_payment_cnab/models/payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ def validate_payment_type_02(self, payment_mode, vals):
errors += self.validate_bank_account(vals)
return errors

# ICMS
def validate_payment_type_09(self, payment_mode, vals):
errors = []
if not payment_mode.journal_id.company_id.inscr_est:
errors += ['Preencha a Inscrição Estadual da Empresa!']
return errors

# Pagamento de Títulos Bancários
def validate_payment_type_03(self, payment_mode, vals):
# Pagamento mensal pode salvar sem código de barras
Expand Down Expand Up @@ -227,6 +234,8 @@ def get_service_type(self, payment_mode):

def get_information_vals(self, payment_mode_id, vals):
return {
'divida_ativa_etiqueta': vals.get('divida_ativa_etiqueta'),
'numero_parcela_icms': vals.get('numero_parcela_icms'),
'payment_type': payment_mode_id.payment_type,
'mov_finality': payment_mode_id.mov_finality,
'operation_code': self.get_operation_code(payment_mode_id),
Expand All @@ -237,7 +246,9 @@ def get_information_vals(self, payment_mode_id, vals):
'numero_referencia': payment_mode_id.numero_referencia,
'cod_recolhimento_fgts': payment_mode_id.cod_recolhimento,
'identificacao_fgts': payment_mode_id.identificacao_fgts,
'l10n_br_environment': payment_mode_id.l10n_br_environment
'l10n_br_environment': payment_mode_id.l10n_br_environment,
'conec_social_dv_fgts': payment_mode_id.conec_social_dv_fgts,
'conec_social_fgts': payment_mode_id.conec_social_fgts,
}

def action_generate_payment_order_line(self, payment_mode, vals):
Expand Down
2 changes: 2 additions & 0 deletions br_payment_cnab/serialize/cnab240.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def _get_header_arq(self):
def _get_segmento(self, line, lot_sequency, num_lot, nome_segmento):
information_id = line.payment_information_id
segmento = {
'numero_parcela': str(information_id.numero_parcela_icms),
'divida_ativa_etiqueta': str(information_id.divida_ativa_etiqueta),
"cedente_inscricao_numero": self._string_to_num(
self._order.company_id.cnpj_cpf),
"identificador_fgts": information_id.identificacao_fgts,
Expand Down
2 changes: 2 additions & 0 deletions br_payment_cnab/views/payment_mode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<field name="percentual_receita_bruta_acumulada" attrs="{'invisible': [('payment_type', '!=', '07')]}" />
<field name="identificacao_fgts" attrs="{'invisible': [('payment_type', '!=', '08')]}" />
<field name="cod_recolhimento" attrs="{'invisible': [('payment_type', '!=', '08')]}" />
<field name='conec_social_fgts' attrs="{'invisible': [('payment_type', '!=', '08')]}"/>
<field name='conec_social_dv_fgts' attrs="{'invisible': [('payment_type', '!=', '08')]}"/>
</group>
<div>
<h4>Manuais de configuração</h4>
Expand Down
12 changes: 6 additions & 6 deletions br_payment_cnab/views/payment_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
<field name="type">form</field>
<field name="arch" type="xml" >
<field name="nosso_numero" position="after">
<field name="linha_digitavel" />
<field name="barcode" />
<field name="cnab_code" />
<field name="cnab_message" />
<field name="autenticacao_pagamento" />
<field name="protocolo_pagamento"/>
<field name="linha_digitavel"/>
<field name="barcode"/>
<field name="cnab_code" attrs="{'invisible': [('state', 'not in', ('paid', 'processed', 'rejected'))]}"/>
<field name="cnab_message" attrs="{'invisible': [('state', 'not in', ('paid', 'processed', 'rejected'))]}"/>
<field name="autenticacao_pagamento" attrs="{'invisible': [('state', 'not in', ('paid', 'processed', 'rejected'))]}"/>
<field name="protocolo_pagamento" attrs="{'invisible': [('state', 'not in', ('paid', 'processed', 'rejected'))]}"/>
</field>
<field name="emission_date" position="after">
<field name="invoice_date"/>
Expand Down
15 changes: 9 additions & 6 deletions br_payment_cnab_voucher/models/account_voucher.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ class AccountVoucher(models.Model):
fine_value = fields.Float(
'Fine Value', readonly=True, states={'draft': [('readonly', False)]})

conec_social_fgts = fields.Char(
string='Lacre Conectividade Social', size=16)
conec_social_dv_fgts = fields.Char(
string='Dígito do Lacre CS', size=9)
numero_parcela_icms = fields.Integer(
'Número da parcela/notificação', readonly=True,
states={'draft': [('readonly', False)]})

divida_ativa_etiqueta = fields.Integer(
'Dívida ativa/número da etiqueta', readonly=True,
states={'draft': [('readonly', False)]})

_sql_constraints = [
('account_voucher_barcode_uniq', 'unique (barcode)',
Expand Down Expand Up @@ -118,6 +121,8 @@ def _prepare_payment_order_vals(self):
move_line_id = self.move_id.line_ids.filtered(
lambda x: x.account_id == self.account_id)
return {
'numero_parcela_icms': self.numero_parcela_icms,
'divida_ativa_etiqueta': self.divida_ativa_etiqueta,
'partner_id': self.partner_id.id,
'amount_total':
self.amount - self.fine_value - self.interest_value,
Expand All @@ -131,8 +136,6 @@ def _prepare_payment_order_vals(self):
'invoice_date': self.date,
'barcode': self.barcode,
'linha_digitavel': self.linha_digitavel,
'conec_social_fgts': self.conec_social_fgts,
'conec_social_dv_fgts': self.conec_social_dv_fgts,
# TODO Ajustar o valor de multa e de juros
# 'fine_value': self.fine_value,
# 'interest_value': self.interest_value,
Expand Down
4 changes: 2 additions & 2 deletions br_payment_cnab_voucher/views/account_voucher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<field name="company_id" position="after">
<field name="payment_mode_id" domain="[('type', '=', 'payable')]" />
<field name="payment_type" invisible="1" />
<field name='conec_social_fgts' attrs="{'invisible': [('payment_type', '!=', '08')]}"/>
<field name='conec_social_dv_fgts' attrs="{'invisible': [('payment_type', '!=', '08')]}"/>
<field name="bank_account_id" attrs="{'invisible': [('payment_type', 'not in', ('01', '02'))]}" domain="[('partner_id', '=', partner_id)]"/>
<field name="numero_parcela_icms" attrs="{'invisible': [('payment_type', '!=', '09')]}"/>
<field name="divida_ativa_etiqueta" attrs="{'invisible': [('payment_type', '!=', '09')]}"/>
</field>
<field name="tax_amount" position="before">
<field name="interest_value" widget="monetary"/>
Expand Down

0 comments on commit 652e2fa

Please sign in to comment.