Skip to content

Commit

Permalink
Add partner_label and account_label
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed May 7, 2024
1 parent 0608deb commit ad53c8f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
7 changes: 6 additions & 1 deletion account_move_export/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _prepare_account_move_export_line(self, export_options):
else:
credit = 0.0
debit = export_options["company_currency"].round(self.amount * -1)
partner_code = None
partner_code = partner_label = None
if self.partner_id and (
(
export_options["partner_option"] in ("accounts", "receivable_payable")
Expand All @@ -29,13 +29,18 @@ def _prepare_account_move_export_line(self, export_options):
partner_code = self.partner_id._prepare_account_move_export_partner_code(
export_options
)
partner_label = self.partner_id._prepare_account_move_export_partner_label(
export_options
)
res = {
"type": "A",
"entry_number": move.name,
"date": self.date,
"journal_code": self.plan_id.name,
"account_code": self.account_id.code or self.account_id.name,
"account_label": self.account_id.name,
"partner_code": partner_code,
"partner_label": partner_label,
"item_label": self.name or None,
"debit": debit,
"credit": credit,
Expand Down
24 changes: 13 additions & 11 deletions account_move_export/models/account_move_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,22 +325,24 @@ def _prepare_columns(self):
"date": {"width": 10, "style": "date", "sequence": 30},
"journal_code": {"width": 10, "style": "char", "sequence": 40},
"account_code": {"width": 12, "style": "char", "sequence": 50},
"partner_code": {"width": 12, "style": "char", "sequence": 60},
"item_label": {"width": 50, "style": "char", "sequence": 70},
"debit": {"width": 10, "style": "company_currency", "sequence": 80},
"credit": {"width": 10, "style": "company_currency", "sequence": 90},
"entry_ref": {"width": 20, "style": "char", "sequence": 100},
"reconcile_ref": {"width": 10, "style": "char", "sequence": 110},
"due_date": {"width": 10, "style": "date", "sequence": 120},
"origin_currency_amount": {"width": 12, "style": "float", "sequence": 130},
"origin_currency_code": {"width": 12, "style": "char", "sequence": 140},
"account_label": {"width": 30, "style": "char", "sequence": 60},
"partner_code": {"width": 12, "style": "char", "sequence": 70},
"partner_label": {"width": 30, "style": "char", "sequence": 80},
"item_label": {"width": 50, "style": "char", "sequence": 90},
"debit": {"width": 10, "style": "company_currency", "sequence": 100},
"credit": {"width": 10, "style": "company_currency", "sequence": 110},
"entry_ref": {"width": 20, "style": "char", "sequence": 120},
"reconcile_ref": {"width": 10, "style": "char", "sequence": 130},
"due_date": {"width": 10, "style": "date", "sequence": 140},
"origin_currency_amount": {"width": 12, "style": "float", "sequence": 150},
"origin_currency_code": {"width": 12, "style": "char", "sequence": 160},
}
line_obj = self.env["account.move.line"]
if hasattr(line_obj, "start_date") and hasattr(line_obj, "end_date"):
cols.update(
{
"start_date": {"width": 10, "style": "date", "sequence": 150},
"end_date": {"width": 10, "style": "date", "sequence": 160},
"start_date": {"width": 10, "style": "date", "sequence": 170},
"end_date": {"width": 10, "style": "date", "sequence": 180},
}
)
return cols
Expand Down
7 changes: 6 additions & 1 deletion account_move_export/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def _prepare_account_move_export_line(self, export_options):
self.ensure_one()
assert self.display_type not in ("line_section", "line_note")
move = self.move_id
partner_code = None
partner_code = partner_label = None
if self.partner_id and (
(
export_options["partner_option"] in ("accounts", "receivable_payable")
Expand All @@ -23,13 +23,18 @@ def _prepare_account_move_export_line(self, export_options):
partner_code = self.partner_id._prepare_account_move_export_partner_code(
export_options
)
partner_label = self.partner_id._prepare_account_move_export_partner_label(
export_options
)
res = {
"type": "G",
"entry_number": move.name,
"date": move.date,
"journal_code": move.journal_id.code,
"account_code": self.account_id.code,
"account_label": self.account_id.name,
"partner_code": partner_code,
"partner_label": partner_label,
"item_label": self.name or None,
"debit": export_options["company_currency"].round(self.debit),
"credit": export_options["company_currency"].round(self.credit),
Expand Down
4 changes: 4 additions & 0 deletions account_move_export/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ def _prepare_account_move_export_partner_code(self, export_options):
elif export_options["partner_code_field"] == "ref":
res = self.ref or None
return res

def _prepare_account_move_export_partner_label(self, export_options):
self.ensure_one()
return self.name

0 comments on commit ad53c8f

Please sign in to comment.