began work on bemade_carrier_so_to_picking

This commit is contained in:
Marc Durepos 2023-09-18 21:22:58 -04:00
parent 02f380dc91
commit 7ab7b5551f
4 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,32 @@
#
# Bemade Inc.
#
# Copyright (C) September 2023 Bemade Inc. (<https://www.bemade.org>).
# Author: Marc Durepos (Contact : marc@bemade.org)
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
# It is forbidden to publish, distribute, sublicense, or sell copies of the Software
# or modified copies of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
{
'name': 'Carrier SO to Picking',
'version': '15.0.1.0.0',
'summary': 'Causes carrier to be transferred to picking on order confirmation.',
'category': 'Delivery',
'author': 'Bemade Inc.',
'website': 'https://www.bemade.org',
'license': 'OPL-1',
'depends': ['delivery'],
'data': [''],
'demo': [''],
'installable': True,
'auto_install': False,
}

View file

@ -0,0 +1 @@
from . import stock_picking

View file

@ -0,0 +1,24 @@
from odoo import fields, models, api, _, Command
class StockPicking(models.Model):
_inherit = 'stock.picking'
carrier_id = fields.Many2one("delivery.carrier",
string="Carrier",
check_company=True,
compute='_compute_carrier_id',
inverse='_inverse_carrier_id',
store=True)
# carrier_set_manually = fields.Boolean(default=False)
@api.depends('sale_id')
def _compute_carrier_id(self):
for rec in self:
# rec.carrier_id = rec.carrier_set_manually and rec.carrier_id \
# or rec.sale_id and rec.sale_id.carrier_id
rec.carrier_id = rec.sale_id and rec.sale_id.carrier_id
def _inverse_carrier_id(self):
# self.carrier_set_manually = True
pass