40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
# Part of the Fusion Plating product family.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class FpInvoiceStrategyDefault(models.Model):
|
|
"""Customer-level default invoice strategy.
|
|
|
|
When a new sale order is created for this customer, the invoice
|
|
strategy and deposit percentage auto-fill from this record.
|
|
"""
|
|
_name = 'fp.invoice.strategy.default'
|
|
_description = 'Fusion Plating — Invoice Strategy Default'
|
|
_order = 'partner_id'
|
|
|
|
partner_id = fields.Many2one(
|
|
'res.partner', string='Customer', required=True, ondelete='cascade',
|
|
domain="[('customer_rank', '>', 0)]",
|
|
)
|
|
default_strategy = fields.Selection(
|
|
[('deposit', 'Deposit'), ('progress', 'Progress Billing'),
|
|
('net_terms', 'Net Terms'), ('cod_prepay', 'COD / Prepay')],
|
|
string='Default Strategy', required=True,
|
|
)
|
|
default_deposit_percent = fields.Float(
|
|
string='Deposit %', help='Deposit percentage if strategy is Deposit (e.g. 50.0).',
|
|
)
|
|
payment_term_id = fields.Many2one(
|
|
'account.payment.term', string='Payment Terms',
|
|
)
|
|
notes = fields.Text(string='Notes')
|
|
|
|
_sql_constraints = [
|
|
('fp_invoice_strategy_partner_uniq', 'unique(partner_id)',
|
|
'Only one invoice strategy default per customer.'),
|
|
]
|