Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
3
sale_invoice_frequency/models/__init__.py
Executable file
3
sale_invoice_frequency/models/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
||||
from . import sale_invoice_frequency
|
||||
from . import res_partner
|
||||
from . import sale_order
|
||||
19
sale_invoice_frequency/models/res_partner.py
Executable file
19
sale_invoice_frequency/models/res_partner.py
Executable file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2023 Moduon Team S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
invoice_frequency_id = fields.Many2one(
|
||||
comodel_name="sale.invoice.frequency",
|
||||
string="Invoicing frequency",
|
||||
help="Invoicing frequency for this customer",
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _commercial_fields(self):
|
||||
return super()._commercial_fields() + ["invoice_frequency_id"]
|
||||
14
sale_invoice_frequency/models/sale_invoice_frequency.py
Executable file
14
sale_invoice_frequency/models/sale_invoice_frequency.py
Executable file
@@ -0,0 +1,14 @@
|
||||
# Copyright 2023 Moduon Team S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class SaleInvoiceFrequency(models.Model):
|
||||
_name = "sale.invoice.frequency"
|
||||
_description = "Invoicing frequency for Customers"
|
||||
|
||||
name = fields.Char(
|
||||
translate=True,
|
||||
)
|
||||
23
sale_invoice_frequency/models/sale_order.py
Executable file
23
sale_invoice_frequency/models/sale_order.py
Executable file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2023 Moduon Team S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
invoice_frequency_id = fields.Many2one(
|
||||
comodel_name="sale.invoice.frequency",
|
||||
string="Invoicing frequency",
|
||||
compute="_compute_invoice_frequency",
|
||||
store=True,
|
||||
readonly=False,
|
||||
help="Invoicing frequency for this order",
|
||||
)
|
||||
|
||||
@api.depends("partner_id")
|
||||
def _compute_invoice_frequency(self):
|
||||
for record in self:
|
||||
record.invoice_frequency_id = record.partner_id.invoice_frequency_id
|
||||
Reference in New Issue
Block a user