diff --git a/stock_demand_estimate/README.rst b/stock_demand_estimate/README.rst index b640d0e95..436eacf48 100644 --- a/stock_demand_estimate/README.rst +++ b/stock_demand_estimate/README.rst @@ -17,9 +17,9 @@ Installation This module relies on: * The OCA module '2D matrix for x2many fields', and can be downloaded from - Github: https://github.com/OCA/web/tree/9.0/web_widget_x2many_2d_matrix + Github: https://github.com/OCA/web/tree/10.0/web_widget_x2many_2d_matrix * The OCA module 'Date Range', and can be downloaded from - Github: https://github.com/OCA/server-tools/tree/9.0/date_range + Github: https://github.com/OCA/server-tools/tree/10.0/date_range Usage @@ -36,7 +36,7 @@ estimates created. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/153/9.0 + :target: https://runbot.odoo-community.org/runbot/153/10.0 Bug Tracker =========== diff --git a/stock_demand_estimate/__openerp__.py b/stock_demand_estimate/__manifest__.py similarity index 96% rename from stock_demand_estimate/__openerp__.py rename to stock_demand_estimate/__manifest__.py index 04f151bda..8a17a7823 100644 --- a/stock_demand_estimate/__openerp__.py +++ b/stock_demand_estimate/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Stock Demand Estimate", "summary": "Allows to create demand estimates.", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "author": "Eficent, " "Odoo Community Association (OCA)", "website": "https://www.odoo-community.org", diff --git a/stock_demand_estimate/models/date_range.py b/stock_demand_estimate/models/date_range.py index 7f8ab153e..2d6a49bdb 100644 --- a/stock_demand_estimate/models/date_range.py +++ b/stock_demand_estimate/models/date_range.py @@ -2,7 +2,7 @@ # © 2016 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import api, fields, models +from odoo import api, fields, models class DateRange(models.Model): diff --git a/stock_demand_estimate/models/stock_demand_estimate.py b/stock_demand_estimate/models/stock_demand_estimate.py index 1ef7eaf70..d2ff19fee 100644 --- a/stock_demand_estimate/models/stock_demand_estimate.py +++ b/stock_demand_estimate/models/stock_demand_estimate.py @@ -4,9 +4,9 @@ # © 2016 Aleph Objects, Inc. (https://www.alephobjects.com/) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models, _ -import openerp.addons.decimal_precision as dp -from openerp.exceptions import Warning as UserError +from odoo import api, fields, models, _ +import odoo.addons.decimal_precision as dp +from odoo.exceptions import Warning as UserError class StockDemandEstimate(models.Model): @@ -15,14 +15,14 @@ class StockDemandEstimate(models.Model): @api.multi @api.depends('product_id', 'product_uom', 'product_uom_qty') - def _compute_product_qty(self): + def _compute_product_quantity(self): for rec in self: if rec.product_uom: - rec.product_qty = rec.product_uom._compute_qty( - rec.product_id.uom_id.id, rec.product_uom_qty, - rec.product_uom.id) + rec.product_qty = rec.product_uom._compute_quantity( + rec.product_uom_qty, + rec.product_id.uom_id) - def _inverse_product_qty(self): + def _inverse_product_quantity(self): raise UserError(_('The requested operation cannot be ' 'processed because of a programming error ' 'setting the `product_qty` field instead ' @@ -45,9 +45,10 @@ class StockDemandEstimate(models.Model): string="Location", required=True) product_uom_qty = fields.Float( string="Quantity", - digits_compute=dp.get_precision('Product Unit of Measure')) - product_qty = fields.Float('Real Quantity', compute='_compute_product_qty', - inverse='_inverse_product_qty', digits=0, + digits=dp.get_precision('Product Unit of Measure')) + product_qty = fields.Float('Real Quantity', + compute='_compute_product_quantity', + inverse='_inverse_product_quantity', digits=0, store=True, help='Quantity in the default UoM of the ' 'product', readonly=True) diff --git a/stock_demand_estimate/security/stock_security.xml b/stock_demand_estimate/security/stock_security.xml index 7dc10eb89..d26124b0f 100644 --- a/stock_demand_estimate/security/stock_security.xml +++ b/stock_demand_estimate/security/stock_security.xml @@ -1,7 +1,5 @@ - - - + Stock demand estimate multi-company @@ -10,5 +8,4 @@ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] - - + diff --git a/stock_demand_estimate/tests/test_stock_demand_estimate.py b/stock_demand_estimate/tests/test_stock_demand_estimate.py index 1f3336a92..52f694bb4 100644 --- a/stock_demand_estimate/tests/test_stock_demand_estimate.py +++ b/stock_demand_estimate/tests/test_stock_demand_estimate.py @@ -2,9 +2,9 @@ # Copyright 2017 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp.tests import common +from odoo.tests import common from dateutil.rrule import MONTHLY -from openerp.exceptions import ValidationError +from odoo.exceptions import ValidationError class TestStockDemandEstimate(common.TransactionCase): diff --git a/stock_demand_estimate/views/stock_demand_estimate_view.xml b/stock_demand_estimate/views/stock_demand_estimate_view.xml index 343ba25a2..45e084004 100644 --- a/stock_demand_estimate/views/stock_demand_estimate_view.xml +++ b/stock_demand_estimate/views/stock_demand_estimate_view.xml @@ -1,6 +1,5 @@ - - + @@ -51,5 +50,4 @@ parent="menu_stock_demand_planning" action="stock_demand_estimate_form_action"/> - - + diff --git a/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py b/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py index ebab92e02..d4abacc22 100644 --- a/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py +++ b/stock_demand_estimate/wizards/stock_demand_estimate_wizard.py @@ -4,9 +4,9 @@ # © 2016 Aleph Objects, Inc. (https://www.alephobjects.com/) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models, _ -import openerp.addons.decimal_precision as dp -from openerp.exceptions import UserError, ValidationError +from odoo import api, fields, models, _ +import odoo.addons.decimal_precision as dp +from odoo.exceptions import UserError, ValidationError class StockDemandEstimateSheet(models.TransientModel): @@ -80,7 +80,7 @@ class StockDemandEstimateSheet(models.TransientModel): line_ids = fields.Many2many( string="Estimates", comodel_name='stock.demand.estimate.sheet.line', - rel='stock_demand_estimate_line_rel', + relation='stock_demand_estimate_line_rel', default=_default_estimate_ids) @api.model @@ -132,7 +132,7 @@ class StockDemandEstimateSheetLine(models.TransientModel): value_x = fields.Char(string='Period') value_y = fields.Char(string='Product') product_uom_qty = fields.Float( - string="Quantity", digits_compute=dp.get_precision('Product UoM')) + string="Quantity", digits=dp.get_precision('Product UoM')) class DemandEstimateWizard(models.TransientModel): @@ -150,6 +150,15 @@ class DemandEstimateWizard(models.TransientModel): comodel_name="product.product", string="Products") + @api.onchange('date_range_type_id') + def _onchange_date_range_type_id(self): + if self.date_range_type_id.company_id: + return { + 'domain': { + 'location_id': [('company_id', '=', + self.date_range_type_id.company_id.id)]}} + return {} + @api.one @api.constrains('date_start', 'date_end') def _check_start_end_dates(self): diff --git a/stock_demand_estimate/wizards/stock_demand_estimate_wizard_view.xml b/stock_demand_estimate/wizards/stock_demand_estimate_wizard_view.xml index 64a046ba3..1b072a7fd 100644 --- a/stock_demand_estimate/wizards/stock_demand_estimate_wizard_view.xml +++ b/stock_demand_estimate/wizards/stock_demand_estimate_wizard_view.xml @@ -1,6 +1,5 @@ - - + @@ -26,7 +25,15 @@ widget="x2many_2d_matrix" field_x_axis="value_x" field_y_axis="value_y" - field_value="product_uom_qty"/> + field_value="product_uom_qty" + x_axis_clickable="0" + y_axis_clickable="0"> + + + + + +