[FIX] product: pricelist item cannot be without a pricelist ref
This commit is contained in:
@@ -416,7 +416,7 @@ class PricelistItem(models.Model):
|
||||
'Cost Price : The base price will be the cost price.\n'
|
||||
'Other Pricelist : Computation of the base price based on another Pricelist.')
|
||||
base_pricelist_id = fields.Many2one('product.pricelist', 'Other Pricelist')
|
||||
pricelist_id = fields.Many2one('product.pricelist', 'Pricelist', index=True, ondelete='cascade')
|
||||
pricelist_id = fields.Many2one('product.pricelist', 'Pricelist', index=True, ondelete='cascade', required=True)
|
||||
price_surcharge = fields.Float(
|
||||
'Price Surcharge', digits='Product Price',
|
||||
help='Specify the fixed amount to add or substract(if negative) to the amount calculated with the discount.')
|
||||
|
||||
@@ -71,11 +71,10 @@ class TestSaleProductAttributeValueConfig(TestSaleProductAttributeValueSetup):
|
||||
pricelist_item = self.env['product.pricelist.item'].create({
|
||||
'min_quantity': 2,
|
||||
'compute_price': 'percentage',
|
||||
'percent_price': discount
|
||||
'percent_price': discount,
|
||||
'pricelist_id': pricelist.id,
|
||||
})
|
||||
|
||||
pricelist.item_ids += pricelist_item
|
||||
|
||||
return (pricelist, pricelist_item, currency_ratio, 1 - discount / 100)
|
||||
|
||||
def test_01_is_combination_possible_archived(self):
|
||||
|
||||
@@ -15,9 +15,10 @@ class TestWebsiteSaleProductAttributeValueConfig(TestSaleProductAttributeValueSe
|
||||
self.computer = self.computer.with_context(website_id=current_website.id)
|
||||
|
||||
# make sure the pricelist has a 10% discount
|
||||
pricelist.item_ids = self.env['product.pricelist.item'].create({
|
||||
self.env['product.pricelist.item'].create({
|
||||
'price_discount': 10,
|
||||
'compute_price': 'formula',
|
||||
'pricelist_id': pricelist.id,
|
||||
})
|
||||
|
||||
discount_rate = 0.9
|
||||
|
||||
Reference in New Issue
Block a user