Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions product_replenishment_cost/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools import float_compare

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -44,7 +43,7 @@ class ProductTemplate(models.Model):
replenishment_base_cost = fields.Float(
digits="Product Price",
tracking=True,
help="Replanishment Cost expressed in 'Replenishment Base Cost " "Currency'.",
help="Replanishment Cost expressed in 'Replenishment Base Cost Currency'.",
)
replenishment_base_cost_currency_id = fields.Many2one(
"res.currency",
Expand Down Expand Up @@ -111,12 +110,6 @@ def cron_update_cost_from_replenishment_cost(self, limit=None, company_ids=None,
tampoco podemos usar get_param porque justamente no se va a refrescar el valor
"""

# allow force_company for backward compatibility
force_company = self._context.get("force_company", False)
if force_company and company_ids:
raise ValidationError(
_("The argument 'company_ids' and the key 'force_company' on the context can't be used together")
)
# buscamos cual fue el ultimo registro actualziado
parameter_name = "product_replenishment_cost.last_updated_record_id"
last_updated_param = self.env["ir.config_parameter"].sudo().search([("key", "=", parameter_name)], limit=1)
Expand All @@ -126,10 +119,8 @@ def cron_update_cost_from_replenishment_cost(self, limit=None, company_ids=None,
domain = [("id", ">", int(last_updated_param.value))]
records = self.with_context(prefetch_fields=False).search(domain, order="id asc")

# use company_ids or force_company or search for all companies
if force_company:
company_ids = [force_company]
elif not company_ids:
# use company_ids or search for all companies
if not company_ids:
company_ids = self.env["res.company"].search([]).ids

for company_id in company_ids:
Expand Down
Loading