Task #1871557 Purpose ======= - Configure a product from a sales order as easily as in the ecommerce The backend uses the same template as the frontend to configure a products and its options - Display optionnal products of optionnal products in the "sale options" section - Allow adding exlusions to some combinations of the product and/or to some combinations of the optionnal and accessory products Specification ============= PHASE I 1. Improve the "Add to cart" with optional products - When you add an option to cart, move the product to the cart & show the options of this option - Don't open the option wizard if no option available (in case this module becomes generic, it's better to skip this step when it's not needed) - Display the options right under their related product in the cart 2. Do not allow to add the product as an optional product for itself Why ? - No functional sense - Creates issues in the add to cart wizard 3. Exclude some attribute combinations within the product or with related options and accessory products - Rename VARIANT PRICES button -> CONFIGURE VARIANTS - When you click this button and select a value, open form view rather than inline edition - Form view of variant values: - Attribute - Value - HTML Color Index - Attribute Price Extra - Not Compatible with: o2m tab with 2 fields: Product AND Attribute Value (of this product) [m2m tag selection] - in any new line, autocomplete the current product by default - Tooltip: A list of product and attribute values that you want to exclude for this product's attribue value. Also applies on optionnal and accessory products. 4. New option to configure a product in a sales order line - This option is only visible if the corresponding option is activated in the sales settings - It opens a wizard to select a product template, configure related attribute values and select optional products (based on frontend view) - Attributes not compatible with other selected attributes should not be selectable - Must work like in the frontend
46 lines
2.2 KiB
Python
46 lines
2.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class ResConfigSettings(models.TransientModel):
|
|
_inherit = 'res.config.settings'
|
|
|
|
company_share_product = fields.Boolean(
|
|
'Share product to all companies',
|
|
help="Share your product to all companies defined in your instance.\n"
|
|
" * Checked : Product are visible for every company, even if a company is defined on the partner.\n"
|
|
" * Unchecked : Each company can see only its product (product where company is defined). Product not related to a company are visible for all companies.")
|
|
group_uom = fields.Boolean("Units of Measure", implied_group='uom.group_uom')
|
|
group_product_variant = fields.Boolean("Variants and Options", implied_group='product.group_product_variant')
|
|
group_stock_packaging = fields.Boolean('Product Packagings',
|
|
implied_group='product.group_stock_packaging')
|
|
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_product_pricelist = fields.Boolean("Show pricelists On Products",
|
|
implied_group='product.group_product_pricelist')
|
|
group_pricelist_item = fields.Boolean("Show pricelists to customers",
|
|
implied_group='product.group_pricelist_item')
|
|
product_weight_in_lbs = fields.Selection([
|
|
('0', 'Kilogram'),
|
|
('1', 'Pound'),
|
|
], 'Weight unit of measure', config_parameter='product.weight_in_lbs', default='0')
|
|
|
|
|
|
@api.model
|
|
def get_values(self):
|
|
res = super(ResConfigSettings, self).get_values()
|
|
product_rule = self.env.ref('product.product_comp_rule')
|
|
res.update(
|
|
company_share_product=not bool(product_rule.active),
|
|
)
|
|
return res
|
|
|
|
def set_values(self):
|
|
super(ResConfigSettings, self).set_values()
|
|
product_rule = self.env.ref('product.product_comp_rule')
|
|
product_rule.write({'active': not bool(self.company_share_product)})
|