[MERGE] forward port branch 10.0 up to cd1a8f6252
This commit is contained in:
@@ -467,7 +467,10 @@ class AccountJournal(models.Model):
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
args = args or []
|
||||
recs = self.search(['|', ('code', operator, name), ('name', operator, name)] + args, limit=limit)
|
||||
connector = '|'
|
||||
if operator in expression.NEGATIVE_TERM_OPERATORS:
|
||||
connector = '&'
|
||||
recs = self.search([connector, ('code', operator, name), ('name', operator, name)] + args, limit=limit)
|
||||
return recs.name_get()
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -28,3 +28,30 @@ class AccountingTestCase(HttpCase):
|
||||
if theorical_lines:
|
||||
raise ValidationError('Remaining theorical line (not found). %s)' % ([(aml[0], aml[1], aml[2]) for aml in theorical_lines]))
|
||||
return True
|
||||
|
||||
def ensure_account_property(self, property_name):
|
||||
'''Ensure the ir.property targetting an account.account passed as parameter exists.
|
||||
In case it's not: create it with a random account. This is useful when testing with
|
||||
partially defined localization (missing stock properties for example)
|
||||
|
||||
:param property_name: The name of the property.
|
||||
'''
|
||||
company_id = self.env.user.company_id
|
||||
field_id = self.env['ir.model.fields'].search(
|
||||
[('model', '=', 'product.template'), ('name', '=', property_name)], limit=1)
|
||||
property_id = self.env['ir.property'].search([
|
||||
('company_id', '=', company_id.id),
|
||||
('name', '=', property_name),
|
||||
('res_id', '=', None),
|
||||
('fields_id', '=', field_id.id)], limit=1)
|
||||
account_id = self.env['account.account'].search([('company_id', '=', company_id.id)], limit=1)
|
||||
value_reference = 'account.account,%d' % account_id.id
|
||||
if property_id and not property_id.value_reference:
|
||||
property_id.value_reference = value_reference
|
||||
else:
|
||||
self.env['ir.property'].create({
|
||||
'name': property_name,
|
||||
'company_id': company_id.id,
|
||||
'fields_id': field_id.id,
|
||||
'value_reference': value_reference,
|
||||
})
|
||||
|
||||
@@ -8,6 +8,8 @@ from odoo.exceptions import UserError
|
||||
|
||||
|
||||
def geo_find(addr):
|
||||
if not addr:
|
||||
return None
|
||||
url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
|
||||
url += urllib2.quote(addr.encode('utf8'))
|
||||
|
||||
|
||||
@@ -226,26 +226,26 @@ class DeliveryCarrier(models.Model):
|
||||
if record.delivery_type == 'fixed':
|
||||
PriceRule.search([('carrier_id', '=', record.id)]).unlink()
|
||||
|
||||
line_data = {
|
||||
'carrier_id': record.id,
|
||||
'variable': 'price',
|
||||
'operator': '>=',
|
||||
}
|
||||
# Create the delivery price rules
|
||||
if record.free_if_more_than:
|
||||
line_data.update({
|
||||
'max_value': record.amount,
|
||||
'standard_price': 0.0,
|
||||
'list_base_price': 0.0,
|
||||
})
|
||||
PriceRule.create(line_data)
|
||||
if record.fixed_price is not False:
|
||||
line_data.update({
|
||||
'max_value': 0.0,
|
||||
'standard_price': record.fixed_price,
|
||||
'list_base_price': record.fixed_price,
|
||||
})
|
||||
PriceRule.create(line_data)
|
||||
line_data = {
|
||||
'carrier_id': record.id,
|
||||
'variable': 'price',
|
||||
'operator': '>=',
|
||||
}
|
||||
# Create the delivery price rules
|
||||
if record.free_if_more_than:
|
||||
line_data.update({
|
||||
'max_value': record.amount,
|
||||
'standard_price': 0.0,
|
||||
'list_base_price': 0.0,
|
||||
})
|
||||
PriceRule.create(line_data)
|
||||
if record.fixed_price is not False:
|
||||
line_data.update({
|
||||
'max_value': 0.0,
|
||||
'standard_price': record.fixed_price,
|
||||
'list_base_price': record.fixed_price,
|
||||
})
|
||||
PriceRule.create(line_data)
|
||||
return True
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -104,6 +104,9 @@ class TestSaleOrder(TestSale):
|
||||
|
||||
def test_cost_invoicing(self):
|
||||
""" Test confirming a vendor invoice to reinvoice cost on the so """
|
||||
# force the pricelist to have the same currency as the company
|
||||
self.env.ref('product.list0').currency_id = self.env.ref('base.main_company').currency_id
|
||||
|
||||
serv_cost = self.env.ref('product.service_cost_01')
|
||||
prod_gap = self.env.ref('product.product_product_1')
|
||||
so = self.env['sale.order'].create({
|
||||
|
||||
@@ -7,6 +7,9 @@ from odoo.addons.sale.tests.test_sale_common import TestSale
|
||||
class TestSaleExpense(TestSale):
|
||||
def test_sale_expense(self):
|
||||
""" Test the behaviour of sales orders when managing expenses """
|
||||
# force the pricelist to have the same currency as the company
|
||||
self.env.ref('product.list0').currency_id = self.env.ref('base.main_company').currency_id
|
||||
|
||||
# create a so with a product invoiced on delivery
|
||||
prod = self.env.ref('product.product_product_1')
|
||||
so = self.env['sale.order'].create({
|
||||
|
||||
@@ -6499,6 +6499,12 @@ msgid "You cannot set a negative product quantity in an inventory line:\n"
|
||||
" %s - qty: %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: code:addons/stock/models/stock_production_lot.py:37
|
||||
#, python-format
|
||||
msgid "You are not allowed to create a lot for this picking type"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock
|
||||
#: code:addons/stock/models/stock_move.py:924
|
||||
#, python-format
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class ProductionLot(models.Model):
|
||||
@@ -27,6 +28,15 @@ class ProductionLot(models.Model):
|
||||
('name_ref_uniq', 'unique (name, product_id)', 'The combination of serial number and product must be unique !'),
|
||||
]
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
pack_id = self.env.context.get('active_pack_operation', False)
|
||||
if pack_id:
|
||||
pack = self.env['stock.pack.operation'].browse(pack_id)
|
||||
if pack.picking_id and not pack.picking_id.picking_type_id.use_create_lots:
|
||||
raise UserError(_("You are not allowed to create a lot for this picking type"))
|
||||
return super(ProductionLot, self).create(vals)
|
||||
|
||||
@api.one
|
||||
@api.depends('quant_ids.qty')
|
||||
def _product_qty(self):
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
<field name="lot_name" invisible="not context.get('only_create', False)"/>
|
||||
<field name="lot_id" invisible="context.get('only_create', False)"
|
||||
domain="[('product_id','=', parent.product_id)]"
|
||||
context="{'default_product_id': parent.product_id}"/>
|
||||
context="{'default_product_id': parent.product_id, 'active_pack_operation': parent.id}"/>
|
||||
<field name="qty_todo" invisible="not context.get('show_reserved') or context.get('serial') or context.get('state_done')" readonly="1"/>
|
||||
<field name="qty" invisible="context.get('serial')"/>
|
||||
<button name="do_minus" type="object" icon="fa-minus-square" attrs="{'invisible': [('qty', '<=', 0.99)]}" invisible="not context.get('show_reserved') or context.get('state_done')"/>
|
||||
|
||||
@@ -59,6 +59,9 @@ class TestStockLandedCostsCommon(AccountingTestCase):
|
||||
self.brokerage_quantity = self._create_services('Brokerage Cost')
|
||||
self.transportation_weight = self._create_services('Transportation Cost')
|
||||
self.packaging_volume = self._create_services('Packaging Cost')
|
||||
# Ensure the account properties exists.
|
||||
self.ensure_account_property('property_stock_account_input')
|
||||
self.ensure_account_property('property_stock_account_output')
|
||||
|
||||
def _create_services(self, name):
|
||||
return self.Product.create({
|
||||
|
||||
@@ -524,6 +524,8 @@ var FieldDomain = common.AbstractField.extend(common.ReinitializeFieldMixin).ext
|
||||
fs_filters: this.options.fs_filters,
|
||||
debugMode: session.debug,
|
||||
}).open();
|
||||
this.trigger("dialog_opened", dialog);
|
||||
return dialog;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<div t-name="CrashManager.warning" class="o_dialog_warning">
|
||||
<t t-js="d">
|
||||
var message = d.message ? d.message : d.error.data.message;
|
||||
var message = (d.message !== undefined) ? d.message : d.error.data.message;
|
||||
d.html_error = context.engine.tools.html_escape(message).replace(/\n/g, '<br/>');
|
||||
</t>
|
||||
<t t-raw="html_error"/>
|
||||
|
||||
@@ -393,9 +393,10 @@ class Website(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_current_website(self):
|
||||
domain_name = request.httprequest.environ.get('HTTP_HOST', '').split(':')[0]
|
||||
domain_name = request and request.httprequest.environ.get('HTTP_HOST', '').split(':')[0] or None
|
||||
website_id = self._get_current_website_id(domain_name)
|
||||
request.context = dict(request.context, website_id=website_id)
|
||||
if request:
|
||||
request.context = dict(request.context, website_id=website_id)
|
||||
return self.browse(website_id)
|
||||
|
||||
@tools.cache('domain_name')
|
||||
|
||||
@@ -604,6 +604,7 @@ msgid "Bad Request"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.model.fields,field_description:website_forum.field_res_users_badge_ids
|
||||
#: model:ir.ui.view,arch_db:website_forum.badge
|
||||
#: model:ir.ui.view,arch_db:website_forum.header
|
||||
#: model:ir.ui.view,arch_db:website_forum.user_detail_full
|
||||
@@ -782,6 +783,7 @@ msgstr ""
|
||||
#. openerp-web
|
||||
#: code:addons/website_forum/static/src/xml/website_forum_share_templates.xml:46
|
||||
#: selection:forum.post,state:0
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
#, python-format
|
||||
msgid "Close"
|
||||
msgstr ""
|
||||
@@ -883,6 +885,16 @@ msgstr ""
|
||||
msgid "Convert all answers to comments and vice versa"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_answers
|
||||
msgid "Convert as a comment"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_comment
|
||||
msgid "Convert as an answer"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.model.fields,field_description:website_forum.field_forum_post_karma_accept
|
||||
msgid "Convert comment to answer"
|
||||
@@ -968,6 +980,12 @@ msgstr ""
|
||||
msgid "Default Post"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_answers
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.model.fields,field_description:website_forum.field_forum_forum_karma_unlink_all
|
||||
msgid "Delete all posts"
|
||||
@@ -1038,6 +1056,8 @@ msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.edit_post
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_answers
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
msgid "Edit"
|
||||
msgstr ""
|
||||
|
||||
@@ -1184,6 +1204,11 @@ msgstr ""
|
||||
msgid "First upvote"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
msgid "Flag"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.model.fields,field_description:website_forum.field_forum_forum_karma_flag
|
||||
#: model:ir.model.fields,field_description:website_forum.field_forum_post_karma_flag
|
||||
@@ -1193,6 +1218,7 @@ msgstr ""
|
||||
#. module: website_forum
|
||||
#: selection:forum.post,state:0
|
||||
#: model:ir.ui.view,arch_db:website_forum.moderation_queue
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
msgid "Flagged"
|
||||
msgstr ""
|
||||
|
||||
@@ -2005,6 +2031,11 @@ msgstr ""
|
||||
msgid "Re: %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
msgid "Reactivate"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.header
|
||||
msgid "Read Guidelines"
|
||||
@@ -2057,6 +2088,11 @@ msgstr ""
|
||||
msgid "Relevance Computation"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
msgid "Reopen"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_forum
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_answers
|
||||
#: model:ir.ui.view,arch_db:website_forum.post_description_full
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<t t-name="website_forum.social_message_answer">
|
||||
<p>By sharing you answer, you will get additional <b>karma points</b> if your
|
||||
answer is selected as the right one. See what you can do with karma
|
||||
<a href="https://www.odoo.com/forum/how-to/miscellaneous-14/how-does-karma-work-odoo-v8-forum-software-57845" target="_blank">here</a>.</p>
|
||||
<a href="/forum/help-1/faq" target="_blank">here</a>.</p>
|
||||
</t>
|
||||
<t t-name="website_forum.social_message_default">
|
||||
<p>Share this content to increase your chances to be featured on the front page and attract more visitors.</p>
|
||||
|
||||
@@ -793,9 +793,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-muted mb16">
|
||||
<i t-if="question.post_type == 'question'" t-attf-class="fa fa-question-circle" t-att-title="question.post_type.capitalize()" />
|
||||
<i t-if="question.post_type == 'discussion'" t-attf-class="fa fa-comments-o" t-att-title="question.post_type.capitalize()" />
|
||||
<i t-if="question.post_type == 'link'" t-attf-class="fa fa-link" t-att-title="question.post_type.capitalize()" />
|
||||
<t t-set="type_labels" t-value="dict(question._fields['post_type']._description_selection(question.env))"/>
|
||||
<i t-if="question.post_type == 'question'" t-attf-class="fa fa-question-circle" t-att-title="type_labels[question.post_type]" />
|
||||
<i t-if="question.post_type == 'discussion'" t-attf-class="fa fa-comments-o" t-att-title="type_labels[question.post_type]" />
|
||||
<i t-if="question.post_type == 'link'" t-attf-class="fa fa-link" t-att-title="type_labels[question.post_type]" />
|
||||
<span>By </span>
|
||||
<a t-att-href="(question.create_uid.id == request.session.uid or question.create_uid.sudo().website_published) and '/forum/%s/user/%s' % (slug(forum), question.create_uid.id) or None"
|
||||
t-field="question.create_uid"
|
||||
@@ -819,7 +820,7 @@
|
||||
<div class="mt16 mb24 text-center">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/question/' + slug(question) + '/reopen'"/>
|
||||
<t t-set="label" t-value="'Reopen'"/>
|
||||
<t t-set="label">Reopen</t>
|
||||
<t t-set="classes" t-value="'fa-arrow-right'"/>
|
||||
<t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
|
||||
</t>
|
||||
@@ -832,7 +833,7 @@
|
||||
<li t-if="question.state == 'close'">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/reopen'"/>
|
||||
<t t-set="label" t-value="'Reopen'"/>
|
||||
<t t-set="label">Reopen</t>
|
||||
<t t-set="classes" t-value="'fa-undo'"/>
|
||||
<t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
|
||||
</t>
|
||||
@@ -840,7 +841,7 @@
|
||||
<li>
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) +'/post/' + slug(question) + '/edit'"/>
|
||||
<t t-set="label" t-value="'Edit'"/>
|
||||
<t t-set="label">Edit</t>
|
||||
<t t-set="classes" t-value="'fa-pencil-square-o'"/>
|
||||
<t t-set="karma" t-value="not question.can_edit and question.karma_edit or 0"/>
|
||||
</t>
|
||||
@@ -848,7 +849,7 @@
|
||||
<li t-if="question.state != 'close'">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/ask_for_close'"/>
|
||||
<t t-set="label" t-value="'Close'"/>
|
||||
<t t-set="label">Close</t>
|
||||
<t t-set="classes" t-value="'fa-times'"/>
|
||||
<t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
|
||||
</t>
|
||||
@@ -856,7 +857,7 @@
|
||||
<li t-if="question.active">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/delete'"/>
|
||||
<t t-set="label" t-value="'Delete'"/>
|
||||
<t t-set="label">Delete</t>
|
||||
<t t-set="classes" t-value="'fa-trash-o'"/>
|
||||
<t t-set="karma" t-value="not question.can_unlink and question.karma_unlink or 0"/>
|
||||
</t>
|
||||
@@ -864,7 +865,7 @@
|
||||
<li t-if="not question.active and question.state != 'offensive'">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/undelete'"/>
|
||||
<t t-set="label" t-value="'Reactivate'"/>
|
||||
<t t-set="label">Reactivate</t>
|
||||
<t t-set="classes" t-value="'fa-trash-o'"/>
|
||||
<t t-set="karma" t-value="not question.can_unlink and question.karma_unlink or 0"/>
|
||||
</t>
|
||||
@@ -872,7 +873,7 @@
|
||||
<li t-if="not question.active and question.state == 'offensive'">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) +'/post/' + slug(question) + '/validate'"/>
|
||||
<t t-set="label" t-value="'Reactivate'"/>
|
||||
<t t-set="label">Reactivate</t>
|
||||
<t t-set="classes" t-value="'fa-trash-o'"/>
|
||||
<t t-set="karma" t-value="not question.can_moderate and question.forum_id.karma_moderate or 0"/>
|
||||
</t>
|
||||
@@ -883,7 +884,12 @@
|
||||
t-attf-data-karma="#{not question.can_flag and question.forum_id.karma_flag or 0}"
|
||||
t-attf-data-href="/forum/#{slug(forum)}/post/#{slug(question)}/flag"
|
||||
>
|
||||
<t class="flag_flagged_label" t-esc="question.state == 'flagged' and 'Flagged' or 'Flag'"/>
|
||||
<t t-if="question.state == 'flagged'">
|
||||
Flagged
|
||||
</t>
|
||||
<t t-if="question.state != 'flagged'">
|
||||
Flag
|
||||
</t>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -982,7 +988,7 @@
|
||||
<li>
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/edit'"/>
|
||||
<t t-set="label" t-value="'Edit'"/>
|
||||
<t t-set="label">Edit</t>
|
||||
<t t-set="classes" t-value="'fa fa-pencil-square-o'"/>
|
||||
<t t-set="karma" t-value="not answer.can_edit and answer.karma_edit or 0"/>
|
||||
</t>
|
||||
@@ -990,7 +996,7 @@
|
||||
<li>
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/delete'"/>
|
||||
<t t-set="label" t-value="'Delete'"/>
|
||||
<t t-set="label">Delete</t>
|
||||
<t t-set="classes" t-value="'fa-trash-o'"/>
|
||||
<t t-set="karma" t-value="not answer.can_unlink and answer.karma_unlink or 0"/>
|
||||
</t>
|
||||
@@ -1007,7 +1013,7 @@
|
||||
<li t-if="question.post_type == 'question'">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/convert_to_comment'"/>
|
||||
<t t-set="label" t-value="'Convert as a comment'"/>
|
||||
<t t-set="label">Convert as a comment</t>
|
||||
<t t-set="classes" t-value="'fa-magic'"/>
|
||||
<t t-set="karma" t-value="not answer.can_comment_convert and answer.karma_comment_convert or 0"/>
|
||||
</t>
|
||||
@@ -1081,7 +1087,7 @@
|
||||
<t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_unlink_own or object.forum_id.karma_comment_unlink_all"/>
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/delete'"/>
|
||||
<t t-set="label" t-value="' '"/>
|
||||
<t t-set="label"> </t>
|
||||
<t t-set="karma" t-value="user.karma<required_karma and required_karma or 0"/>
|
||||
<t t-set="classes" t-value="'close comment_delete fa-times'"/>
|
||||
</t>
|
||||
@@ -1094,7 +1100,7 @@
|
||||
<t t-if="allow_post_comment">
|
||||
<t t-call="website_forum.link_button" >
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/convert_to_answer'"/>
|
||||
<t t-set="label" t-value="'Convert as an answer'"/>
|
||||
<t t-set="label">Convert as an answer</t>
|
||||
<t t-set="karma" t-value="user.karma<required_karma and required_karma or 0"/>
|
||||
<t t-set="classes" t-value="'fa-magic pull-right'"/>
|
||||
</t>
|
||||
|
||||
@@ -244,19 +244,19 @@ class Website(models.Model):
|
||||
:param bool show_visible: if True, we don't display pricelist where selectable is False (Eg: Code promo)
|
||||
:returns: pricelist recordset
|
||||
"""
|
||||
website = request.website
|
||||
if not request.website:
|
||||
website = request and request.website or None
|
||||
if not website:
|
||||
if self.env.context.get('website_id'):
|
||||
website = self.browse(self.env.context['website_id'])
|
||||
else:
|
||||
website = self.search([], limit=1)
|
||||
isocountry = request.session.geoip and request.session.geoip.get('country_code') or False
|
||||
isocountry = request and request.session.geoip and request.session.geoip.get('country_code') or False
|
||||
partner = self.env.user.partner_id
|
||||
order_pl = partner.last_website_so_id and partner.last_website_so_id.state == 'draft' and partner.last_website_so_id.pricelist_id
|
||||
partner_pl = partner.property_product_pricelist
|
||||
pricelists = website._get_pl_partner_order(isocountry, show_visible,
|
||||
website.user_id.sudo().partner_id.property_product_pricelist.id,
|
||||
request.session.get('website_sale_current_pl'),
|
||||
request and request.session.get('website_sale_current_pl') or None,
|
||||
website.pricelist_ids,
|
||||
partner_pl=partner_pl and partner_pl.id or None,
|
||||
order_pl=order_pl and order_pl.id or None)
|
||||
@@ -280,7 +280,7 @@ class Website(models.Model):
|
||||
available_pricelists = self.get_pricelist_available()
|
||||
pl = None
|
||||
partner = self.env.user.partner_id
|
||||
if request.session.get('website_sale_current_pl'):
|
||||
if request and request.session.get('website_sale_current_pl'):
|
||||
# `website_sale_current_pl` is set only if the user specifically chose it:
|
||||
# - Either, he chose it from the pricelist selection
|
||||
# - Either, he entered a coupon code
|
||||
|
||||
Reference in New Issue
Block a user