[IMP] settings: Remove unnecessary field redefinitions in config models
This commit is contained in:
@@ -25,8 +25,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
('round_globally', 'Round globally calculation of taxes '),
|
||||
], related='company_id.tax_calculation_rounding_method', string='Tax calculation rounding method')
|
||||
module_account_accountant = fields.Boolean(string='Accounting')
|
||||
group_multi_currency = fields.Boolean(string='Allow multi currencies',
|
||||
implied_group='base.group_multi_currency')
|
||||
group_analytic_accounting = fields.Boolean(string='Analytic Accounting',
|
||||
implied_group='analytic.group_analytic_accounting')
|
||||
group_warning_account = fields.Boolean(string="Warnings", implied_group='account.group_warning_account')
|
||||
|
||||
@@ -22,7 +22,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
module_auth_ldap = fields.Boolean("LDAP Authentification")
|
||||
module_base_gengo = fields.Boolean("Translate Your Website with Gengo")
|
||||
module_inter_company_rules = fields.Boolean("Manage Inter Company")
|
||||
module_pad = fields.Boolean("External Pads")
|
||||
module_pad = fields.Boolean("Collaborative Pads")
|
||||
company_share_partner = fields.Boolean(string='Share partners to all companies',
|
||||
help="Share your partners to all companies defined in your instance.\n"
|
||||
" * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
|
||||
|
||||
@@ -8,7 +8,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
crm_alias_prefix = fields.Char('Default Alias Name for Leads')
|
||||
alias_domain = fields.Char('Alias Domain', default=lambda self: self.env["ir.config_parameter"].sudo().get_param("mail.catchall.domain"))
|
||||
generate_lead_from_alias = fields.Boolean('Manual Assignation of Emails')
|
||||
group_use_lead = fields.Boolean(string="Leads", implied_group='crm.group_use_lead')
|
||||
module_crm_phone_validation = fields.Boolean("Phone Validation")
|
||||
|
||||
@@ -7,7 +7,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
expense_alias_prefix = fields.Char('Default Alias Name for Expenses')
|
||||
alias_domain = fields.Char('Alias Domain', default=lambda self: self.env["ir.config_parameter"].sudo().get_param("mail.catchall.domain"))
|
||||
use_mailgateway = fields.Boolean(string='Let your employees record expenses by email')
|
||||
module_sale = fields.Boolean(string="Customer Billing")
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from odoo import api, fields, models
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
module_pad = fields.Boolean("Collaborative Pads")
|
||||
module_hr_timesheet = fields.Boolean("Timesheets")
|
||||
module_rating_project = fields.Boolean(string="Rating on Tasks")
|
||||
module_project_forecast = fields.Boolean(string="Forecasts")
|
||||
|
||||
@@ -11,10 +11,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
use_sale_note = fields.Boolean(
|
||||
string='Default Terms & Conditions',
|
||||
oldname='default_use_sale_note')
|
||||
group_sale_pricelist = fields.Boolean("Use pricelists to adapt your price per customers",
|
||||
implied_group='product.group_sale_pricelist',
|
||||
help="""Allows to manage different prices based on rules per category of customers.
|
||||
Example: 10% for retailers, promotion of 5 EUR on this product, etc.""")
|
||||
group_discount_per_so_line = fields.Boolean("Discounts", implied_group='sale.group_discount_per_so_line')
|
||||
module_sale_margin = fields.Boolean("Margins")
|
||||
group_sale_layout = fields.Boolean("Sections on Sales Orders", implied_group='sale.group_sale_layout')
|
||||
@@ -46,8 +42,8 @@ class ResConfigSettings(models.TransientModel):
|
||||
('total', 'Tax-Included Prices')], string="Tax Display",
|
||||
required=True)
|
||||
default_invoice_policy = fields.Selection([
|
||||
('order', 'Ordered quantities'),
|
||||
('delivery', 'Delivered quantities or service hours')
|
||||
('order', 'Invoice what is ordered'),
|
||||
('delivery', 'Invoice what is delivered')
|
||||
], 'Invoicing Policy',
|
||||
default='order',
|
||||
default_model='product.template')
|
||||
@@ -65,7 +61,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
('b2c', 'Free sign up (B2C)'),
|
||||
], string='Customer Account')
|
||||
|
||||
module_delivery = fields.Boolean("Shipping Costs")
|
||||
module_delivery = fields.Boolean("Manage shipping internally")
|
||||
module_delivery_dhl = fields.Boolean("DHL")
|
||||
module_delivery_fedex = fields.Boolean("FedEx")
|
||||
module_delivery_ups = fields.Boolean("UPS")
|
||||
|
||||
@@ -14,7 +14,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
|
||||
salesperson_id = fields.Many2one('res.users', related='website_id.salesperson_id', string='Salesperson')
|
||||
salesteam_id = fields.Many2one('crm.team', related='website_id.salesteam_id', string='Sales Channel', domain=[('team_type', '!=', 'pos')])
|
||||
module_delivery = fields.Boolean("Manage shipping internally")
|
||||
module_website_sale_delivery = fields.Boolean("Shipping Costs")
|
||||
# field used to have a nice radio in form view, resuming the 2 fields above
|
||||
sale_delivery_settings = fields.Selection([
|
||||
@@ -22,17 +21,10 @@ class ResConfigSettings(models.TransientModel):
|
||||
('internal', "Delivery methods are only used internally: the customer doesn't pay for shipping costs"),
|
||||
('website', "Delivery methods are selectable on the website: the customer pays for shipping costs"),
|
||||
], string="Shipping Management")
|
||||
module_delivery_dhl = fields.Boolean("DHL integration")
|
||||
module_delivery_fedex = fields.Boolean("Fedex integration")
|
||||
module_delivery_ups = fields.Boolean("UPS integration")
|
||||
module_delivery_usps = fields.Boolean("USPS integration")
|
||||
module_delivery_bpost = fields.Boolean("bpost integration")
|
||||
|
||||
module_sale_ebay = fields.Boolean("eBay connector")
|
||||
module_sale_coupon = fields.Boolean("Discount Programs")
|
||||
|
||||
group_website_multiimage = fields.Boolean(string='Multi-Images', implied_group='website_sale.group_website_multi_image', group='base.group_portal,base.group_user,base.group_public')
|
||||
group_discount_per_so_line = fields.Boolean(string="Discounted Prices", implied_group='sale.group_discount_per_so_line')
|
||||
group_delivery_invoice_address = fields.Boolean(string="Shipping Address", implied_group='sale.group_delivery_invoice_address')
|
||||
|
||||
module_website_sale_options = fields.Boolean("Optional Products", help='Installs *e-Commerce Optional Products*')
|
||||
@@ -44,46 +36,12 @@ class ResConfigSettings(models.TransientModel):
|
||||
module_account_invoicing = fields.Boolean("Invoicing")
|
||||
module_sale_stock = fields.Boolean("Delivery Orders")
|
||||
|
||||
# sale_pricelist_settings splitted in several entries for usability purpose
|
||||
multi_sales_price = fields.Boolean(
|
||||
string="Multiple sales price per product",
|
||||
oldname='sale_pricelist_setting_split_1')
|
||||
multi_sales_price_method = fields.Selection([
|
||||
(0, 'Multiple prices per product (e.g. customer segments, currencies)'),
|
||||
(1, 'Prices computed from formulas (discounts, margins, roundings)')],
|
||||
string="Sales Price", default=0,
|
||||
oldname='sale_pricelist_setting_split_2')
|
||||
sale_pricelist_setting = fields.Selection([
|
||||
('fixed', 'A single sales price per product'),
|
||||
('percentage', 'Multiple prices per product (e.g. customer segments, currencies)'),
|
||||
('formula', 'Price computed from formulas (discounts, margins, roundings)')
|
||||
], string="Pricelists")
|
||||
|
||||
order_mail_template = fields.Many2one('mail.template', string='Order Confirmation Email',
|
||||
default=_default_order_mail_template, domain="[('model', '=', 'sale.order')]",
|
||||
help="Email sent to customer at the end of the checkout process")
|
||||
group_show_price_subtotal = fields.Boolean(
|
||||
"Show subtotal",
|
||||
implied_group='sale.group_show_price_subtotal',
|
||||
group='base.group_portal,base.group_user,base.group_public')
|
||||
group_show_price_total = fields.Boolean(
|
||||
"Show total",
|
||||
implied_group='sale.group_show_price_total',
|
||||
group='base.group_portal,base.group_user,base.group_public')
|
||||
|
||||
default_invoice_policy = fields.Selection([
|
||||
('order', 'Invoice what is ordered'),
|
||||
('delivery', 'Invoice what is delivered')
|
||||
], 'Invoicing Policy', default='order')
|
||||
automatic_invoice = fields.Boolean("Automatic Invoice")
|
||||
|
||||
group_multi_currency = fields.Boolean(string='Multi-Currencies', implied_group='base.group_multi_currency')
|
||||
|
||||
website_sale_show_tax = fields.Selection([
|
||||
('total', 'Tax-Included Prices'),
|
||||
('subtotal', 'Tax-Excluded Prices')],
|
||||
"Product Prices", default='subtotal')
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
res = super(ResConfigSettings, self).get_values()
|
||||
@@ -95,15 +53,9 @@ class ResConfigSettings(models.TransientModel):
|
||||
if self.env['ir.module.module'].search([('name', '=', 'website_sale_delivery')], limit=1).state in ('installed', 'to install', 'to upgrade'):
|
||||
sale_delivery_settings = 'website'
|
||||
|
||||
sale_pricelist_setting = self.env['ir.config_parameter'].sudo().get_param('sale.sale_pricelist_setting')
|
||||
|
||||
res.update(
|
||||
automatic_invoice=params.get_param('website_sale.automatic_invoice', default=False),
|
||||
sale_delivery_settings=sale_delivery_settings,
|
||||
multi_sales_price=sale_pricelist_setting in ['percentage', 'formula'],
|
||||
multi_sales_price_method=sale_pricelist_setting in ['formula'] and 1 or False,
|
||||
sale_pricelist_setting=sale_pricelist_setting,
|
||||
website_sale_show_tax=self.env['ir.config_parameter'].sudo().get_param('website.website_sale_show_tax')
|
||||
)
|
||||
return res
|
||||
|
||||
@@ -111,40 +63,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
value = self.module_account_invoicing and self.default_invoice_policy == 'order' and self.automatic_invoice
|
||||
self.env['ir.config_parameter'].sudo().set_param('website_sale.automatic_invoice', value)
|
||||
self.env['ir.config_parameter'].sudo().set_param('sale.sale_pricelist_setting', self.sale_pricelist_setting)
|
||||
self.env['ir.config_parameter'].sudo().set_param('website.website_sale_show_tax', self.website_sale_show_tax)
|
||||
|
||||
@api.onchange('multi_sales_price', 'multi_sales_price_method')
|
||||
def _onchange_sale_price(self):
|
||||
if self.multi_sales_price:
|
||||
if self.multi_sales_price_method:
|
||||
self.sale_pricelist_setting = 'formula'
|
||||
else:
|
||||
self.sale_pricelist_setting = 'percentage'
|
||||
else:
|
||||
self.sale_pricelist_setting = 'fixed'
|
||||
|
||||
@api.onchange('sale_pricelist_setting')
|
||||
def _onchange_sale_pricelist_setting(self):
|
||||
if self.sale_pricelist_setting == 'percentage':
|
||||
self.update({
|
||||
'group_product_pricelist': True,
|
||||
'group_sale_pricelist': True,
|
||||
'group_pricelist_item': False,
|
||||
})
|
||||
elif self.sale_pricelist_setting == 'formula':
|
||||
self.update({
|
||||
'group_product_pricelist': False,
|
||||
'group_sale_pricelist': True,
|
||||
'group_pricelist_item': True,
|
||||
})
|
||||
else:
|
||||
self.update({
|
||||
'group_product_pricelist': False,
|
||||
'group_sale_pricelist': False,
|
||||
'group_pricelist_item': False,
|
||||
})
|
||||
|
||||
|
||||
@api.onchange('sale_delivery_settings')
|
||||
def _onchange_sale_delivery_settings(self):
|
||||
@@ -170,16 +88,3 @@ class ResConfigSettings(models.TransientModel):
|
||||
self.update({
|
||||
'multi_sales_price': True,
|
||||
})
|
||||
|
||||
@api.onchange('website_sale_show_tax')
|
||||
def _onchange_sale_tax(self):
|
||||
if self.website_sale_show_tax == "subtotal":
|
||||
self.update({
|
||||
'group_show_price_total': False,
|
||||
'group_show_price_subtotal': True,
|
||||
})
|
||||
else:
|
||||
self.update({
|
||||
'group_show_price_total': True,
|
||||
'group_show_price_subtotal': False,
|
||||
})
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" id="tax_inclusion_setting">
|
||||
<div class="o_setting_left_pane"/>
|
||||
<div class="o_setting_right_pane">
|
||||
<label string="Product Prices" for="website_sale_show_tax"/>
|
||||
<label string="Product Prices" for="sale_show_tax"/>
|
||||
<div class="text-muted">
|
||||
Product prices displaying in web catalog
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="mt16">
|
||||
<field name="website_sale_show_tax" class="o_light_label" widget="radio"/>
|
||||
<field name="sale_show_tax" class="o_light_label" widget="radio"/>
|
||||
<field name="group_show_price_total" invisible="1"/>
|
||||
<field name="group_show_price_subtotal" invisible="1"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user