From ef5779cedb7dfb10ef1766ebcd77ca8a3133ee8e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 27 Oct 2016 09:33:15 +0200 Subject: [PATCH] Port base_usability, sale_usability, sale_stock_usability to v10 --- sale_stock_usability/__manifest__.py | 25 ++---------- sale_stock_usability/sale_stock.py | 47 ++------------------- sale_stock_usability/sale_stock_view.xml | 43 ++++---------------- sale_usability/__init__.py | 1 - sale_usability/__manifest__.py | 26 ++---------- sale_usability/account_invoice.py | 32 --------------- sale_usability/sale.py | 37 ++++++----------- sale_usability/sale_view.xml | 52 ++++++++++++++---------- stock_usability/__manifest__.py | 25 ++---------- stock_usability/stock.py | 34 ++++++---------- stock_usability/stock_view.xml | 13 ++++++ 11 files changed, 91 insertions(+), 244 deletions(-) delete mode 100644 sale_usability/account_invoice.py diff --git a/sale_stock_usability/__manifest__.py b/sale_stock_usability/__manifest__.py index b6e8440..59d51f9 100644 --- a/sale_stock_usability/__manifest__.py +++ b/sale_stock_usability/__manifest__.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Sale Stock Usability module for Odoo -# Copyright (C) 2015 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015-2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { @@ -42,5 +25,5 @@ This module has been written by Alexis de Lattre from Akretion -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2015-2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, fields @@ -28,25 +11,3 @@ class SaleOrder(models.Model): warehouse_id = fields.Many2one(track_visibility='onchange') incoterm = fields.Many2one(track_visibility='onchange') - - -class SaleOrderLine(models.Model): - _inherit = 'sale.order.line' - - # The sale_stock module defines the field product_tmpl_id as related - # field without readonly=True, which causes some access right issues - # when you change the product on a sale.order.line and you don't have - # write access on product.product - product_tmpl_id = fields.Many2one( - 'product.template', related='product_id.product_tmpl_id', - string='Product Template', readonly=True) - - -class ProcurementGroup(models.Model): - _inherit = 'procurement.group' - - sale_ids = fields.One2many( - 'sale.order', 'procurement_group_id', string='Sale Orders', - readonly=True) - picking_ids = fields.One2many( - 'stock.picking', 'group_id', string='Pickings', readonly=True) diff --git a/sale_stock_usability/sale_stock_view.xml b/sale_stock_usability/sale_stock_view.xml index 3930596..2f9f3ca 100644 --- a/sale_stock_usability/sale_stock_view.xml +++ b/sale_stock_usability/sale_stock_view.xml @@ -1,26 +1,14 @@ - - - - - - sale_stock_usability.picking.search - stock.picking - - - - [('invoice_state', '=', '2binvoiced'), ('state', '=', 'done')] - - - + + - - - sale_stock_usability.procurement.group.form - procurement.group - - - - - - - - - - - - - - - + diff --git a/sale_usability/__init__.py b/sale_usability/__init__.py index 581371f..78a9604 100644 --- a/sale_usability/__init__.py +++ b/sale_usability/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- from . import sale -from . import account_invoice diff --git a/sale_usability/__manifest__.py b/sale_usability/__manifest__.py index d430f7e..6e38faa 100644 --- a/sale_usability/__manifest__.py +++ b/sale_usability/__manifest__.py @@ -1,25 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Sale Usability module for Odoo -# Copyright (C) 2014-2016 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - +# © 2014-2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Sale Usability', @@ -44,5 +26,5 @@ Please contact Alexis de Lattre from Akretion for 'data': [ 'sale_view.xml', ], - 'installable': False, + 'installable': True, } diff --git a/sale_usability/account_invoice.py b/sale_usability/account_invoice.py deleted file mode 100644 index 3f11b0e..0000000 --- a/sale_usability/account_invoice.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Sale Usability Extension module for Odoo -# Copyright (C) 2015 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp import models, fields - - -class AccountInvoiceLine(models.Model): - _inherit = 'account.invoice.line' - - # reverse of the native M2M invoice_lines field on sale.order.line - sale_line_ids = fields.Many2many( - 'sale.order.line', 'sale_order_line_invoice_rel', 'invoice_id', - 'order_line_id', 'Sale Order Lines', readonly=True) diff --git a/sale_usability/sale.py b/sale_usability/sale.py index 4c5e82e..dcf68fd 100644 --- a/sale_usability/sale.py +++ b/sale_usability/sale.py @@ -1,32 +1,13 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Sale Usability Extension module for Odoo +# -*- coding: utf-8 -*- # Copyright (C) 2015 Akretion (http://www.akretion.com) # @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## -from openerp import models, fields +from odoo import models, fields class SaleOrder(models.Model): _inherit = 'sale.order' - state = fields.Selection(track_visibility='onchange') date_order = fields.Datetime(track_visibility='onchange') date_confirm = fields.Date(track_visibility='onchange') client_order_ref = fields.Char(track_visibility='onchange') @@ -34,7 +15,13 @@ class SaleOrder(models.Model): partner_shipping_id = fields.Many2one(track_visibility='onchange') partner_invoice_id = fields.Many2one(track_visibility='onchange') pricelist_id = fields.Many2one(track_visibility='onchange') - order_policy = fields.Selection(track_visibility='onchange') - payment_term = fields.Many2one(track_visibility='onchange') - fiscal_position = fields.Many2one(track_visibility='onchange') - user_id = fields.Many2one(track_visibility='onchange') + payment_term_id = fields.Many2one(track_visibility='onchange') + fiscal_position_id = fields.Many2one(track_visibility='onchange') + + +class ProcurementGroup(models.Model): + _inherit = 'procurement.group' + + sale_ids = fields.One2many( + 'sale.order', 'procurement_group_id', string='Sale Orders', + readonly=True) diff --git a/sale_usability/sale_view.xml b/sale_usability/sale_view.xml index cb0fa20..04af21e 100644 --- a/sale_usability/sale_view.xml +++ b/sale_usability/sale_view.xml @@ -1,12 +1,11 @@ - - + usability.sale.order.form @@ -18,11 +17,7 @@ - - - - + selection @@ -34,10 +29,7 @@ - - - - + @@ -48,10 +40,7 @@ - - - - + 1 @@ -62,7 +51,16 @@ - + + usability.sale.order.search + sale.order + + + + + + + procurement_usability.procurement.order.form @@ -75,5 +73,17 @@ - - + + sale_usability.procurement.group.form + procurement.group + + + + + + + + + + + diff --git a/stock_usability/__manifest__.py b/stock_usability/__manifest__.py index a5a3f1e..c56ed84 100644 --- a/stock_usability/__manifest__.py +++ b/stock_usability/__manifest__.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Stock Usability module for Odoo -# Copyright (C) 2014-2015 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2014-2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { @@ -48,5 +31,5 @@ This module has been written by Alexis de Lattre from Akretion -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2014-2016 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api -import openerp.addons.decimal_precision as dp +from odoo import models, fields, api +import odoo.addons.decimal_precision as dp import logging logger = logging.getLogger(__name__) @@ -121,3 +104,10 @@ class StockIncoterms(models.Model): for inco in self: res.append((inco.id, u'[%s] %s' % (inco.code, inco.name))) return res + + +class ProcurementGroup(models.Model): + _inherit = 'procurement.group' + + picking_ids = fields.One2many( + 'stock.picking', 'group_id', string='Pickings', readonly=True) diff --git a/stock_usability/stock_view.xml b/stock_usability/stock_view.xml index 1dda15b..0184e9a 100644 --- a/stock_usability/stock_view.xml +++ b/stock_usability/stock_view.xml @@ -284,5 +284,18 @@ in the quantities for his reception --> + + stock_usability.procurement.group.form + procurement.group + + + + + + + + + +