Add module purchase_stock_usability
Port purchase_usability to v12
This commit is contained in:
1
purchase_stock_usability/__init__.py
Normal file
1
purchase_stock_usability/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import purchase
|
||||
29
purchase_stock_usability/__manifest__.py
Normal file
29
purchase_stock_usability/__manifest__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright (C) 2014-2019 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Purchase Stock Usability',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Purchases',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Usability improvements on purchase_stock module',
|
||||
'description': """
|
||||
Purchase Stock Usability
|
||||
========================
|
||||
|
||||
Several usability improvements on the official purchase_stock module:
|
||||
|
||||
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': [
|
||||
'purchase_stock',
|
||||
'purchase_usability',
|
||||
],
|
||||
'data': [
|
||||
'stock_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
27
purchase_stock_usability/purchase.py
Normal file
27
purchase_stock_usability/purchase.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015-2019 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
picking_type_id = fields.Many2one(track_visibility='onchange')
|
||||
incoterm_id = fields.Many2one(track_visibility='onchange')
|
||||
|
||||
# inherit compute method of the field delivery_partner_id
|
||||
# defined in purchase_usability
|
||||
@api.depends('dest_address_id', 'picking_type_id')
|
||||
def _compute_delivery_partner_id(self):
|
||||
for o in self:
|
||||
delivery_partner_id = False
|
||||
if o.dest_address_id:
|
||||
delivery_partner_id = o.dest_address_id
|
||||
elif (
|
||||
o.picking_type_id.warehouse_id and
|
||||
o.picking_type_id.warehouse_id.partner_id):
|
||||
delivery_partner_id = o.picking_type_id.warehouse_id.partner_id
|
||||
o.delivery_partner_id = delivery_partner_id
|
||||
22
purchase_stock_usability/stock_view.xml
Normal file
22
purchase_stock_usability/stock_view.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017-2019 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_picking_form" model="ir.ui.view">
|
||||
<field name="name">purchase_usability.stock.picking.form</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="origin" position="after">
|
||||
<field name="purchase_id" attrs="{'invisible': [('picking_type_code', '!=', 'incoming')]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user