From 12ce9d18bc00863b2d2c8dc182e108f3d07a6cf6 Mon Sep 17 00:00:00 2001 From: Dorin Hongu Date: Sat, 26 Oct 2024 07:31:47 +0300 Subject: [PATCH] modificari din 17 --- l10n_ro_stock_account_notice/models/account_move_line.py | 3 ++- l10n_ro_stock_account_notice/models/product.py | 6 ++++++ .../models/account_move_line.py | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/l10n_ro_stock_account_notice/models/account_move_line.py b/l10n_ro_stock_account_notice/models/account_move_line.py index 276a2f85c..b97227a50 100644 --- a/l10n_ro_stock_account_notice/models/account_move_line.py +++ b/l10n_ro_stock_account_notice/models/account_move_line.py @@ -17,7 +17,8 @@ def _compute_account_id(self): l10n_ro_lines_for_notice = self.filtered( lambda x: x.product_id.type == "product" and x.is_l10n_ro_record ) - remaining = self + valued_type = self.env.context.get("valued_type", self.move_id.move_type) + remaining = self.with_context(valued_type=valued_type) invoice_in_notice_lines = self.env["account.move.line"].with_context( valued_type="invoice_in_notice" ) diff --git a/l10n_ro_stock_account_notice/models/product.py b/l10n_ro_stock_account_notice/models/product.py index 93cacb9ef..c49d24cda 100644 --- a/l10n_ro_stock_account_notice/models/product.py +++ b/l10n_ro_stock_account_notice/models/product.py @@ -33,6 +33,9 @@ def _get_product_accounts(self): valued_type = self.env.context.get("valued_type", "indefinite") + if self.type != "service" and valued_type == "in_invoice": + accounts["expense"] = accounts["stock_valuation"] + # in nir si factura se ca utiliza 408 if valued_type in [ "reception_notice", @@ -40,11 +43,14 @@ def _get_product_accounts(self): ]: if stock_picking_payable_account_id: accounts["stock_input"] = stock_picking_payable_account_id + accounts["expense"] = stock_picking_payable_account_id elif valued_type in [ "reception_notice_return", ]: if stock_picking_payable_account_id: + accounts["stock_input"] = stock_picking_payable_account_id accounts["stock_output"] = stock_picking_payable_account_id + accounts["expense"] = stock_picking_payable_account_id # in aviz si factura client se va utiliza 418 elif valued_type == "invoice_out_notice": if stock_picking_receivable_account_id: diff --git a/l10n_ro_stock_account_reception_in_progress/models/account_move_line.py b/l10n_ro_stock_account_reception_in_progress/models/account_move_line.py index 92e878c40..f2b01dabf 100644 --- a/l10n_ro_stock_account_reception_in_progress/models/account_move_line.py +++ b/l10n_ro_stock_account_reception_in_progress/models/account_move_line.py @@ -11,13 +11,17 @@ class AccountMoveLine(models.Model): def _compute_account_id(self): remaining = self reception_in_progress_lines = self.env["account.move.line"].with_context( - l10n_ro_reception_in_progress=True + l10n_ro_reception_in_progress=True, valued_type="reception_in_progress" ) for linie in self: if linie.product_id.type == "product" and linie.is_l10n_ro_record: if linie.move_id.is_purchase_document(): purchase = linie.purchase_order_id - if purchase and linie.product_id.purchase_method == "receive": + if ( + purchase + and purchase.l10n_ro_reception_in_progress + and linie.product_id.purchase_method == "receive" + ): reception_in_progress_lines |= linie remaining -= linie if reception_in_progress_lines: