Skip to content

Commit

Permalink
FIX facto_bpce: error field on move
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Oct 9, 2023
1 parent a6a1d99 commit c465fc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion account_factoring_receivable_balance_bpce/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class ResCompany(models.Model):

bpce_factor_code = fields.Char(size=6, help="N° de compte chez PBCE")
bpce_start_date = fields.Date(
string="Start Date", help="No account move will be selected before this date"
string="Start Date",
tracking=True,
help="No account move will be selected before this date",
)

def ui_configure_bpce_factoring_balance(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def _get_domain_for_factor(
partner_selection_field=partner_selection_field,
currency=currency,
)
domain = [("date", ">=", self.env.user.company_id.bpce_start_date)] + domain
if self.env.user.company_id.bpce_start_date:
domain = [("date", ">=", self.env.user.company_id.bpce_start_date)] + domain
return domain

def _get_bpce_header(self):
Expand Down Expand Up @@ -125,9 +126,10 @@ def _get_bpce_body(self):
for line in self.line_ids:
move = line.move_id
partner = line.move_id.partner_id.commercial_partner_id
if not partner:
raise UserError(f"Pas de partenaire sur la pièce {line.move_id}")
sequence += 1
name = pad(move.name, 30, position="left")
# piece = pad(move.name, 30, position="left")
p_type = get_type_piece(move)
total = move.amount_total_in_currency_signed
info = {
Expand Down Expand Up @@ -194,8 +196,8 @@ def get_type_piece(move):
lambda s: s.account_id.group_id == s.env.ref("l10n_fr.1_pcg_411")
)
for line in lines:
if max(line.debit, line.credit) == move.debit:
if line.debit == move.debit:
if max(line.debit, line.credit) == move.amount_total:
if line.debit == move.amount_total:
od_type = "D"
else:
od_type = "C"
Expand Down

0 comments on commit c465fc0

Please sign in to comment.