odoo_utility_scripts/check_pos_rounding.py

34 lines
1.5 KiB
Python

import sys
def check_pos_rounding(env):
source_name = 'Kedai Kipas 58 Rungkut'
target_name = 'Kedai Kipas 58 Tenggilis'
source_company = env['res.company'].search([('name', 'ilike', source_name)], limit=1)
target_company = env['res.company'].search([('name', 'ilike', target_name)], limit=1)
if not source_company or not target_company:
print(f"Could not find one or both companies: '{source_name}', '{target_name}'")
return
print("--- Rungkut POS Configs (Source) ---")
source_configs = env['pos.config'].with_context(active_test=False).search([
('company_id', '=', source_company.id)
])
for c in source_configs:
print(f"[{c.name}] cash_rounding: {c.cash_rounding}")
print(f"[{c.name}] rounding_method: {c.rounding_method.name if c.rounding_method else 'None'} (ID: {c.rounding_method.id if c.rounding_method else 'None'})")
print(f"[{c.name}] only_round_cash_method: {c.only_round_cash_method}")
print("\n--- Tenggilis POS Configs (Target) ---")
target_configs = env['pos.config'].with_context(active_test=False).search([
('company_id', '=', target_company.id)
])
for c in target_configs:
print(f"[{c.name}] cash_rounding: {c.cash_rounding}")
print(f"[{c.name}] rounding_method: {c.rounding_method.name if c.rounding_method else 'None'} (ID: {c.rounding_method.id if c.rounding_method else 'None'})")
print(f"[{c.name}] only_round_cash_method: {c.only_round_cash_method}")
if __name__ == '__main__':
check_pos_rounding(env)