[REV] point_of_sale, pos_discount: move discount data to pos_discount
This reverts commit 430f4904ed.
This should not be done in stable, for 3 reasons:
1: There is no migration scripts, so every people that will migrate from previous version will have a second product discount created in their DB
2: Existing DB that will activate discount will have 2 products discounts
3: It breaks an industry module that depends of this data
For those reasons, I'll revert this commit before it is deployed next week.
To correctly do your changes, you just need to do it in master and create a migration script that will rename the xml_id.
closes odoo/odoo#143104
Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
This commit is contained in:
@@ -20,6 +20,10 @@
|
|||||||
<field name="l10n_in_hsn_code">3921.90.99</field>
|
<field name="l10n_in_hsn_code">3921.90.99</field>
|
||||||
<field name="l10n_in_hsn_description">Other plates, sheets film , foil and strip, of plastics</field>
|
<field name="l10n_in_hsn_description">Other plates, sheets film , foil and strip, of plastics</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="point_of_sale.product_product_consumable" model="product.product">
|
||||||
|
<field name="l10n_in_hsn_code">8443.32.90</field>
|
||||||
|
<field name="l10n_in_hsn_description">Other, capable of connecting to an automatic data processing machine or to a network</field>
|
||||||
|
</record>
|
||||||
<record id="point_of_sale.monitor_stand" model="product.product">
|
<record id="point_of_sale.monitor_stand" model="product.product">
|
||||||
<field name="l10n_in_hsn_code">9403</field>
|
<field name="l10n_in_hsn_code">9403</field>
|
||||||
<field name="l10n_in_hsn_description">Other furniture and parts thereof.</field>
|
<field name="l10n_in_hsn_description">Other furniture and parts thereof.</field>
|
||||||
|
|||||||
@@ -36,6 +36,20 @@
|
|||||||
<field name="name">Shop</field>
|
<field name="name">Shop</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="product_product_consumable" model="product.product">
|
||||||
|
<field name="name">Discount</field>
|
||||||
|
<field name="available_in_pos">True</field>
|
||||||
|
<field name="standard_price">0.00</field>
|
||||||
|
<field name="list_price">0.00</field>
|
||||||
|
<field name="weight">0.00</field>
|
||||||
|
<field name="type">consu</field>
|
||||||
|
<field name="categ_id" ref="point_of_sale.product_category_pos"/>
|
||||||
|
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||||
|
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||||
|
<field name="default_code">DISC</field>
|
||||||
|
<field name="purchase_ok">False</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="uom.product_uom_categ_unit" model="uom.category">
|
<record id="uom.product_uom_categ_unit" model="uom.category">
|
||||||
<field name="is_pos_groupable">True</field>
|
<field name="is_pos_groupable">True</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -91,8 +91,9 @@ class TestPointOfSaleHttpCommon(AccountTestInvoicingHttpCommon):
|
|||||||
|
|
||||||
# Archive all existing product to avoid noise during the tours
|
# Archive all existing product to avoid noise during the tours
|
||||||
all_pos_product = env['product.product'].search([('available_in_pos', '=', True)])
|
all_pos_product = env['product.product'].search([('available_in_pos', '=', True)])
|
||||||
|
discount = env.ref('point_of_sale.product_product_consumable')
|
||||||
cls.tip = env.ref('point_of_sale.product_product_tip')
|
cls.tip = env.ref('point_of_sale.product_product_tip')
|
||||||
(all_pos_product - cls.tip)._write({'active': False})
|
(all_pos_product - discount - cls.tip)._write({'active': False})
|
||||||
|
|
||||||
# In DESKS categ: Desk Pad
|
# In DESKS categ: Desk Pad
|
||||||
pos_categ_desks = env.ref('point_of_sale.pos_category_desks')
|
pos_categ_desks = env.ref('point_of_sale.pos_category_desks')
|
||||||
@@ -333,8 +334,13 @@ class TestPointOfSaleHttpCommon(AccountTestInvoicingHttpCommon):
|
|||||||
'applied_on': '0_product_variant',
|
'applied_on': '0_product_variant',
|
||||||
'min_quantity': 1,
|
'min_quantity': 1,
|
||||||
'product_id': cls.wall_shelf.id,
|
'product_id': cls.wall_shelf.id,
|
||||||
}),
|
}), (0, 0, {
|
||||||
],
|
'compute_price': 'fixed',
|
||||||
|
'fixed_price': 2,
|
||||||
|
'applied_on': '0_product_variant',
|
||||||
|
'min_quantity': 2,
|
||||||
|
'product_id': env.ref('point_of_sale.product_product_consumable').id,
|
||||||
|
})],
|
||||||
})
|
})
|
||||||
|
|
||||||
env['product.pricelist'].create({
|
env['product.pricelist'].create({
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ discount to a customer.
|
|||||||
""",
|
""",
|
||||||
'depends': ['point_of_sale'],
|
'depends': ['point_of_sale'],
|
||||||
'data': [
|
'data': [
|
||||||
'data/pos_discount_data.xml',
|
|
||||||
'views/res_config_settings_views.xml',
|
'views/res_config_settings_views.xml',
|
||||||
'views/pos_config_views.xml',
|
'views/pos_config_views.xml',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<odoo>
|
|
||||||
<data noupdate="1">
|
|
||||||
<record id="product_product_consumable" model="product.product">
|
|
||||||
<field name="name">Discount</field>
|
|
||||||
<field name="available_in_pos">True</field>
|
|
||||||
<field name="standard_price">0.00</field>
|
|
||||||
<field name="list_price">0.00</field>
|
|
||||||
<field name="weight">0.00</field>
|
|
||||||
<field name="type">consu</field>
|
|
||||||
<field name="categ_id" ref="point_of_sale.product_category_pos"/>
|
|
||||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
|
||||||
<field name="default_code">DISC</field>
|
|
||||||
<field name="purchase_ok">False</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
||||||
@@ -22,7 +22,7 @@ class PosConfig(models.Model):
|
|||||||
.mapped('config_id')
|
.mapped('config_id')
|
||||||
)
|
)
|
||||||
# Do not modify configs where an opened session exists.
|
# Do not modify configs where an opened session exists.
|
||||||
product = self.env.ref("pos_discount.product_product_consumable", raise_if_not_found=False)
|
product = self.env.ref("point_of_sale.product_product_consumable", raise_if_not_found=False)
|
||||||
for conf in (configs - open_configs):
|
for conf in (configs - open_configs):
|
||||||
conf.discount_product_id = product if conf.module_pos_discount and product and (not product.company_id or product.company_id == conf.company_id) else False
|
conf.discount_product_id = product if conf.module_pos_discount and product and (not product.company_id or product.company_id == conf.company_id) else False
|
||||||
|
|
||||||
@@ -34,5 +34,5 @@ class PosConfig(models.Model):
|
|||||||
|
|
||||||
def _get_special_products(self):
|
def _get_special_products(self):
|
||||||
res = super()._get_special_products()
|
res = super()._get_special_products()
|
||||||
default_discount_product = self.env.ref('pos_discount.product_product_consumable', raise_if_not_found=False) or self.env['product.product']
|
default_discount_product = self.env.ref('point_of_sale.product_product_consumable', raise_if_not_found=False) or self.env['product.product']
|
||||||
return res | self.env['pos.config'].search([]).mapped('discount_product_id') | default_discount_product
|
return res | self.env['pos.config'].search([]).mapped('discount_product_id') | default_discount_product
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
|
|
||||||
@api.depends('company_id', 'pos_module_pos_discount', 'pos_config_id')
|
@api.depends('company_id', 'pos_module_pos_discount', 'pos_config_id')
|
||||||
def _compute_pos_discount_product_id(self):
|
def _compute_pos_discount_product_id(self):
|
||||||
default_product = self.env.ref("pos_discount.product_product_consumable", raise_if_not_found=False) or self.env['product.product']
|
default_product = self.env.ref("point_of_sale.product_product_consumable", raise_if_not_found=False) or self.env['product.product']
|
||||||
for res_config in self:
|
for res_config in self:
|
||||||
discount_product = res_config.pos_config_id.discount_product_id or default_product
|
discount_product = res_config.pos_config_id.discount_product_id or default_product
|
||||||
if res_config.pos_module_pos_discount and (not discount_product.company_id or discount_product.company_id == res_config.company_id):
|
if res_config.pos_module_pos_discount and (not discount_product.company_id or discount_product.company_id == res_config.company_id):
|
||||||
|
|||||||
Reference in New Issue
Block a user