Managed to get the sku doing the same thing as the previous code.

This commit is contained in:
counterweight 2023-09-06 14:20:28 +02:00
parent f3776966bc
commit 83743ca526
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
5 changed files with 43 additions and 13 deletions

View file

@ -13,7 +13,11 @@ from camisatoshi_wordpress_reports.constants import (
DEFAULT_DOTENV_FILEPATH,
bbo_royalty_fee,
)
from camisatoshi_wordpress_reports.report_building import ReportChainBuilder, WoocomerceOrderScope, keep_orders_containing_sku
from camisatoshi_wordpress_reports.report_building import (
ReportChainBuilder,
WoocomerceOrderScope,
keep_orders_containing_sku,
)
API_CONFIG = dotenv_values(
dotenv_path=Path.home() / Path(DEFAULT_DOTENV_FILEPATH)
@ -25,7 +29,6 @@ WC_API = API(
version=API_CONFIG["VERSION"],
)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
@ -189,15 +192,12 @@ def wip_generate_sku_report(start_date, end_date, sku):
wc_order_scope=WoocomerceOrderScope(
after=start_date.isoformat(),
before=end_date.isoformat(),
status="processing,completed"
status="processing,completed",
)
)
report_chain_builder.add_order_filtering_step(
partial(
keep_orders_containing_sku,
sku=sku
)
partial(keep_orders_containing_sku, sku=sku)
)
report_chain = report_chain_builder.get_report_chain()