""" import sys import os try: purchase_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(purchase_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model PurchaseContract = connection.get_model('purchase.contract') # Domain dom = [] # Search PO Contract poc = PurchaseContract.search_read(dom) log_po_names = [[], []] logger = log.setup_custom_logger('po_contract_act_set_write_uid_by_create_uid') logger.info('Start process') logger.info('Total contract: %s' % len(poc)) try: # Update write uid with create_uid poc = [x['id'] for x in poc] PurchaseContract.mork_set_write_uid_by_create_uid(poc)
""" import sys import os try: project_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(project_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model ProjectPhase = connection.get_model('res.invest.construction.phase') # Domain pcp_codes = ['C-18-082-01'] dom = [('code', 'in', pcp_codes)] # Search Project Construction Phase pcps = ProjectPhase.search_read(dom, context={'active_test': 0}) log_pcp_codes = [[], []] logger = log.setup_custom_logger('project_construction_phase_act_submit') logger.info('Start process') logger.info('Total project construction phase: %s' % len(pcps)) for pcp in pcps: try: ProjectPhase.mork_action_submit([pcp['id']])
""" import sys import os try: purchase_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(purchase_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model PurchaseOrder = connection.get_model('purchase.order') # Domain # po_names = ['PO18001191', 'PO18001192', 'PO18001193'] # dom = [('name', 'in', po_names)] dom = [('order_type', '=', 'purchase_order'), ('state', 'in', ['cancel'])] # Search PO pos = PurchaseOrder.search_read(dom) log_po_names = [[], []] logger = log.setup_custom_logger('purchase_orders_act_set_to_draft') logger.info('Start process') logger.info('Total purchase order: %s' % len(pos)) for po in pos: try:
import sys import os import csv try: myproject_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(myproject_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Project = connection.get_model('res.project') # Domain pj_codes = ['P1350176'] dom = [('code', 'in', pj_codes)] # Search Project pjs = Project.search_read(dom) log_pj_codes = [[], []] logger = log.setup_custom_logger('myproject_act_release_budget') logger.info('Start process') logger.info('Total project: %s' % len(pjs)) for pj in pjs: try: path = '%s/data/my_project_release_budget.csv' % \
""" import sys import os try: asset_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(asset_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Asset = connection.get_model('account.asset') # Domain # asset_codes = ['7440-028-0001-000000003'] # dom = [('code', 'in', asset_codes)] dom = [('state', '=', 'draft')] # Search Asset assets = Asset.search_read(dom) log_asset_ids = [[], []] logger = log.setup_custom_logger('assets_act_confirm_asset') logger.info('Start process') logger.info('Total asset: %s' % len(assets)) for asset in assets: try:
""" import sys import os try: purchase_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(purchase_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model PurchaseRequest = connection.get_model('purchase.request') # Domain pr_names = ['PR18001298'] dom = [('name', 'in', pr_names)] # Search PR prs = PurchaseRequest.search_read(dom) log_pr_names = [[], []] logger = log.setup_custom_logger('purchase_requests_act_accept') logger.info('Start process') logger.info('Total purchase request: %s' % len(prs)) for pr in prs: try: PurchaseRequest.mork_button_approved([pr['id']])
""" import sys import os try: invoice_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(invoice_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Invoice = connection.get_model('account.invoice') # Domain dom = [('type', '=', 'out_invoice'), ('state', '=', 'draft')] # Search Invoice invs = Invoice.search_read(dom) log_inv_ids = [[], []] logger = log.setup_custom_logger('account_invoice_act_validate') logger.info('Start process') logger.info('Total invoice: %s' % len(invs)) for inv in invs: try: # Update Tax Invoice.mock_button_reset_taxes([inv['id']])
""" import sys import os try: loan_agreement_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(loan_agreement_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model LoanAgreement = connection.get_model('loan.customer.agreement') # Domain loan_agreement_ids = [52] dom = [('id', 'in', loan_agreement_ids)] # Search Loan Agreement loan_agreements = LoanAgreement.search_read(dom) log_loan_agreement_ids = [[], []] logger = log.setup_custom_logger('loan_agreement_act_create_installment_order') logger.info('Start process') logger.info('Total loan agreement: %s' % len(loan_agreements)) for loan_agreement in loan_agreements: try: LoanAgreement.mork_create_installment_order([loan_agreement['id']])
""" import sys import os try: budget_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(budget_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Budget = connection.get_model('account.budget') POLine = connection.get_model('purchase.order.line') # Updates list for all structure from -> to (by code) ##################################################### d = { 'section_id': { '101021': '101012', 'YYY': 'ZZZ' }, 'project_id': { 'XXX': 'YYY' }, } #####################################################
""" import sys import os try: project_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(project_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model ProjectConstruction = connection.get_model('res.invest.construction') # Domain pc_codes = ['C-18-111'] dom = [('code', 'in', pc_codes)] # Search Project Construction pcs = ProjectConstruction.search_read(dom) log_pc_codes = [[], []] logger = log.setup_custom_logger('project_construction_act_submit') logger.info('Start process') logger.info('Total project construction: %s' % len(pcs)) for pc in pcs: try: ProjectConstruction.mork_action_submit([pc['id']])
""" import sys import os try: voucher_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(voucher_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Voucher = connection.get_model('account.voucher') # Domain dom = [('type', '=', 'receipt'), ('state', '=', 'draft')] # Search Voucher vouchers = Voucher.search_read(dom) log_voucher_ids = [[], []] logger = log.setup_custom_logger('account_voucher_act_validate') logger.info('Start process') logger.info('Total voucher: %s' % len(vouchers)) for voucher in vouchers: try: Voucher.mock_trigger_workflow([voucher['id']], 'proforma_voucher') log_voucher_ids[0].append(voucher['id'])
""" import sys import os try: purchase_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(purchase_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Billing = connection.get_model('purchase.billing') # Domain dom = [('state', '=', 'draft')] # Search Billing billings = Billing.search_read(dom) log_billing_ids = [[], []] logger = log.setup_custom_logger('purchase_billing_act_validate') logger.info('Start process') logger.info('Total purchase billing: %s' % len(billings)) for billing in billings: try: Billing.mork_validate_billing([billing['id']]) log_billing_ids[0].append(billing['id'])
""" import sys import os try: budget_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(budget_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Budget = connection.get_model('account.budget') # Domain budget_names = ['CTRL/UNIT/18/301060', 'CTRL/PERSONNEL/19/NSTDA'] dom = [('name', 'in', budget_names)] # Search Budget budgets = Budget.search_read(dom) log_budget_names = [[], []] logger = log.setup_custom_logger('budgets_act_activate') logger.info('Start process') logger.info('Total budget: %s' % len(budgets)) for budget in budgets: try: Budget.mork_budget_done([budget['id']])
""" import sys import os try: agreement_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(agreement_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Agreement = connection.get_model('agreement') # Domain dom = [('is_template', '=', False)] # Search Agreement agreements = Agreement.search_read(dom) log_agreement_ids = [[], []] logger = log.setup_custom_logger('update_structure') logger.info('Start process') logger.info('Total agreement: %s' % len(agreements)) for agreement in agreements: try: # Make sure no have line in recital, section, clause, appendix Agreement.mock_unlink_recital_structure([agreement['id']])
""" import sys import os try: asset_path = os.path.dirname(os.path.realpath(__file__)) script_path = os.path.dirname(asset_path) migration_path = os.path.dirname(script_path) controller_path = '%s/controller' % migration_path sys.path.insert(0, controller_path) from connection import connection import log except Exception: pass # Model Asset = connection.get_model('account.asset') AssetLine = connection.get_model('account.asset.line') # Domain dom = [('type', '=', 'depreciate'), ('init_entry', '=', True), ('move_check', '=', False)] # Search Asset depre_lines = AssetLine.search_read(dom, limit=10000, order='id asc') log_asset_codes = [[], []] logger = log.setup_custom_logger('assets_act_fix_init_depre_entry') logger.info('Start process') logger.info('Total depre_lines: %s' % len(depre_lines)) for depre in depre_lines: try: