# -*- encoding: 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 SaleOrder(models.Model): _inherit = 'sale.order' 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)