diff --git a/stock_valuation_xlsx/__manifest__.py b/stock_valuation_xlsx/__manifest__.py index 7476e31..6a7e775 100644 --- a/stock_valuation_xlsx/__manifest__.py +++ b/stock_valuation_xlsx/__manifest__.py @@ -6,7 +6,7 @@ { 'name': 'Stock Valuation XLSX', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Generate XLSX reports for past or present stock levels', diff --git a/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py b/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py index 5075825..79e4823 100644 --- a/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py +++ b/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py @@ -153,7 +153,7 @@ class StockValuationXlsx(models.TransientModel): self, company_id, in_stock_product_ids, standard_price_past_date=False): self.ensure_one() logger.debug('Start compute_product_data') - ppo = self.env['product.product'] + ppo = self.env['product.product'].with_context(force_company=company_id) ppho = self.env['product.price.history'] fields_list = self._prepare_product_fields() if not standard_price_past_date: @@ -392,9 +392,13 @@ class StockValuationXlsx(models.TransientModel): elif self.source == 'inventory': past_date = self.inventory_id.date data, in_stock_products = self.compute_data_from_inventory(product_ids, prec_qty) - standard_price_past_date = past_date - if not (self.source == 'stock' and self.stock_date_type == 'present') and self.standard_price_date == 'present': + if self.source == 'stock' and self.stock_date_type == 'present': standard_price_past_date = False + else: # field standard_price_date is shown on screen + if self.standard_price_date == 'present': + standard_price_past_date = False + else: + standard_price_past_date = past_date depreciation_rules = [] if apply_depreciation: depreciation_rules = self._prepare_expiry_depreciation_rules(company_id, past_date) diff --git a/stock_valuation_xlsx/wizard/stock_variation_xlsx.py b/stock_valuation_xlsx/wizard/stock_variation_xlsx.py index 64231d2..4781b89 100644 --- a/stock_valuation_xlsx/wizard/stock_variation_xlsx.py +++ b/stock_valuation_xlsx/wizard/stock_variation_xlsx.py @@ -121,7 +121,7 @@ class StockVariationXlsx(models.TransientModel): self, company_id, filter_product_ids, standard_price_start_date=False, standard_price_end_date=False): self.ensure_one() logger.debug('Start compute_product_data') - ppo = self.env['product.product'] + ppo = self.env['product.product'].with_context(force_company=company_id) ppho = self.env['product.price.history'] fields_list = self._prepare_product_fields() if not standard_price_start_date or not standard_price_end_date: @@ -277,7 +277,7 @@ class StockVariationXlsx(models.TransientModel): standard_price_start_date = standard_price_end_date = False if self.standard_price_start_date_type == 'start': standard_price_start_date = self.start_date - if self.standard_price_end_date_type == 'end': + if self.standard_price_end_date_type == 'end' and self.end_date_type == 'past': standard_price_end_date = self.end_date product_id2data = self.compute_product_data(