[FIX] point_of_sale: take into account extra variant prices
list_price is the base price of a product which does not include
price_extra.
Note that in the backend the pricelist computation uses
product.price_compute('list_price')
to compute the base price on which to apply the pricelist. For
product.product this seems to be equivalent to the lst_price computed
field.
The original list_price field is unused but has not been removed to
avoid breaking any 3rd party code that is using this field.
opw-781629
This commit is contained in:
@@ -345,7 +345,8 @@ exports.PosModel = Backbone.Model.extend({
|
||||
},
|
||||
},{
|
||||
model: 'product.product',
|
||||
fields: ['display_name', 'list_price', 'standard_price', 'categ_id', 'pos_categ_id', 'taxes_id',
|
||||
// todo remove list_price in master, it is unused
|
||||
fields: ['display_name', 'list_price', 'lst_price', 'standard_price', 'categ_id', 'pos_categ_id', 'taxes_id',
|
||||
'barcode', 'default_code', 'to_weight', 'uom_id', 'description_sale', 'description',
|
||||
'product_tmpl_id','tracking'],
|
||||
order: _.map(['sequence','default_code','name'], function (name) { return {name: name}; }),
|
||||
@@ -1233,7 +1234,7 @@ exports.Product = Backbone.Model.extend({
|
||||
(! item.date_end || moment(item.date_end).isSameOrAfter(date));
|
||||
});
|
||||
|
||||
var price = self.list_price;
|
||||
var price = self.lst_price;
|
||||
_.find(pricelist_items, function (rule) {
|
||||
if (rule.min_quantity && quantity < rule.min_quantity) {
|
||||
return false;
|
||||
|
||||
@@ -54,6 +54,7 @@ odoo.define('point_of_sale.tour.pricelist', function (require) {
|
||||
var product_limon = posmodel.db.search_product_in_category(0, 'Stringers')[0];
|
||||
var product_pamplemousse = posmodel.db.search_product_in_category(0, 'Red grapefruit')[0];
|
||||
var product_grapes = posmodel.db.search_product_in_category(0, 'Black Grapes')[0];
|
||||
var product_poire_conference = posmodel.db.search_product_in_category(0, 'Conference pears')[0];
|
||||
var product_external_audit = posmodel.db.search_product_in_category(0, 'External Audit')[0];
|
||||
var product_miscellaneous = posmodel.db.search_product_in_category(0, 'Miscellaneous')[0];
|
||||
|
||||
@@ -83,6 +84,7 @@ odoo.define('point_of_sale.tour.pricelist', function (require) {
|
||||
.then(compare_backend_frontend(product_miscellaneous, 'Pricelist base', 1, undefined))
|
||||
.then(compare_backend_frontend(product_miscellaneous, 'Pricelist base 2', 1, undefined))
|
||||
.then(compare_backend_frontend(product_papillon_orange, 'Pricelist base rounding', 1, undefined))
|
||||
.then(compare_backend_frontend(product_poire_conference, 'Public Pricelist', 1, undefined))
|
||||
.then(function () {
|
||||
$('.pos').addClass('done-testing');
|
||||
});
|
||||
|
||||
@@ -36,6 +36,21 @@ class TestUi(odoo.tests.HttpCase):
|
||||
'fields_id': field.id,
|
||||
'value': 'account.account,' + str(account_receivable.id)})
|
||||
|
||||
# test an extra price on an attribute
|
||||
pear = env.ref('point_of_sale.poire_conference')
|
||||
attribute_value = env['product.attribute.value'].create({
|
||||
'name': 'add 2',
|
||||
'product_ids': [(6, 0, [pear.id])],
|
||||
'attribute_id': env['product.attribute'].create({
|
||||
'name': 'add 2',
|
||||
}).id,
|
||||
})
|
||||
env['product.attribute.price'].create({
|
||||
'product_tmpl_id': pear.product_tmpl_id.id,
|
||||
'price_extra': 2,
|
||||
'value_id': attribute_value.id,
|
||||
})
|
||||
|
||||
fixed_pricelist = env['product.pricelist'].create({
|
||||
'name': 'Fixed',
|
||||
'item_ids': [(0, 0, {
|
||||
|
||||
Reference in New Issue
Block a user