[MIG] purchase_stock_usability_akretion to v18

incoterm_id is a field of purchase module, not purchase_stock ; so move
the inherit of this field from purchase_stock_usability_akretion to
purchase_usability_akretion
This commit is contained in:
Alexis de Lattre
2024-12-30 12:47:30 +01:00
parent b9d313fa8c
commit 8e5d3b8a74
9 changed files with 30 additions and 29 deletions

View File

@@ -1,10 +1,10 @@
# Copyright 2014-2022 Akretion (http://www.akretion.com) # Copyright 2014-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Purchase Stock Usability', 'name': 'Purchase Stock Usability',
'version': '16.0.1.0.0', 'version': '18.0.1.0.0',
'category': 'Purchases', 'category': 'Purchases',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Usability improvements on purchase_stock module', 'summary': 'Usability improvements on purchase_stock module',
@@ -17,10 +17,10 @@ Several usability improvements on the official purchase_stock module:
This module has been written by Alexis de Lattre from Akretion France. This module has been written by Alexis de Lattre from Akretion France.
""", """,
'author': 'Akretion', 'author': 'Akretion',
'website': 'http://www.akretion.com', 'website': 'https://github.com/akretion/odoo-usability',
'depends': [ 'depends': [
'purchase_stock', 'purchase_stock',
'purchase_usability', 'purchase_usability_akretion',
], ],
'data': [ 'data': [
'views/stock_picking.xml', 'views/stock_picking.xml',
@@ -28,5 +28,5 @@ This module has been written by Alexis de Lattre from Akretion France.
'views/stock_move.xml', 'views/stock_move.xml',
'views/stock_move_line.xml', 'views/stock_move_line.xml',
], ],
'installable': False, 'installable': True,
} }

View File

@@ -1,4 +1,4 @@
# Copyright 2015-2022 Akretion France (http://www.akretion.com) # Copyright 2015-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -9,18 +9,18 @@ class PurchaseOrder(models.Model):
_inherit = 'purchase.order' _inherit = 'purchase.order'
picking_type_id = fields.Many2one(tracking=True) picking_type_id = fields.Many2one(tracking=True)
incoterm_id = fields.Many2one(tracking=True) incoterm_location = fields.Char(tracking=True)
# inherit compute method of the field delivery_partner_id # inherit compute method of the field delivery_partner_id
# defined in purchase_usability # defined in purchase_usability_akretion
@api.depends('dest_address_id', 'picking_type_id') @api.depends('dest_address_id', 'picking_type_id')
def _compute_delivery_partner_id(self): def _compute_delivery_partner_id(self):
for o in self: for rec in self:
delivery_partner_id = False delivery_partner_id = False
if o.dest_address_id: if rec.dest_address_id:
delivery_partner_id = o.dest_address_id delivery_partner_id = rec.dest_address_id
elif ( elif (
o.picking_type_id.warehouse_id and rec.picking_type_id.warehouse_id and
o.picking_type_id.warehouse_id.partner_id): rec.picking_type_id.warehouse_id.partner_id):
delivery_partner_id = o.picking_type_id.warehouse_id.partner_id delivery_partner_id = rec.picking_type_id.warehouse_id.partner_id
o.delivery_partner_id = delivery_partner_id rec.delivery_partner_id = delivery_partner_id

View File

@@ -1,4 +1,4 @@
# Copyright 2023 Akretion France (http://www.akretion.com) # Copyright 2023-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -8,7 +8,7 @@ from odoo import fields, models
class StockMove(models.Model): class StockMove(models.Model):
_inherit = 'stock.move' _inherit = 'stock.move'
# for optional display in tree view # for optional display in list view
product_supplier_code = fields.Char( product_supplier_code = fields.Char(
compute='_compute_product_supplier_code', string="Vendor Product Code") compute='_compute_product_supplier_code', string="Vendor Product Code")

View File

@@ -1,4 +1,4 @@
# Copyright 2023 Akretion France (http://www.akretion.com) # Copyright 2023-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -8,7 +8,7 @@ from odoo import fields, models
class StockMoveLine(models.Model): class StockMoveLine(models.Model):
_inherit = 'stock.move.line' _inherit = 'stock.move.line'
# for optional display in tree view # for optional display in list view
product_supplier_code = fields.Char( product_supplier_code = fields.Char(
compute='_compute_product_supplier_code', string="Vendor Product Code") compute='_compute_product_supplier_code', string="Vendor Product Code")

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2023 Akretion (http://www.akretion.com/) Copyright 2023-2024 Akretion (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2023 Akretion France (http://www.akretion.com/) Copyright 2023-2024 Akretion France (https://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -13,7 +13,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<!-- picking.purchase_id is a native field ; it is added to the picking form view in this module --> <!-- picking.purchase_id is a native field ; it is added to the picking form view in this module -->
<field name="product_id" position="after"> <field name="product_id" position="after">
<field name="product_supplier_code" optional="hide" attrs="{'column_invisible': [('parent.purchase_id', '=', False)]}"/> <field name="product_supplier_code" optional="hide" column_invisible="not parent.purchase_id"/>
</field> </field>
</field> </field>
</record> </record>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2023 Akretion France (http://www.akretion.com/) Copyright 2023-2024 Akretion France (https://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -23,7 +23,7 @@
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" /> <field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="product_id" position="after"> <field name="product_id" position="after">
<field name="product_supplier_code" optional="hide" attrs="{'column_invisible': [('parent.purchase_id', '=', False)]}"/> <field name="product_supplier_code" optional="hide" column_invisible="not parent.purchase_id"/>
</field> </field>
</field> </field>
</record> </record>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2017-2022 Akretion (http://www.akretion.com/) Copyright 2017-2024 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -14,10 +14,10 @@
<field name="inherit_id" ref="stock.view_picking_form"/> <field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="origin" position="after"> <field name="origin" position="after">
<field name="purchase_id" attrs="{'invisible': [('purchase_id', '=', False)]}"/> <field name="purchase_id" invisible="not purchase_id"/>
</field> </field>
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after"> <xpath expr="//field[@name='move_ids_without_package']/list/field[@name='product_id']" position="after">
<field name="product_supplier_code" optional="hide" attrs="{'column_invisible': [('parent.purchase_id', '=', False)]}"/> <field name="product_supplier_code" optional="hide" column_invisible="not parent.purchase_id"/>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -13,6 +13,7 @@ class PurchaseOrder(models.Model):
currency_id = fields.Many2one(tracking=True) currency_id = fields.Many2one(tracking=True)
payment_term_id = fields.Many2one(tracking=True) payment_term_id = fields.Many2one(tracking=True)
fiscal_position_id = fields.Many2one(tracking=True) fiscal_position_id = fields.Many2one(tracking=True)
incoterm_id = fields.Many2one(tracking=True)
partner_ref = fields.Char(tracking=True) partner_ref = fields.Char(tracking=True)
# the field 'delivery_partner_id' is used in report # the field 'delivery_partner_id' is used in report
# the compute method of that field is inherited in purchase_stock_usability # the compute method of that field is inherited in purchase_stock_usability
@@ -69,7 +70,7 @@ class PurchaseOrder(models.Model):
class PurchaseOrderLine(models.Model): class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line' _inherit = 'purchase.order.line'
# for optional display in tree view # for optional display in list view
product_barcode = fields.Char( product_barcode = fields.Char(
related='product_id.barcode', string="Product Barcode") related='product_id.barcode', string="Product Barcode")
product_supplier_code = fields.Char( product_supplier_code = fields.Char(