nuevo addon product_state desde OCA/product_attribute
This commit is contained in:
parent
ada6c142c9
commit
2954c8694f
23 changed files with 2254 additions and 0 deletions
17
product_state/hooks.py
Normal file
17
product_state/hooks.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# Copyright 2020 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
""" This hook is used to add a state on existing products
|
||||
when module product_state is installed.
|
||||
"""
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
product_without_state = env["product.template"].with_context(
|
||||
active_test=False,
|
||||
).search(
|
||||
[("product_state_id", "=", False), ("state", "!=", False)]
|
||||
)
|
||||
product_without_state._inverse_product_state()
|
||||
Loading…
Add table
Add a link
Reference in a new issue