Skip to content

Commit

Permalink
[IMP] account_invoice_batches: allow inheriting the selectable option…
Browse files Browse the repository at this point in the history
…s of the selection for the batch sending method
  • Loading branch information
FrankC013 committed Oct 9, 2024
1 parent 275c96c commit 48bd499
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
1 change: 0 additions & 1 deletion account_invoice_batches/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from . import res_company
from . import res_config_settings
from . import common
from . import res_partner
from . import account_move
from . import sale
Expand Down
4 changes: 1 addition & 3 deletions account_invoice_batches/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from odoo import api, fields, models

from .common import BATCH_SENDING_METHODS


class AccountMove(models.Model):
_inherit = "account.move"
Expand All @@ -18,7 +16,7 @@ class AccountMove(models.Model):
copy=False,
)
invoice_batch_sending_method = fields.Selection(
selection=BATCH_SENDING_METHODS,
selection=lambda self: self.env["res.partner"]._get_batch_sending_methods(),
string="Sending method",
tracking=True,
)
Expand Down
12 changes: 0 additions & 12 deletions account_invoice_batches/models/common.py

This file was deleted.

15 changes: 11 additions & 4 deletions account_invoice_batches/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@
# Eric Antones <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import fields, models

from .common import BATCH_SENDING_METHODS
from odoo import _, api, fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

@api.model
def _get_batch_sending_methods(self):
return [
("pdf", _("PDF")),
("email", _("e-mail")),
("signedfacturae", _("Factura-e signed")),
("unsignedfacturae", _("Factura-e unsigned")),
]

invoice_batch_sending_method = fields.Selection(
selection=BATCH_SENDING_METHODS,
selection=lambda self: self._get_batch_sending_methods(),
string="Invoice Batch Sending method",
required=True,
default="pdf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
name="invoice_batch_sending_email_template_id"
attrs="{'invisible': [('invoice_batch_sending_email', '=', False)]}"
/>
<newline />
<field name="invoice_batch_sending_signedfacturae" />
<newline />
<field name="invoice_batch_sending_unsignedfacturae" />
Expand Down

0 comments on commit 48bd499

Please sign in to comment.