diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 1728aecbe33..9fd3787f03b 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -3,7 +3,7 @@ from odoo import api, fields, models, _ from odoo.osv import expression from odoo.tools import float_is_zero -from odoo.tools import float_compare, float_round +from odoo.tools import float_compare, float_round, float_repr from odoo.tools.misc import formatLang from odoo.exceptions import UserError, ValidationError @@ -591,7 +591,8 @@ class AccountBankStatementLine(models.Model): from_clause = "FROM account_move_line aml JOIN account_account acc ON acc.id = aml.account_id " where_clause = """WHERE aml.company_id = %(company_id)s AND ( - (aml.statement_id IS NULL AND aml.account_id IN %(account_payable_receivable)s) + (aml.statement_id IS NULL AND aml.account_id IN %(account_payable_receivable)s + AND aml.payment_id IS NOT NULL) OR ("""+acc_type+""" AND aml.reconciled = false) )""" @@ -615,7 +616,7 @@ class AccountBankStatementLine(models.Model): precision = st_line_currency and st_line_currency.decimal_places or company_currency.decimal_places params = {'company_id': self.env.user.company_id.id, 'account_payable_receivable': (self.journal_id.default_credit_account_id.id, self.journal_id.default_debit_account_id.id), - 'amount': float_round(amount, precision_digits=precision), + 'amount': float_repr(float_round(amount, precision_digits=precision), precision_digits=precision), 'partner_id': self.partner_id.id, 'excluded_ids': tuple(excluded_ids), 'ref': self.name, @@ -636,9 +637,9 @@ class AccountBankStatementLine(models.Model): # Look for a single move line with the same amount field = currency and 'amount_residual_currency' or 'amount_residual' liquidity_field = currency and 'amount_currency' or amount > 0 and 'debit' or 'credit' - liquidity_amt_clause = currency and '%(amount)s' or 'abs(%(amount)s)' + liquidity_amt_clause = currency and '%(amount)s::numeric' or 'abs(%(amount)s::numeric)' sql_query = self._get_common_sql_query(excluded_ids=excluded_ids) + \ - " AND ("+field+" = %(amount)s OR (acc.internal_type = 'liquidity' AND "+liquidity_field+" = " + liquidity_amt_clause + ")) \ + " AND ("+field+" = %(amount)s::numeric OR (acc.internal_type = 'liquidity' AND "+liquidity_field+" = " + liquidity_amt_clause + ")) \ ORDER BY date_maturity asc, aml.id asc LIMIT 1" self.env.cr.execute(sql_query, params) results = self.env.cr.fetchone() diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index cb013f403db..6606450da4d 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -469,7 +469,7 @@ class AccountInvoice(models.Model): @api.onchange('invoice_line_ids') def _onchange_invoice_line_ids(self): taxes_grouped = self.get_taxes_values() - tax_lines = self.tax_line_ids.browse([]) + tax_lines = self.tax_line_ids.filtered('manual') for tax in taxes_grouped.values(): tax_lines += tax_lines.new(tax) self.tax_line_ids = tax_lines diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index ade9b2738d7..d73d9ca9f7a 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -44,7 +44,7 @@ Customer Code:

-

+
Reference:

diff --git a/addons/base_address_city/models/res_partner.py b/addons/base_address_city/models/res_partner.py index afa5cd759e8..f6fcbf61d42 100644 --- a/addons/base_address_city/models/res_partner.py +++ b/addons/base_address_city/models/res_partner.py @@ -20,6 +20,8 @@ class Partner(models.Model): @api.model def _fields_view_get_address(self, arch): arch = super(Partner, self)._fields_view_get_address(arch) + if not self._context.get('no_address_format'): + return arch # render the partner address accordingly to address_view_id doc = etree.fromstring(arch) for city_node in doc.xpath("//field[@name='city']"): diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index e56a181a358..fff0436699f 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -203,7 +203,7 @@ - + - + diff --git a/addons/point_of_sale/i18n/es_PE.po b/addons/point_of_sale/i18n/es_PE.po index a5dd2c6e63e..4f68df80eef 100644 --- a/addons/point_of_sale/i18n/es_PE.po +++ b/addons/point_of_sale/i18n/es_PE.po @@ -2220,9 +2220,8 @@ msgstr "Analisis de Pedidos" #. module: point_of_sale #: code:addons/point_of_sale/models/pos_config.py:180 -#, fuzzy, python-format msgid "POS Order %s" -msgstr "Pedidos de PDV" +msgstr "" #. module: point_of_sale #: model:ir.ui.view,arch_db:point_of_sale.view_pos_order_line_form @@ -2246,9 +2245,8 @@ msgstr "Líneas de Pedido de PDV" #. module: point_of_sale #: code:addons/point_of_sale/models/pos_config.py:191 -#, fuzzy, python-format msgid "POS order line %s" -msgstr "Líneas de Pedido de PDV" +msgstr "" #. module: point_of_sale #: model:ir.ui.view,arch_db:point_of_sale.view_report_pos_order_search diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 9a16c4d5266..809af84aa87 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -162,6 +162,7 @@ class PosOrder(models.Model): 'origin': self.name, 'account_id': self.partner_id.property_account_receivable_id.id, 'journal_id': self.session_id.config_id.invoice_journal_id.id, + 'company_id': self.company_id.id, 'type': 'out_invoice', 'reference': self.name, 'partner_id': self.partner_id.id, @@ -857,21 +858,14 @@ class PosOrderLine(models.Model): @api.depends('price_unit', 'tax_ids', 'qty', 'discount', 'product_id') def _compute_amount_line_all(self): for line in self: - currency = line.order_id.pricelist_id.currency_id - taxes = line.tax_ids.filtered(lambda tax: tax.company_id.id == line.order_id.company_id.id) - fiscal_position_id = line.order_id.fiscal_position_id - if fiscal_position_id: - taxes = fiscal_position_id.map_tax(taxes, line.product_id, line.order_id.partner_id) - price = self.env['account.tax']._fix_tax_included_price( - line.price_unit * (1 - (line.discount or 0.0) / 100.0), line.product_id.taxes_id, taxes) - line.price_subtotal = line.price_subtotal_incl = price * line.qty - if taxes: - taxes = taxes.compute_all(price, currency, line.qty, product=line.product_id, partner=line.order_id.partner_id or False) - line.price_subtotal = taxes['total_excluded'] - line.price_subtotal_incl = taxes['total_included'] - - line.price_subtotal = currency.round(line.price_subtotal) - line.price_subtotal_incl = currency.round(line.price_subtotal_incl) + fpos = line.order_id.fiscal_position_id + tax_ids_after_fiscal_position = fpos.map_tax(line.tax_ids, line.product_id, line.order_id.partner_id) if fpos else line.tax_ids + price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) + taxes = tax_ids_after_fiscal_position.compute_all(price, line.order_id.pricelist_id.currency_id, line.qty, product=line.product_id, partner=line.order_id.partner_id) + line.update({ + 'price_subtotal_incl': taxes['total_included'], + 'price_subtotal': taxes['total_excluded'], + }) @api.onchange('product_id') def _onchange_product_id(self): @@ -883,8 +877,10 @@ class PosOrderLine(models.Model): price = self.order_id.pricelist_id.get_product_price( self.product_id, self.qty or 1.0, self.order_id.partner_id) self._onchange_qty() - self.price_unit = price - self.tax_ids = self.product_id.taxes_id + self.tax_ids = self.product_id.taxes_id.filtered(lambda r: not self.company_id or r.company_id == self.company_id) + fpos = self.order_id.fiscal_position_id + tax_ids_after_fiscal_position = fpos.map_tax(self.tax_ids, line.product_id, line.order_id.partner_id) if fpos else self.tax_ids + self.price_unit = self.env['account.tax']._fix_tax_included_price(price, self.product_id.taxes_id, tax_ids_after_fiscal_position) @api.onchange('qty', 'discount', 'price_unit', 'tax_ids') def _onchange_qty(self): diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index 5e2bcba48f6..93939587ee0 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -20,7 +20,7 @@ class ProductTemplate(models.Model): if self._context.get('categ_id') or self._context.get('default_categ_id'): return self._context.get('categ_id') or self._context.get('default_categ_id') category = self.env.ref('product.product_category_all', raise_if_not_found=False) - return category and category.id or False + return category.id if category.type == 'normal' else False def _get_default_uom_id(self): return self.env["product.uom"].search([], limit=1, order='id').id diff --git a/addons/rating/controllers/main.py b/addons/rating/controllers/main.py index c167a980e72..817f26aa79e 100644 --- a/addons/rating/controllers/main.py +++ b/addons/rating/controllers/main.py @@ -28,7 +28,7 @@ class Rating(http.Controller): 'rate_name': rate_names[rate], 'rate': rate }) - @http.route(['/rating///submit_feedback'], type="http", auth="public", method=['post']) + @http.route(['/rating///submit_feedback'], type="http", auth="public", methods=['post']) def submit_rating(self, token, rate, **kwargs): rating = request.env['rating.rating'].sudo().search([('access_token', '=', token)]) if not rating: diff --git a/addons/sale/__init__.py b/addons/sale/__init__.py index d84fb182e8f..7e12dedf6a4 100644 --- a/addons/sale/__init__.py +++ b/addons/sale/__init__.py @@ -1,6 +1,24 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + +from functools import partial +import openerp +from openerp import api, SUPERUSER_ID + import models import report import wizard + + +def uninstall_hook(cr, registry): + def update_dashboard_graph_model(dbname): + db_registry = openerp.modules.registry.RegistryManager.new(dbname) + with api.Environment.manage(), db_registry.cursor() as cr: + env = api.Environment(cr, SUPERUSER_ID, {}) + if 'crm.team' in env: + recs = env['crm.team'].search([]) + for rec in recs: + rec._onchange_team_type() + + cr.after("commit", partial(update_dashboard_graph_model, cr.dbname)) \ No newline at end of file diff --git a/addons/sale/__manifest__.py b/addons/sale/__manifest__.py index f44873daa8e..d1be4a05528 100644 --- a/addons/sale/__manifest__.py +++ b/addons/sale/__manifest__.py @@ -65,6 +65,7 @@ The Dashboard for the Sales Manager will include 'data/sale_demo.xml', 'data/product_product_demo.xml', ], + 'uninstall_hook': "uninstall_hook", 'css': ['static/src/css/sale.css'], 'installable': True, 'auto_install': False, diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 1d144695f52..eac6318e0d7 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -317,12 +317,15 @@ class Quant(models.Model): # price update + accounting entries adjustments solved_quants._price_update(solving_quant.cost) # merge history (and cost?) - solved_quants.write({ - 'history_ids': [(4, history_move.id) for history_move in solving_quant.history_ids] - }) + solved_quants.write(solving_quant._prepare_history()) solving_quant.with_context(force_unlink=True).unlink() solving_quant = remaining_solving_quant + def _prepare_history(self): + return { + 'history_ids': [(4, history_move.id) for history_move in self.history_ids], + } + @api.multi def _price_update(self, newprice): # TDE note: use ACLs instead of sudoing everything diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 85bd770bacc..54bb061ad06 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1003,6 +1003,8 @@ class Binary(http.Controller): elif status != 200 and download: return request.not_found() + height = int(height) + width = int(width) if content and (width or height): # resize maximum 500*500 if width > 500: diff --git a/addons/web/static/src/js/apps.js b/addons/web/static/src/js/apps.js index 7250674272c..bb642ed57e7 100644 --- a/addons/web/static/src/js/apps.js +++ b/addons/web/static/src/js/apps.js @@ -61,7 +61,7 @@ var Apps = Widget.extend({ }, destroy: function() { - $(window).off("message.apps"); + $(window).off("message." + this.uniq); if (this.$ifr) { this.$ifr.remove(); this.$ifr = null; @@ -116,10 +116,11 @@ var Apps = Widget.extend({ qs.debug = session.debug; } var u = $.param.querystring(client.origin + "/apps/embed/client", qs); - var css = {width: '100%', height: '400px'}; + var css = {width: '100%', height: '750px'}; self.$ifr = $('