mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_demand_estimate: migrate to v10
This commit is contained in:
committed by
DavidJForgeFlow
parent
4cef761d3f
commit
b0812adb4b
@@ -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
|
||||
===========
|
||||
|
||||
@@ -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",
|
||||
@@ -2,7 +2,7 @@
|
||||
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# 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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
|
||||
<data noupdate="1">
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record model="ir.rule" id="stock_demand_estimate_comp_rule">
|
||||
<field name="name">Stock demand estimate multi-company</field>
|
||||
@@ -10,5 +8,4 @@
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view"
|
||||
id="view_stock_demand_estimate_tree">
|
||||
@@ -51,5 +50,4 @@
|
||||
parent="menu_stock_demand_planning"
|
||||
action="stock_demand_estimate_form_action"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view"
|
||||
id="view_stock_demand_estimate_sheet_form">
|
||||
@@ -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">
|
||||
<tree>
|
||||
<field name="value_x"/>
|
||||
<field name="value_y"/>
|
||||
<field name="product_uom_qty"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="button_validate"
|
||||
@@ -84,5 +91,4 @@
|
||||
parent="menu_stock_demand_planning"
|
||||
action="action_stock_demand_estimate_wizard"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user