[MIGR] stock: reports and controllers
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
|
||||
from openerp import http
|
||||
from openerp.http import request
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BarcodeController(http.Controller):
|
||||
|
||||
@http.route(['/stock/barcode/'], type='http', auth='user')
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.sql import drop_view_if_exists
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools.sql import drop_view_if_exists
|
||||
|
||||
class report_stock_lines_date(osv.osv):
|
||||
|
||||
class ReportStockLinesDate(models.Model):
|
||||
_name = "report.stock.lines.date"
|
||||
_description = "Dates of Inventories and latest Moves"
|
||||
_auto = False
|
||||
_order = "date"
|
||||
_columns = {
|
||||
'id': fields.integer('Product Id', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
|
||||
'date': fields.datetime('Date of latest Inventory', readonly=True),
|
||||
'move_date': fields.datetime('Date of latest Stock Move', readonly=True),
|
||||
"active": fields.boolean("Active", readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
drop_view_if_exists(cr, 'report_stock_lines_date')
|
||||
cr.execute("""
|
||||
id = fields.Integer('Product Id', readonly=True)
|
||||
product_id = fields.Many2one('product.product', 'Product', readonly=True, select=True)
|
||||
date = fields.Datetime('Date of latest Inventory', readonly=True)
|
||||
move_date = fields.Datetime('Date of latest Stock Move', readonly=True)
|
||||
active = fields.Boolean("Active", readonly=True)
|
||||
|
||||
@api.model_cr
|
||||
def init(self):
|
||||
drop_view_if_exists(self._cr, 'report_stock_lines_date')
|
||||
self._cr.execute("""
|
||||
create or replace view report_stock_lines_date as (
|
||||
select
|
||||
p.id as id,
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from openerp import fields, models
|
||||
from openerp import tools
|
||||
from odoo import api, fields, models, tools
|
||||
|
||||
|
||||
class report_stock_forecast(models.Model):
|
||||
class ReportStockForecat(models.Model):
|
||||
_name = 'report.stock.forecast'
|
||||
_auto = False
|
||||
|
||||
@@ -15,9 +13,10 @@ class report_stock_forecast(models.Model):
|
||||
cumulative_quantity = fields.Float(string='Cumulative Quantity', readonly=True)
|
||||
quantity = fields.Float(readonly=True)
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_stock_forecast')
|
||||
cr.execute("""CREATE or REPLACE VIEW report_stock_forecast AS (SELECT
|
||||
@api.model_cr
|
||||
def init(self):
|
||||
tools.drop_view_if_exists(self._cr, 'report_stock_forecast')
|
||||
self._cr.execute("""CREATE or REPLACE VIEW report_stock_forecast AS (SELECT
|
||||
MIN(id) as id,
|
||||
product_id as product_id,
|
||||
date as date,
|
||||
|
||||
Reference in New Issue
Block a user