New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude some fields from settings export #101

Closed
simahawk opened this Issue Nov 24, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@simahawk
Contributor

simahawk commented Nov 24, 2017

Context
Below is a nice and super-complete settings export for v11.
Beside the fact that file contents like favicons need to be converted to file (see #94) some of these fields are just pure defaults. Also, some of them (CDN fields etc) might be excluded in any case.

Proposal

  1. let's retrieve all default values
  2. let's skip all fields matching defaults
  3. exclude module_* as we install them via addons list (?)

Issues
a. how to be 100% that we load only defaults (point 1)
b. if we do so our defaults are not freezed: if a default changes somewhere the initial state that we expect is no more the same
c. is (3) 100% true?

/cc @guewen @yvaucher @grindtildeath

# -*- coding: utf-8 -*-
# Copyright  Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
# -- This file has been generated --

# pylint: disable=C,E

import anthem


@anthem.log
def res_config_settings(ctx):
    """Setup res.config.settings for nostraterra."""
    model = ctx.env['res.config.settings'].with_context(tracking_disable=1)
    model.create({
        # Hide Setup Bar
        'account_hide_setup_bar': False,
        # Alias Domain
        'alias_domain': 'localhost',
        # Client ID
        'auth_oauth_google_client_id': False,
        # Allow users to sign in with Google
        'auth_oauth_google_enabled': True,
        # Enable password reset from Login page
        'auth_signup_reset_password': True,
        # Template user for new users created through signup
        'auth_signup_template_user_id': ctx.env.ref('auth_signup.default_template_user').id,
        # Customer Account: On invitation (B2B)
        'auth_signup_uninvited': 'b2b',
        # Lock Confirmed Orders
        'auto_done_setting': False,
        # Automatic Invoice
        'automatic_invoice': False,
        # Availability Threshold
        'available_threshold': 5.0,
        # Client_id
        'cal_client_id':,
        # Client_key
        'cal_client_secret':,
        # Abandoned Delay
        'cart_abandoned_delay': 1.0,
        # Cart Recovery Email
        'cart_recovery_mail_template': False,
        # Use a Content Delivery Network (CDN)
        'cdn_activated': False,
        # CDN Filters
        'cdn_filters': """^/[^/]+/static/
^/web/(css|js)/
^/web/image
^/web/content
^/website/image/""",
        # CDN Base URL
        'cdn_url':,
        # Template
        'chart_template_id': False,
        # # of Digits *
        'code_digits': 4,
        # Currency
        'company_currency_id': ctx.env.ref('base.CHF').id,
        # Company
        'company_id': ctx.env.ref('base.main_company').id,
        # Share partners to all companies
        'company_share_partner': True,
        # Share product to all companies
        'company_share_product': True,
        # Default Alias Name for Leads
        'crm_alias_prefix': False,
        # Default Sales Channel
        'crm_default_team_id': ctx.env.ref('sales_team.team_sales_department').id,
        # Default Salesperson
        'crm_default_user_id': False,
        # Exchange Gain or Loss Journal
        'currency_exchange_journal_id': ctx.env.ref('__setup__.account_journal_exchange_difference').id,
        # Currency
        'currency_id': ctx.env.ref('base.CHF').id,
        # Interval Unit: Monthly
        'currency_interval_unit': 'monthly',
        # Next Execution Date
        'currency_next_execution_date': '2017-11-30',
        # Service Provider: Federal Tax Administration (Switzerland)
        'currency_provider': 'fta',
        # Minimum days between two follow-ups
        'days_between_two_followups': 14,
        # Custom Report Footer
        'default_custom_report_footer': False,
        # Deposit Product
        'default_deposit_product_id': ctx.env.ref('__setup__.product_product_down_payment').id,
        # External Email Servers
        'default_external_email_server': True,
        # Invoicing Policy: Invoice what is delivered
        'default_invoice_policy': 'delivery',
        # Default language code
        'default_lang_code': 'en_US',
        # Default language
        'default_lang_id': ctx.env.ref('base.lang_en').id,
        # Shipping Management: Ship products as soon as available, with back orders
        'default_picking_policy': 'direct',
        # Bill Control: Delivered quantities
        'default_purchase_method': 'receive',
        # Default Purchase Tax
        'default_purchase_tax_id': ctx.env.ref('l10n_ch.1_vat_25_purchase_incl').id,
        # Default Sale Tax
        'default_sale_tax_id': ctx.env.ref('l10n_ch.1_vat_25_incl').id,
        # Default Template
        'default_template_id': False,
        # Default Access Rights
        'default_user_rights': False,
        # Default Alias Name for Expenses
        'expense_alias_prefix': False,
        # Document Template
        'external_report_layout': False,
        # Fail Mail
        'fail_counter': 2,
        # Favicon
        'favicon': b'AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABMLAAATCwAAAAAAAAAAAAAAAAAAAAAAAIZFoACKRqIAiUahEIlGok6JRqKMiUaiq4lGoquJRqKLiUaiS4lGog6JRqIAiEWhAAAAAAAAAAAAAAAAAIhFoQCIRaECiUaiRYlGorqJRqLziUai/4lGov+JRqL/iUai/4lGovKJRqK0iUaiPohFoQGJRqEAAAAAAIlGogCIRaECiUaiYolGouqJRqL/iUai/4lGov+JRqL/iUai/4lGov+JRqL/iUai/4lGouaJRqJYhUOdAIhFoQCJRqIAiUaiRolGouqJRqL/iUai/4lGouyJRqKjiUaibolGom6JRqKjiUai7IlGov+JRqL/iUai5IlGoj2JRqIAiUahEYlGorqJRqL/iUai/4lGotiJRqJGiEahBIlGogCJRqIAiEahBIlGokaJRqLYiUai/4lGov+JRqKxiUaiDYlGolCJRqLziUai/4lGovKJRqJQiUaiAIhFogAAAAAAAAAAAIhFoQCJRqIAiUaiUIlGovKJRqL/iUai8YlGokqJRqKNiUai/4lGov+JRqK3iUahColGoQAAAAAAAAAAAAAAAAAAAAAAiEahAIhGoQqJRqK3iUai/4lGov+JRqKKiUaiq4lGov+JRqL/iUaiiYpGowCHRaAAAAAAAAAAAAAAAAAAAAAAAIdFoACKRqMAiUaiiYlGov+JRqL/iUaiq4lGoqqJRqL/iUai/4lGooqKRqMAh0WgAAAAAAAAAAAAAAAAAAAAAACIRaEAikejAIlGoo+JRqL/iUai/4lGoqmJRqKIiUai/4lGov+JRqK6iUahC4lGoQAAAAAAAAAAAAAAAAAAAAAAiUahAIlGoQ+JRqLDiUai/4lGov+JRqKGiUaiSIlGovCJRqL/iUai9IlGoliKRqMAiEahAAAAAAAAAAAAiEWhAI5KpwCJRqJkiUai+IlGov+JRqLuiUaiRIlGogyJRqKviUai/4lGov+JRqLgiUaiV4lGoQqJRqIAi0ijAIlGoQ2JRqJiiUai5olGov+JRqL/iUaiqYhFoQqJRqIAiUaiOYlGouCJRqL/iUai/4lGovOJRqK6iUaiiolGoo6JRqLBiUai9olGov+JRqL/iUai3YlGojSJRqIAiEWhAJFMrQCJRqJOiUai3YlGov+JRqL/iUai/4lGov+JRqL/iUai/4lGov+JRqL/iUai3olGokyKSKUAiEWhAAAAAACIRqEAhEGbAIlGojGJRqKjiUai64lGov6JRqL/iUai/4lGov+JRqLwiUaiq4lGojR8Q5gAiEahAAAAAAAAAAAAAAAAAIREnQCJRqIAiUWiCIlGojyJRqJ9iUaipYlGoquJRqKIiUaiRolGoguJRqIAiEWhAAAAAAAAAAAA8A8AAMADAACAAQAAgAEAAAGAAAAH4AAAB+AAAA/wAAAP8AAAB+AAAAfgAAABgAAAgAEAAMADAADAAwAA8A8AAA==',
        # Server API Key
        'fcm_api_key':,
        # Sender ID
        'fcm_project_id':,
        # Fiscalyear Last Day
        'fiscalyear_last_day': 31,
        # Fiscalyear Last Month: December
        'fiscalyear_last_month': 12,
        # Lock Date for All Users
        'fiscalyear_lock_date': False,
        # Manual Assignation of Emails
        'generate_lead_from_alias': False,
        # Google Analytics Key
        'google_analytics_key': False,
        # Google Client ID
        'google_management_client_id': False,
        # Google Client Secret
        'google_management_client_secret': False,
        # Google Maps API Key
        'google_maps_api_key':,
        # Analytic accounting for purchases
        'group_analytic_account_for_purchases': False,
        # Analytic Accounting
        'group_analytic_accounting': True,
        # Employee PIN
        'group_attendance_use_pin': False,
        # Cash Rounding
        'group_cash_rounding': True,
        # Shipping Address
        'group_delivery_invoice_address': True,
        # Discounts
        'group_discount_per_so_line': False,
        # Incoterms
        'group_display_incoterm': False,
        # Vendor Pricelists
        'group_manage_vendor_price': False,
        # Mass Mailing Campaigns
        'group_mass_mailing_campaign': False,
        # Manage multiple companies
        'group_multi_company': False,
        # Multi-Currencies
        'group_multi_currency': True,
        # Show pricelists to customers
        'group_pricelist_item': False,
        # Show pricelists On Products
        'group_product_pricelist': True,
        # Attributes and Variants
        'group_product_variant': True,
        # Pro-Forma Invoice
        'group_proforma_sales': False,
        # Order-Specific Routes
        'group_route_so_lines': False,
        # Customer Addresses
        'group_sale_delivery_address': True,
        # Sections on Sales Orders
        'group_sale_layout': False,
        # Use pricelists to adapt your price per customers
        'group_sale_pricelist': True,
        # Show subtotal
        'group_show_price_subtotal': True,
        # Show total
        'group_show_price_total': False,
        # Multi-Step Routes
        'group_stock_adv_location': False,
        # Storage Locations
        'group_stock_multi_locations': True,
        # Multi-Warehouses
        'group_stock_multi_warehouses': False,
        # Product Packages
        'group_stock_packaging': True,
        # Lots & Serial Numbers
        'group_stock_production_lot': True,
        # Delivery Packages
        'group_stock_tracking_lot': True,
        # Consignment
        'group_stock_tracking_owner': True,
        # Sub-tasks
        'group_subtask_project': False,
        # Units of Measure
        'group_uom': True,
        # Leads
        'group_use_lead': False,
        # Warnings
        'group_warning_account': False,
        # Warnings
        'group_warning_purchase': False,
        # Warnings
        'group_warning_sale': False,
        # Warnings
        'group_warning_stock': False,
        # Multi-Images
        'group_website_multiimage': True,
        # Website Popup
        'group_website_popup_on_exit': False,
        # Has Accounting Entries
        'has_accounting_entries': True,
        # Company has a chart of accounts
        'has_chart_of_accounts': True,
        # Google Analytics
        'has_google_analytics': False,
        # Google Analytics in Dashboard
        'has_google_analytics_dashboard': False,
        # Google Maps
        'has_google_maps': False,
        # Inventory: Sell regardless of inventory
        'inventory_availability': 'never',
        # Timesheets Invoicing: All recorded timesheets
        'invoiced_timesheet': 'all',
        # Is the Sale Module Installed
        'is_installed_sale': True,
        # Print bank on ISR
        'l10n_ch_isr_print_bank_location': True,
        # Number of languages
        'language_count': 4,
        # Languages
        'language_ids': [1, 23, 26, 34],
        # Last Sync Date
        'last_currency_sync_date': '2017-11-22',
        # Internal Project
        'leave_timesheet_project_id': ctx.env.ref('__setup__.project_project_internal_project').id,
        # Leave Task
        'leave_timesheet_task_id': ctx.env.ref('__setup__.project_task_leaves').id,
        # Lock Confirmed Orders
        'lock_confirmed_po': False,
        # Notifications
        'mail_push_notification': False,
        # Minimum days between two follow-ups
        'min_days_between_followup': 6,
        # 3-way matching: purchases, receptions and bills
        'module_account_3way_match': False,
        # Accounting
        'module_account_accountant': True,
        # Assets Management
        'module_account_asset': False,
        # Import in CAMT.053 format
        'module_account_bank_statement_import_camt': True,
        # Import in .csv format
        'module_account_bank_statement_import_csv': False,
        # Import in .ofx format
        'module_account_bank_statement_import_ofx': False,
        # Import .qif files
        'module_account_bank_statement_import_qif': False,
        # Use batch deposit
        'module_account_batch_deposit': False,
        # Budget Management
        'module_account_budget': False,
        # Revenue Recognition
        'module_account_deferred_revenue': False,
        # Invoicing
        'module_account_invoicing': True,
        # Online Payment
        'module_account_payment': True,
        # Plaid Connector
        'module_account_plaid': False,
        # Dynamic Reports
        'module_account_reports': True,
        # Enable payment followup management
        'module_account_reports_followup': True,
        # Use SEPA payments
        'module_account_sepa': True,
        # Use SEPA Direct Debit
        'module_account_sepa_direct_debit': False,
        # Account TaxCloud
        'module_account_taxcloud': False,
        # Bank Interface - Sync your bank feeds automatically
        'module_account_yodlee': False,
        # LDAP Authentication
        'module_auth_ldap': False,
        # Use external authentication providers (OAuth)
        'module_auth_oauth': True,
        # Translate Your Website with Gengo
        'module_base_gengo': False,
        # Allow users to import data from CSV/XLS/XLSX/ODS files
        'module_base_import': True,
        # Phone Validation
        'module_crm_phone_validation': False,
        # Allow Currency Rate Live
        'module_currency_rate_live': True,
        # Shipping Costs
        'module_delivery': True,
        # bpost
        'module_delivery_bpost': False,
        # DHL
        'module_delivery_dhl': False,
        # FedEx
        'module_delivery_fedex': False,
        # UPS
        'module_delivery_ups': False,
        # USPS
        'module_delivery_usps': False,
        # Barcode
        'module_event_barcode': False,
        # Tickets
        'module_event_sale': True,
        # Allow the users to synchronize their calendar  with Google Calendar
        'module_google_calendar': True,
        # Attach Google documents to any record
        'module_google_drive': False,
        # Google Spreadsheet
        'module_google_spreadsheet': False,
        # Show Organizational Chart
        'module_hr_org_chart': False,
        # Timesheets
        'module_hr_timesheet': True,
        # Manage Inter Company
        'module_inter_company_rules': False,
        # EU Digital Goods VAT
        'module_l10n_eu_service': False,
        # Allow check printing and deposits
        'module_l10n_us_check_printing': False,
        # Collaborative Pads
        'module_pad': False,
        # Docsaway
        'module_print_docsaway': False,
        # Reservation: Immediately after sales order confirmation
        'module_procurement_jit': 1,
        # Specific Email
        'module_product_email_template': False,
        # Expiration Dates
        'module_product_expiry': True,
        # Allow Product Margin
        'module_product_margin': True,
        # Forecasts
        'module_project_forecast': True,
        # Leaves
        'module_project_timesheet_holidays': True,
        # Awesome Timesheet
        'module_project_timesheet_synchro': True,
        # Purchase Agreements
        'module_purchase_requisition': False,
        # Rating on Tasks
        'module_rating_project': False,
        # Coupons & Promotions
        'module_sale_coupon': False,
        # Customer Billing
        'module_sale_management': True,
        # Margins
        'module_sale_margin': False,
        # Delivery Date
        'module_sale_order_dates': True,
        # Online Signature & Payment
        'module_sale_payment': True,
        # Time Billing
        'module_sale_timesheet': True,
        # Barcode Scanner
        'module_stock_barcode': True,
        # Dropshipping
        'module_stock_dropshipping': False,
        # Landed Costs
        'module_stock_landed_costs': False,
        # Batch Pickings
        'module_stock_picking_batch': True,
        # Asterisk (VoIP)
        'module_voip': False,
        # Customer Autocomplete
        'module_web_clearbit': True,
        # Registration Survey
        'module_website_event_questions': False,
        # Online Ticketing
        'module_website_event_sale': True,
        # Tracks and Agenda
        'module_website_event_track': False,
        # Quotations Templates
        'module_website_quote': True,
        # Product Comparison Tool
        'module_website_sale_comparison': True,
        # Shipping Costs
        'module_website_sale_delivery': True,
        # Digital Content
        'module_website_sale_digital': False,
        # Optional Products
        'module_website_sale_options': True,
        # Inventory
        'module_website_sale_stock': True,
        # Wishlists
        'module_website_sale_wishlist': True,
        # A/B Testing
        'module_website_version': False,
        # Multiple Sales Prices per Product
        'multi_sales_price': True,
        # Pricelists: Multiple prices per product (e.g. customer segments, currencies)
        'multi_sales_price_method': 'percentage',
        # Order Confirmation Email
        'order_mail_template': ctx.env.ref('website_quote.confirmation_mail').id,
        # Paper format
        'paperformat_id': ctx.env.ref('base.paperformat_euro').id,
        # Lock Date for Non-Advisers
        'period_lock_date': False,
        # Levels of Approvals *: Confirm purchase orders in one step
        'po_double_validation': 'one_step',
        # Minimum Amount
        'po_double_validation_amount': 5000.0,
        # Purchase Lead Time
        'po_lead': 0.0,
        # Purchase Order Modification *: Allow to edit purchase orders
        'po_lock': 'edit',
        # Order Approval
        'po_order_approval': False,
        # Online Signature & Payment
        'portal_confirmation': True,
        # Online Signature & Payment options: Payment
        'portal_confirmation_options': 'pay',
        # No Rescheduling Propagation
        'propagation_minimum_delta': 1,
        # Manager Reminder
        'reminder_manager_allow': True,
        # Number of days
        'reminder_manager_delay': 7,
        # Frequency: after end of week
        'reminder_manager_interval': 'weeks',
        # Employee Reminder
        'reminder_user_allow': True,
        # Number of days
        'reminder_user_delay': 3,
        # Frequency: after end of week
        'reminder_user_interval': 'weeks',
        # Custom Report Footer
        'report_footer': False,
        # Company Working Hours
        'resource_calendar_id': ctx.env.ref('resource.resource_calendar_std').id,
        # Shipping Management: Delivery methods are selectable on the website: the customer pays for shipping costs
        'sale_delivery_settings': 'website',
        # Terms & Conditions
        'sale_note': False,
        # Pricelists: Multiple prices per product (e.g. customer segments, currencies)
        'sale_pricelist_setting': 'percentage',
        # Tax Display: Tax-Excluded Prices
        'sale_show_tax': 'subtotal',
        # Salesperson
        'salesperson_id': False,
        # Sales Channel
        'salesteam_id': ctx.env.ref('sales_team.salesteam_website_sales').id,
        # Security Lead Time
        'security_lead': 0.0,
        # Your Company Name
        'sepa_initiating_party_name': 'NostraTerra',
        # Identification
        'sepa_orgid_id': False,
        # Issuer
        'sepa_orgid_issr': False,
        # SEPA Pain Version: Swiss Version
        'sepa_pain_version': 'pain.001.001.03.ch.02',
        # URI for tuto
        'server_uri': 'http://localhost:8069/google_account/authentication',
        # Server uri
        'server_uri_google': 'http://localhost:8069/auth_oauth/signin',
        # Tax calculation rounding method: Round per Line
        'tax_calculation_rounding_method': 'round_per_line',
        # Tax Cash Basis Journal
        'tax_cash_basis_journal_id': ctx.env.ref('__setup__.account_journal_cash_basis_tax_journal').id,
        # Cash Basis
        'tax_exigibility': False,
        # Transfer Account
        'transfer_account_id': ctx.env.ref('l10n_ch.1_transfer_account_id').id,
        # Anglo-Saxon Accounting
        'use_anglo_saxon': False,
        # Let your employees record expenses by email
        'use_mailgateway': False,
        # Security Lead Time for Purchase
        'use_po_lead': False,
        # No Rescheduling Propagation
        'use_propagation_minimum_delta': False,
        # Default Terms & Conditions
        'use_sale_note': False,
        # Security Lead Time for Sales
        'use_security_lead': False,
        # website
        'website_id': ctx.env.ref('website.default_website').id,
        # Website Name
        'website_name': 'Particuliers',
        # Google Doc Key
        'website_slide_google_app_key': 'AIzaSyDOWlmDW-7DbLmOR9ZsT5AOEXf4n6TFwQA',
    }).execute()


@anthem.log
def main(ctx):
    res_config_settings(ctx)
@simahawk

This comment has been minimized.

Contributor

simahawk commented Nov 30, 2017

FTR, I realized why we have all this stuff here in v11: all specific settings like "sale.config.settings" have been removed and merged into res.config.setting, from sale:

class ResConfigSettings(models.TransientModel):
    _inherit = 'res.config.settings'

    sale_note = fields.Text(related='company_id.sale_note', string="Terms & Conditions")
    use_sale_note = fields.Boolean(
        string='Default Terms & Conditions',
        oldname='default_use_sale_note')
[...]
@simahawk

This comment has been minimized.

Contributor

simahawk commented Nov 30, 2017

so, I guess we should include res.config.settings in core compilation and prevent ppl to export them again and again in additional songs. /cc @yvaucher @guewen

@yvaucher

This comment has been minimized.

Contributor

yvaucher commented Nov 30, 2017

Also a change in V11 (don't think it impact us) base.config.settings was removed in favor of res.config.settings.

Good idea to get rid of default values.

For module_ fields surely we can remove them.

I think that we also need a specific behavior for all non multi company fields.
For instance for all the fields group_ and module_ it makes no sense to have.

Company_A group_X = True
Company_B group_X = False

In fact it can even lead to some bugs.

@simahawk

This comment has been minimized.

Contributor

simahawk commented Nov 30, 2017

So I do we handle this? We export groups on users and stop?

@yvaucher

This comment has been minimized.

Contributor

yvaucher commented Dec 1, 2017

@simahawk all we need is the inherited list of the group Employee (base.user_group)

As it is a m2m we could simply export that group and it's list of inherited groups

@simahawk

This comment has been minimized.

Contributor

simahawk commented Dec 4, 2017

wrap up after call w/ Yannick:

  • exclude default_ -> add default song in core compilation
  • exclude module_ -> add installed addons in core compilation
  • exclude group_ -> add a core song to export only main groups (portal, public, user) w/ just implied_ids field
  • exclude related= -> they come within company export

simahawk added a commit that referenced this issue Dec 4, 2017

[imp] settings: export only what we need (address #101)
Exclude `default_`, `group_`, `module_`.
@simahawk

This comment has been minimized.

Contributor

simahawk commented Dec 5, 2017

@yvaucher did a quick tests w/ new core song and only sale installed:
image
works good.

@simahawk

This comment has been minimized.

Contributor

simahawk commented Feb 15, 2018

already implemented but settings export are deprecated now since:

  • we export everything in real records when needed
  • settings are really heavy now that they are on the same model
  • they required all required fields even if we don't need them

@simahawk simahawk closed this Feb 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment