Skip to content

Commit

Permalink
modificari din 17
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu committed Oct 26, 2024
1 parent e710fbc commit 12ce9d1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion l10n_ro_stock_account_notice/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
6 changes: 6 additions & 0 deletions l10n_ro_stock_account_notice/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,24 @@ 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",
"invoice_in_notice",
]:
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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 12ce9d1

Please sign in to comment.