mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX] account_move_line_rma_order_line: Force to trigger again the init hook.
As the script was incorrect in previous versions.
This commit is contained in:
committed by
AlexPForgeFlow
parent
f3bf3f3b3f
commit
86fadeb438
@@ -14,19 +14,19 @@ def post_init_hook(cr, registry):
|
||||
aml_moves = aml_model.search([("rma_line_id", "!=", False)])
|
||||
sm_moves = sm_model.search([("rma_line_id", "!=", False)])
|
||||
for account_move in aml_moves.mapped("move_id"):
|
||||
for aml_w_rma in account_move.invoice_line_ids.filtered(
|
||||
for aml_w_rma in account_move.line_ids.filtered(
|
||||
lambda x: x.product_id
|
||||
and x.account_id.id
|
||||
!= x.product_id.categ_id.property_stock_valuation_account_id.id
|
||||
and x.rma_line_id
|
||||
):
|
||||
invoice_lines_without_rma = account_move.invoice_line_ids.filtered(
|
||||
move_lines_without_rma = account_move.line_ids.filtered(
|
||||
lambda x: x.product_id.id == aml_w_rma.product_id.id
|
||||
and not x.rma_line_id
|
||||
and aml_w_rma.name in x.name
|
||||
)
|
||||
if invoice_lines_without_rma:
|
||||
invoice_lines_without_rma.write(
|
||||
if move_lines_without_rma:
|
||||
move_lines_without_rma.write(
|
||||
{
|
||||
"rma_line_id": aml_w_rma.rma_line_id.id,
|
||||
}
|
||||
@@ -37,5 +37,6 @@ def post_init_hook(cr, registry):
|
||||
for aml in current_layers.mapped("account_move_id.line_ids").filtered(
|
||||
lambda x: x.account_id.id
|
||||
!= move.product_id.categ_id.property_stock_valuation_account_id.id
|
||||
and not x.rma_line_id
|
||||
):
|
||||
aml.rma_line_id = move.rma_line_id.id
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"name": "Account Move Line Rma Order Line",
|
||||
"summary": "Introduces the rma order line to the journal items",
|
||||
"version": "14.0.1.0.0",
|
||||
"version": "14.0.1.1.0",
|
||||
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/ForgeFlow/stock-rma",
|
||||
"category": "Generic",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# Part of ForgeFlow. See LICENSE file for full copyright and licensing details.
|
||||
import logging
|
||||
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
from odoo.addons.account_move_line_rma_order_line import post_init_hook
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
_logger.info("Trigger again the post_init_hook")
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
post_init_hook(cr, env.registry)
|
||||
Reference in New Issue
Block a user