From 447ef04450cd7136e23d5581435d30fc032cb04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 9 Aug 2016 15:45:04 +0200 Subject: [PATCH] [MIG] point_of_sale: migrate remaining code in old API --- addons/point_of_sale/models/pos_order.py | 3 ++- addons/point_of_sale/report/pos_order_report.py | 10 +++++----- addons/point_of_sale/tests/test_point_of_sale_flow.py | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 8ba58432a97..7ec568d5dd1 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -19,7 +19,8 @@ class PosOrder(models.Model): _description = "Point of Sale" _order = "id desc" - def _amount_line_tax(self, cr, uid, line, fiscal_position_id, context=None): + @api.model + def _amount_line_tax(self, line, fiscal_position_id): taxes = line.tax_ids.filtered(lambda t: t.company_id.id == line.order_id.company_id.id) if fiscal_position_id: taxes = fiscal_position_id.map_tax(taxes, line.product_id, line.order_id.partner_id) diff --git a/addons/point_of_sale/report/pos_order_report.py b/addons/point_of_sale/report/pos_order_report.py index 8da7aa2ec93..bd460445540 100644 --- a/addons/point_of_sale/report/pos_order_report.py +++ b/addons/point_of_sale/report/pos_order_report.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, tools +from odoo import api, fields, models, tools class PosOrderReport(models.Model): @@ -38,10 +38,10 @@ class PosOrderReport(models.Model): pricelist_id = fields.Many2one('product.pricelist', string='Pricelist', readonly=True) session_id = fields.Many2one('pos.session', string='Session', readonly=True) - - def init(self, cr): - tools.drop_view_if_exists(cr, 'report_pos_order') - cr.execute(""" + @api.model_cr + def init(self): + tools.drop_view_if_exists(self._cr, 'report_pos_order') + self._cr.execute(""" CREATE OR REPLACE VIEW report_pos_order AS ( SELECT MIN(l.id) AS id, diff --git a/addons/point_of_sale/tests/test_point_of_sale_flow.py b/addons/point_of_sale/tests/test_point_of_sale_flow.py index 023eff033a0..f033e66bbb5 100644 --- a/addons/point_of_sale/tests/test_point_of_sale_flow.py +++ b/addons/point_of_sale/tests/test_point_of_sale_flow.py @@ -209,8 +209,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon): 'debit': 0.0, }] - self.AccountBankStatementLine._model.process_reconciliations( - self.env.cr, self.env.uid, [account_statement_line.id], [{'new_aml_dicts': new_aml_dicts}]) + account_statement_line.process_reconciliations([{'new_aml_dicts': new_aml_dicts}]) # I confirm the bank statement using Confirm button