diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-10-17 13:46:24 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-10-17 13:46:24 +0200 |
| commit | ceb1ba6dbde40b82daa38276277e70fc6cbe1e68 (patch) | |
| tree | 600c7cfb2dea4a47292d48d63258681cb837b05a /addons | |
| parent | 4cfc0f72327ca1d52e6982e52b3b62123972648b (diff) | |
| parent | b14c8b361ce8223b7dc277797dd501e00907c19f (diff) | |
[MERGE] forward port branch 9.0 up to b14c8b3
Diffstat (limited to 'addons')
19 files changed, 113 insertions, 73 deletions
diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py index 5e2d5bf89da..728745354b7 100644 --- a/addons/anonymization/anonymization.py +++ b/addons/anonymization/anonymization.py @@ -425,6 +425,8 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory): anonymized_value = '2011-11-11 11:11:11' elif field_type == 'float': anonymized_value = 0.0 + elif field_type == 'monetary': + anonymized_value = 0.0 elif field_type == 'integer': anonymized_value = 0 elif field_type in ['binary', 'many2many', 'many2one', 'one2many', 'reference']: # cannot anonymize these kind of fields diff --git a/addons/anonymization/ir.model.fields.anonymization.csv b/addons/anonymization/ir.model.fields.anonymization.csv index 2cfbeb0b223..6a4a20155cd 100644 --- a/addons/anonymization/ir.model.fields.anonymization.csv +++ b/addons/anonymization/ir.model.fields.anonymization.csv @@ -33,7 +33,6 @@ anonymization_field_purchase_order_amount_tax,purchase.order,amount_tax anonymization_field_purchase_order_amount_untaxed,purchase.order,amount_untaxed anonymization_field_purchase_order_line_price_unit,purchase.order.line,price_unit anonymization_field_account_invoice_tax_amount,account.invoice.tax,amount -anonymization_field_account_invoice_tax_base,account.invoice.tax,base anonymization_field_product_name,product.template,name anonymization_field_res_users_signature,res.users,signature anonymization_field_res_partner_contact_name,res.partner.contact,name diff --git a/addons/barcodes/static/src/js/form_view_barcode_handler.js b/addons/barcodes/static/src/js/form_view_barcode_handler.js index b00bce51c5e..ffc6dfc7383 100644 --- a/addons/barcodes/static/src/js/form_view_barcode_handler.js +++ b/addons/barcodes/static/src/js/form_view_barcode_handler.js @@ -81,7 +81,7 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, { if (this.last_scanned_barcode) { var new_qty = window.prompt(_t('Set quantity'), character) || "0"; new_qty = new_qty.replace(',', '.'); - var record = this._get_records(field).find(function(record) { + var record = _.find(this._get_records(field), function (record) { return record.get('product_barcode') === self.last_scanned_barcode; }); if (record) { @@ -159,8 +159,13 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, { }, _get_records: function(field) { - return field.viewmanager.active_view.controller.records || // tree view - field.viewmanager.active_view.controller.widgets; // kanban view + var active_view = field.viewmanager.active_view; + if (active_view.type === "kanban") { + return active_view.controller.widgets; + } else { + // tree view case + return active_view.controller.records.records; + } }, }); diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 4e45a1a7bc0..0af44f14bc3 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -530,7 +530,7 @@ <field name="source_id" invisible="1"/> <field name="stage_id"/> <field name="planned_revenue" sum="Expected Revenues"/> - <field name="probability" /> + <field name="probability" avg="Avg. of Probability"/> <field name="team_id"/> <field name="user_id"/> <field name="referred" invisible="1"/> diff --git a/addons/l10n_in/l10n_in_standard_tax_template.xml b/addons/l10n_in/l10n_in_standard_tax_template.xml index bf517691e55..03c239bb4c8 100644 --- a/addons/l10n_in/l10n_in_standard_tax_template.xml +++ b/addons/l10n_in/l10n_in_standard_tax_template.xml @@ -464,7 +464,7 @@ <field name="account_id" ref="p11235"/> <field name="refund_account_id" ref="p20011"/> <field name="chart_template_id" ref="indian_chart_template_standard"/> - <field name="tag_ids" eval="[(6,0,[ref('st_tag_in_70'), ref('st_tag_in_21')])]"/> + <field name="tag_ids" eval="[(6, 0, [ref('st_tag_in_21'), ref('st_tag_in_66')])]"/> </record> <record id="input_tax_12" model="account.tax.template"> <field name="name">(standard)Input Sales Tax @ 12%</field> @@ -476,7 +476,7 @@ <field name="account_id" ref="p11235"/> <field name="refund_account_id" ref="p20011"/> <field name="chart_template_id" ref="indian_chart_template_standard"/> - <field name="tag_ids" eval="[(6,0,[ref('st_tag_in_56')])]"/> + <field name="tag_ids" eval="[(6, 0, [ref('st_tag_in_18'), ref('st_tag_in_63')])]"/> </record> <record id="input_tax_4" model="account.tax.template"> <field name="name">(standard)Input Sales Tax @ 4%</field> @@ -488,7 +488,7 @@ <field name="account_id" ref="p11235"/> <field name="refund_account_id" ref="p20011"/> <field name="chart_template_id" ref="indian_chart_template_standard"/> - <field name="tag_ids" eval="[(6,0,[ref('st_tag_in_15'), ref('st_tag_in_70')])]"/> + <field name="tag_ids" eval="[(6, 0, [ref('st_tag_in_15'), ref('st_tag_in_60')])]"/> </record> <record id="add_input_vat_1" model="account.tax.template"> <field name="name">(standard)Additional Input VAT @ 1%</field> @@ -607,7 +607,7 @@ <field name="account_id" ref="p112341"/> <field name="refund_account_id" ref="p20011"/> <field name="chart_template_id" ref="indian_chart_template_standard"/> - <field name="tag_ids" eval="[(6,0,[ref('st_tag_in_25')])]"/> + <field name="tag_ids" eval="[(6, 0, [ref('st_tag_in_25'), ref('st_tag_in_63')])]"/> </record> <record id="sale_edu_cess_service_tax_2" model="account.tax.template"> <field name="name">(standard)Input Education Cess @ 2% On Service Tax</field> diff --git a/addons/purchase/invoice.py b/addons/purchase/invoice.py index 2f634ef2c6a..49cc77ec0c8 100644 --- a/addons/purchase/invoice.py +++ b/addons/purchase/invoice.py @@ -30,6 +30,35 @@ class AccountInvoice(models.Model): ]} return result + def _prepare_invoice_line_from_po_line(self, line): + if line.product_id.purchase_method == 'purchase': + qty = line.product_qty - line.qty_invoiced + else: + qty = line.qty_received - line.qty_invoiced + if float_compare(qty, 0.0, precision_rounding=line.product_uom.rounding) <= 0: + qty = 0.0 + taxes = line.taxes_id + invoice_line_tax_ids = self.purchase_id.fiscal_position_id.map_tax(taxes) + invoice_line = self.env['account.invoice.line'] + data = { + 'purchase_line_id': line.id, + 'name': self.purchase_id.name+': '+line.name, + 'origin': self.purchase_id.origin, + 'uom_id': line.product_uom.id, + 'product_id': line.product_id.id, + 'account_id': invoice_line.with_context({'journal_id': self.journal_id.id, 'type': 'in_invoice'})._default_account(), + 'price_unit': line.order_id.currency_id.compute(line.price_unit, self.currency_id, round=False), + 'quantity': qty, + 'discount': 0.0, + 'account_analytic_id': line.account_analytic_id.id, + 'analytic_tag_ids': line.analytic_tag_ids.ids, + 'invoice_line_tax_ids': invoice_line_tax_ids.ids + } + account = invoice_line.get_invoice_line_account('in_invoice', line.product_id, self.purchase_id.fiscal_position_id, self.env.user.company_id) + if account: + data['account_id'] = account.id + return data + # Load all unsold PO lines @api.onchange('purchase_id') def purchase_order_change(self): @@ -43,31 +72,7 @@ class AccountInvoice(models.Model): # Load a PO line only once if line in self.invoice_line_ids.mapped('purchase_line_id'): continue - if line.product_id.purchase_method == 'purchase': - qty = line.product_qty - line.qty_invoiced - else: - qty = line.qty_received - line.qty_invoiced - if float_compare(qty, 0.0, precision_rounding=line.product_uom.rounding) <= 0: - qty = 0.0 - taxes = line.taxes_id - invoice_line_tax_ids = self.purchase_id.fiscal_position_id.map_tax(taxes) - data = { - 'purchase_line_id': line.id, - 'name': self.purchase_id.name+': '+line.name, - 'origin': self.purchase_id.origin, - 'uom_id': line.product_uom.id, - 'product_id': line.product_id.id, - 'account_id': self.env['account.invoice.line'].with_context({'journal_id': self.journal_id.id, 'type': 'in_invoice'})._default_account(), - 'price_unit': line.order_id.currency_id.compute(line.price_unit, self.currency_id, round=False), - 'quantity': qty, - 'discount': 0.0, - 'account_analytic_id': line.account_analytic_id.id, - 'analytic_tag_ids': line.analytic_tag_ids.ids, - 'invoice_line_tax_ids': invoice_line_tax_ids.ids - } - account = new_lines.get_invoice_line_account('in_invoice', line.product_id, self.purchase_id.fiscal_position_id, self.env.user.company_id) - if account: - data['account_id'] = account.id + data = self._prepare_invoice_line_from_po_line(line) new_line = new_lines.new(data) new_line._set_additional_fields(self) new_lines += new_line diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 1497fb692d3..a543f598148 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -81,6 +81,10 @@ class SaleAdvancePaymentInv(models.TransientModel): else: amount = self.amount name = _('Down Payment') + if order.fiscal_position_id and self.product_id.taxes_id: + tax_ids = order.fiscal_position_id.map_tax(self.product_id.taxes_id).ids + else: + tax_ids = self.product_id.taxes_id.ids invoice = inv_obj.create({ 'name': order.client_order_ref or order.name, @@ -99,7 +103,7 @@ class SaleAdvancePaymentInv(models.TransientModel): 'uom_id': self.product_id.uom_id.id, 'product_id': self.product_id.id, 'sale_line_ids': [(6, 0, [so_line.id])], - 'invoice_line_tax_ids': [(6, 0, [x.id for x in self.product_id.taxes_id])], + 'invoice_line_tax_ids': [(6, 0, tax_ids)], 'account_analytic_id': order.project_id.id or False, })], 'currency_id': order.pricelist_id.currency_id.id, @@ -135,6 +139,10 @@ class SaleAdvancePaymentInv(models.TransientModel): raise UserError(_('The product used to invoice a down payment should have an invoice policy set to "Ordered quantities". Please update your deposit product to be able to create a deposit invoice.')) if self.product_id.type != 'service': raise UserError(_("The product used to invoice a down payment should be of type 'Service'. Please use another product or update this product.")) + if order.fiscal_position_id and self.product_id.taxes_id: + tax_ids = order.fiscal_position_id.map_tax(self.product_id.taxes_id).ids + else: + tax_ids = self.product_id.taxes_id.ids so_line = sale_line_obj.create({ 'name': _('Advance: %s') % (time.strftime('%m %Y'),), 'price_unit': amount, @@ -143,7 +151,7 @@ class SaleAdvancePaymentInv(models.TransientModel): 'discount': 0.0, 'product_uom': self.product_id.uom_id.id, 'product_id': self.product_id.id, - 'tax_id': [(6, 0, self.product_id.taxes_id.ids)], + 'tax_id': [(6, 0, tax_ids)], }) self._create_invoice(order, so_line, amount) if self._context.get('open_invoices', False): diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 6561b0bd1e3..ccddedc053e 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -85,14 +85,12 @@ class Inventory(models.Model): ('none', _('All products')), ('partial', _('Select products manually')), ('product', _('One product only'))] - stock_settings = self.env['stock.config.settings'].search([], limit=1, order='id DESC') - if not stock_settings: - return res_filter - if stock_settings.group_stock_tracking_owner: + + if self.user_has_groups('stock.group_tracking_owner'): res_filter += [('owner', _('One owner only')), ('product_owner', _('One product for a specific owner'))] - if stock_settings.group_stock_production_lot: + if self.user_has_groups('stock.group_production_lot'): res_filter.append(('lot', _('One Lot/Serial Number'))) - if stock_settings.group_stock_tracking_lot: + if self.user_has_groups('stock.group_tracking_lot'): res_filter.append(('pack', _('A Pack'))) return res_filter diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 9a05a834841..d88fcf56877 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -195,7 +195,6 @@ class StockMove(models.Model): @api.multi def _compute_string_qty_information(self): - StockConfig = self.env['stock.config.settings'] UOM = self.env['product.uom'] precision = self.env['decimal.precision'].precision_get('Product Unit of Measure') void_moves = self.filtered(lambda move: move.state in ('draft', 'done', 'cancel') or move.location_id.usage != 'internal') @@ -207,9 +206,7 @@ class StockMove(models.Model): total_available = UOM._compute_qty_obj(move.product_id.uom_id, total_available, move.product_uom, round=False) total_available = float_round(total_available, precision_digits=precision) info = str(total_available) - # look in the settings if we need to display the UoM name or not - config = StockConfig.search([], limit=1, order='id DESC') - if config and config.group_uom: + if self.user_has_groups('product.group_uom'): info += ' ' + move.product_uom.name if move.reserved_availability: if move.reserved_availability != total_available: @@ -381,7 +378,7 @@ class StockMove(models.Model): # if no specialized push rule has been found yet, we try to find a general one (without route) rules = Push.search(domain + [('route_id', '=', False)], order='sequence') # Make sure it is not returning the return - if rules and (not move.origin_returned_move_id or move.origin_returned_move_id.location_id.id != rules.location_dest_id.id): + if rules and (not move.origin_returned_move_id or move.origin_returned_move_id.location_dest_id.id != rules.location_dest_id.id): rules._apply(move) return True diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 0f927b43561..b545b44ce67 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -221,6 +221,13 @@ class stock_quant(osv.osv): else: self._create_account_move_line(cr, uid, quants, move, acc_valuation, acc_dest, journal_id, context=ctx) + if move.company_id.anglo_saxon_accounting and move.location_id.usage == 'supplier' and move.location_dest_id.usage == 'customer': + # Creates an account entry from stock_input to stock_output on a dropship move. https://github.com/odoo/odoo/issues/12687 + ctx = context.copy() + ctx['force_company'] = move.company_id.id + journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, context=ctx) + self._create_account_move_line(cr, uid, quants, move, acc_src, acc_dest, journal_id, context=ctx) + def _quant_create_from_move(self, cr, uid, qty, move, lot_id=False, owner_id=False, src_package_id=False, dest_package_id=False, force_location_from=False, force_location_to=False, context=None): quant_obj = self.pool.get('stock.quant') quant = super(stock_quant, self)._quant_create_from_move(cr, uid, qty, move, lot_id=lot_id, owner_id=owner_id, src_package_id=src_package_id, dest_package_id=dest_package_id, force_location_from=force_location_from, force_location_to=force_location_to, context=context) diff --git a/addons/utm/models/ir_http.py b/addons/utm/models/ir_http.py index d690d42399c..85812d6d0c1 100644 --- a/addons/utm/models/ir_http.py +++ b/addons/utm/models/ir_http.py @@ -10,8 +10,16 @@ class IrHttp(models.AbstractModel): return request.httprequest.host def _dispatch(self): + tracked_fields = self.pool['utm.mixin'].tracking_fields() response = super(IrHttp, self)._dispatch() - for var, dummy, cook in self.pool['utm.mixin'].tracking_fields(): + + + # no set_cookie on Exception + if isinstance(response, Exception): + return response + + for var, dummy, cook in tracked_fields: if var in request.params and request.httprequest.cookies.get(var) != request.params[var]: response.set_cookie(cook, request.params[var], domain=self.get_utm_domain_cookies()) + return response diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js index 128fead3894..1a916843e6d 100644 --- a/addons/web/static/src/js/views/list_view.js +++ b/addons/web/static/src/js/views/list_view.js @@ -1733,7 +1733,7 @@ var Column = Class.extend({ } var aggregation_func = (this.sum && 'sum') || (this.avg && 'avg') || - (this.max && 'max') || (this.min && 'min') || this.group_operator; + (this.max && 'max') || (this.min && 'min'); if (!aggregation_func) { return {}; diff --git a/addons/web/static/src/js/web_client.js b/addons/web/static/src/js/web_client.js index 4a9ce5e11ff..868a3b7d825 100644 --- a/addons/web/static/src/js/web_client.js +++ b/addons/web/static/src/js/web_client.js @@ -113,25 +113,37 @@ return AbstractWebClient.extend({ } }, on_hashchange: function(event) { + if (this._ignore_hashchange) { + this._ignore_hashchange = false; + return; + } + var self = this; - var stringstate = event.getState(false); - if (!_.isEqual(this._current_state, stringstate)) { - var state = event.getState(true); - if(!state.action && state.menu_id) { - self.menu.is_bound.done(function() { - self.menu.menu_click(state.menu_id); - }); - } else { - state._push_me = false; // no need to push state back... - this.action_manager.do_load_state(state, !!this._current_state).then(function () { - var action = self.action_manager.get_inner_action(); - if (action) { - self.menu.open_action(action.action_descr.id); - } - }); + this.clear_uncommitted_changes().then(function () { + var stringstate = event.getState(false); + if (!_.isEqual(self._current_state, stringstate)) { + var state = event.getState(true); + if(!state.action && state.menu_id) { + self.menu.is_bound.done(function() { + self.menu.menu_click(state.menu_id); + }); + } else { + state._push_me = false; // no need to push state back... + self.action_manager.do_load_state(state, !!self._current_state).then(function () { + var action = self.action_manager.get_inner_action(); + if (action) { + self.menu.open_action(action.action_descr.id); + } + }); + } } - } - this._current_state = stringstate; + self._current_state = stringstate; + }, function () { + if (event) { + self._ignore_hashchange = true; + window.location = event.originalEvent.oldURL; + } + }); }, on_menu_action: function(options) { var self = this; diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js index c2f7ed229a2..e96d354a7e8 100644 --- a/addons/web_kanban/static/src/js/kanban_view.js +++ b/addons/web_kanban/static/src/js/kanban_view.js @@ -64,7 +64,7 @@ var KanbanView = View.extend({ this.qweb.debug = session.debug; this.qweb.default_dict = _.clone(QWeb.default_dict); - this.limit = this.options.limit || 40; + this.limit = this.options.limit || parseInt(this.fields_view.arch.attrs.limit, 10) || 40; this.fields = {}; this.fields_keys = _.keys(this.fields_view.fields); this.grouped = undefined; diff --git a/addons/website_portal/controllers/main.py b/addons/website_portal/controllers/main.py index 87ba93a68b0..1204a75c93b 100644 --- a/addons/website_portal/controllers/main.py +++ b/addons/website_portal/controllers/main.py @@ -6,7 +6,7 @@ from openerp.tools.translate import _ class website_account(http.Controller): - @http.route(['/my', '/my/home'], type='http', auth="public", website=True) + @http.route(['/my', '/my/home'], type='http', auth="user", website=True) def account(self, **kw): partner = request.env.user.partner_id diff --git a/addons/website_portal_sale/controllers/main.py b/addons/website_portal_sale/controllers/main.py index fc88ce8125c..275e58b049c 100644 --- a/addons/website_portal_sale/controllers/main.py +++ b/addons/website_portal_sale/controllers/main.py @@ -9,7 +9,7 @@ from openerp.addons.website_portal.controllers.main import website_account class website_account(website_account): - @http.route(['/my/home'], type='http', auth="user", website=True) + @http.route() def account(self, **kw): """ Add sales documents to main account page """ response = super(website_account, self).account() diff --git a/addons/website_project_issue/controllers/main.py b/addons/website_project_issue/controllers/main.py index 4c15b60761b..cc48a11bb7c 100644 --- a/addons/website_project_issue/controllers/main.py +++ b/addons/website_project_issue/controllers/main.py @@ -6,7 +6,7 @@ from openerp.http import request class WebsiteAccount(website_account): - @http.route(['/my', '/my/home'], type='http', auth="user", website=True) + @http.route() def account(self): response = super(WebsiteAccount, self).account() user = request.env.user diff --git a/addons/website_quote/views/website_quotation.xml b/addons/website_quote/views/website_quotation.xml index ee48f5397d2..3f6f8da4dcd 100644 --- a/addons/website_quote/views/website_quotation.xml +++ b/addons/website_quote/views/website_quotation.xml @@ -289,7 +289,7 @@ <div class="modal-body" id="sign-dialog"> <p> <span>I agree that by signing this proposal, I - accept it on the behalf of </span><b t-field="quotation.company_id"/><span>, for an amount of </span> + accept it on the behalf of </span><b t-field="quotation.partner_id.commercial_partner_id"/><span>, for an amount of </span> <b data-id="total_amount" t-field="quotation.amount_total" t-field-options='{"widget": "monetary", "display_currency": "quotation.pricelist_id.currency_id"}'/> <span>with payment terms: </span><b t-field="quotation.payment_term_id"/>. @@ -316,7 +316,7 @@ <div class="modal-body" id="sign-dialog"> <p> <span>I agree that by paying this proposal, I - accept it on the behalf of </span><b t-field="quotation.company_id"/><span>, for an amount of </span> + accept it on the behalf of </span><b t-field="quotation.partner_id.commercial_partner_id"/><span>, for an amount of </span> <b data-id="total_amount" t-field="quotation.amount_total" t-field-options='{"widget": "monetary", "display_currency": "quotation.pricelist_id.currency_id"}'/> <span>with payment terms: </span><b t-field="quotation.payment_term_id"/>. diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 5c896fd956d..e645a3f5f89 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -137,7 +137,6 @@ class Product(models.Model): self.ensure_one() return self.product_tmpl_id.website_publish_button() - class ProductAttribute(models.Model): _inherit = "product.attribute" |
