Skip to content

Commit

Permalink
initial fixes for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandomr committed Aug 5, 2016
1 parent b263006 commit 588cf8e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def _prepare_header(self):
vals['cedente_dv_ag_cc'])
vals['cedente_agencia_dv'] = int(
vals['cedente_agencia_dv'])

# Company's Razão Social limited to 30 chars
vals['cedente_nome'] = (vals['cedente_nome'][:30])

return vals

def _prepare_segmento(self, line):
Expand All @@ -78,6 +82,10 @@ def _prepare_segmento(self, line):
vals['nosso_numero_dv'] = int(self.nosso_numero_dv(reference))
vals['sacado_cidade'] = line.partner_id.l10n_br_city_id.name[:15]
vals['sacado_bairro'] = line.partner_id.district[:15]

# Partner's legal name 30 chars restriction
vals['sacado_nome'] = vals['sacado_nome'][:30]

return vals

# Override cnab_240.nosso_numero. Diferentes números de dígitos entre
Expand Down
20 changes: 13 additions & 7 deletions l10n_br_account_banking_payment_cnab/model/payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def validate_order(self):
if self.mode_type.code not in ['240', '400', '500']:
raise Warning("Payment Type Code must be 240, 400 or 500, found %s" % self.mode_type.code)
# legal name max length is accepted 30 chars
if len(self.company_id.legal_name) > 30:
raise Warning("Company's Rezão Social should not be longer than 30 chars")
# Yes, but since this is a CNAB file restriction, crop the string at the 30 char. Moved to itau.py

This comment has been minimized.

Copy link
@yk2kus

yk2kus Aug 5, 2016

Agreed, we were making this change today 👍

This comment has been minimized.

Copy link
@fernandomr

fernandomr via email Aug 5, 2016

Author Collaborator

if not self.mode.boleto_protesto:
raise Warning(u"Códigos de Protesto in payment mode not defined")
if not self.mode.boleto_protesto_prazo:
Expand All @@ -75,9 +75,11 @@ def validate_order(self):
if not line.partner_id:
raise Warning("Partner not defined for %s" %line.name)
if not line.partner_id.legal_name:
raise Warning("Rezão Social not defined for %s" %line.partner_id.name)
if len(line.partner_id.legal_name) > 30:
raise Warning("Partner's Rezão Social should not be longer than 30 chars")
raise Warning("Razão Social not defined for %s" %line.partner_id.name)

# if len(line.partner_id.legal_name) > 30:
# raise Warning("Partner's Razão Social should not be longer than 30 chars") -> moved to itau.py

if not line.partner_id.state_id:
raise Warning("Partner's state not defined")
if not line.partner_id.state_id.code:
Expand All @@ -91,8 +93,12 @@ def validate_order(self):
raise Warning("Partner's city not defined")
if not line.partner_id.street:
raise Warning("Partner's street not defined")
if not line.move_line_id.transaction_ref:
raise Warning("No transaction reference set for move %s" % line.move_line_id.name)

# FIXME transaction_ref might not be known at the time of exportation.
# Is that a rule for Itau or one possibilitie?
# if not line.move_line_id.transaction_ref:
# raise Warning("No transaction reference set for move %s" % line.move_line_id.name)

# Itau code : 341 supposed not to be larger than 8 digits
if self.mode.bank_id.bank.bic == '341':
try:
Expand Down

0 comments on commit 588cf8e

Please sign in to comment.