-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathhooks.py
More file actions
25 lines (22 loc) · 724 Bytes
/
hooks.py
File metadata and controls
25 lines (22 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright 2024 ACSONE SA/NV (<https://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
from odoo.api import SUPERUSER_ID, Environment
def pre_init_hook(cr):
"""
Create the sale order invoice policy with the "product" policy (standard)
but with a postgres query to avoid an update on all sale order records
"""
env = Environment(cr, SUPERUSER_ID, {})
field_spec = [
(
"invoice_policy",
"sale.order",
False,
"selection",
False,
"sale_invoice_policy",
"product",
)
]
openupgrade.add_fields(env, field_spec=field_spec)