Initialize v18 branch
Rename *_usability modules to *_usability_akretion
This commit is contained in:
1
purchase_stock_usability_akretion/__init__.py
Normal file
1
purchase_stock_usability_akretion/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
32
purchase_stock_usability_akretion/__manifest__.py
Normal file
32
purchase_stock_usability_akretion/__manifest__.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2014-2022 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': '16.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:
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion France.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': [
|
||||
'purchase_stock',
|
||||
'purchase_usability',
|
||||
],
|
||||
'data': [
|
||||
'views/stock_picking.xml',
|
||||
'views/purchase_order.xml',
|
||||
'views/stock_move.xml',
|
||||
'views/stock_move_line.xml',
|
||||
],
|
||||
'installable': False,
|
||||
}
|
||||
62
purchase_stock_usability_akretion/i18n/fr.po
Normal file
62
purchase_stock_usability_akretion/i18n/fr.po
Normal file
@@ -0,0 +1,62 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * purchase_stock_usability
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-07-04 15:26+0000\n"
|
||||
"PO-Revision-Date: 2024-07-04 15:26+0000\n"
|
||||
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model.fields,field_description:purchase_stock_usability.field_purchase_order__picking_type_id
|
||||
msgid "Deliver To"
|
||||
msgstr "Livrer à"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model.fields,field_description:purchase_stock_usability.field_purchase_order__incoterm_id
|
||||
msgid "Incoterm"
|
||||
msgstr "Incoterm"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model.fields,help:purchase_stock_usability.field_purchase_order__incoterm_id
|
||||
msgid ""
|
||||
"International Commercial Terms are a series of predefined commercial terms "
|
||||
"used in international transactions."
|
||||
msgstr ""
|
||||
"Les incoterms sont une série de termes commerciaux "
|
||||
"prédéfinis utilisés dans les transactions internationales."
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model,name:purchase_stock_usability.model_stock_move_line
|
||||
msgid "Product Moves (Stock Move Line)"
|
||||
msgstr "Mouvements de produit (Ligne de mouvement de stock)"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model,name:purchase_stock_usability.model_purchase_order
|
||||
msgid "Purchase Order"
|
||||
msgstr "Bon de commande"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model,name:purchase_stock_usability.model_stock_move
|
||||
msgid "Stock Move"
|
||||
msgstr "Mouvement de stock"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model.fields,help:purchase_stock_usability.field_purchase_order__picking_type_id
|
||||
msgid "This will determine operation type of incoming shipment"
|
||||
msgstr "Cela déterminera le type d'opération de la réception de marchandises"
|
||||
|
||||
#. module: purchase_stock_usability
|
||||
#: model:ir.model.fields,field_description:purchase_stock_usability.field_stock_move__product_supplier_code
|
||||
#: model:ir.model.fields,field_description:purchase_stock_usability.field_stock_move_line__product_supplier_code
|
||||
msgid "Vendor Product Code"
|
||||
msgstr "Code produit du fournisseur"
|
||||
3
purchase_stock_usability_akretion/models/__init__.py
Normal file
3
purchase_stock_usability_akretion/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from . import purchase
|
||||
from . import stock_move
|
||||
from . import stock_move_line
|
||||
26
purchase_stock_usability_akretion/models/purchase.py
Normal file
26
purchase_stock_usability_akretion/models/purchase.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# Copyright 2015-2022 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 api, fields, models
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
picking_type_id = fields.Many2one(tracking=True)
|
||||
incoterm_id = fields.Many2one(tracking=True)
|
||||
|
||||
# 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
|
||||
33
purchase_stock_usability_akretion/models/stock_move.py
Normal file
33
purchase_stock_usability_akretion/models/stock_move.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# Copyright 2023 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 fields, models
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
# for optional display in tree view
|
||||
product_supplier_code = fields.Char(
|
||||
compute='_compute_product_supplier_code', string="Vendor Product Code")
|
||||
|
||||
def _compute_product_supplier_code(self):
|
||||
pso = self.env['product.supplierinfo']
|
||||
for move in self:
|
||||
code = False
|
||||
if move.purchase_line_id and move.purchase_line_id.order_id:
|
||||
po = move.purchase_line_id.order_id
|
||||
partner_id = po.partner_id.commercial_partner_id.id
|
||||
if partner_id:
|
||||
sinfo = pso.search_read([
|
||||
('product_tmpl_id', '=', move.product_id.product_tmpl_id.id),
|
||||
('product_id', 'in', (False, move.product_id.id)),
|
||||
('partner_id', '=', partner_id),
|
||||
('product_code', '!=', False),
|
||||
('company_id', 'in', (False, move.company_id.id)),
|
||||
], ['product_code'], limit=1, order='product_id')
|
||||
# if I order by product_id, I get the null values at the end
|
||||
if sinfo:
|
||||
code = sinfo[0]['product_code']
|
||||
move.product_supplier_code = code
|
||||
34
purchase_stock_usability_akretion/models/stock_move_line.py
Normal file
34
purchase_stock_usability_akretion/models/stock_move_line.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright 2023 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 fields, models
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
# for optional display in tree view
|
||||
product_supplier_code = fields.Char(
|
||||
compute='_compute_product_supplier_code', string="Vendor Product Code")
|
||||
|
||||
def _compute_product_supplier_code(self):
|
||||
pso = self.env['product.supplierinfo']
|
||||
for mline in self:
|
||||
code = False
|
||||
move = mline.move_id
|
||||
if move and move.purchase_line_id and move.purchase_line_id.order_id:
|
||||
po = move.purchase_line_id.order_id
|
||||
partner_id = po.partner_id.commercial_partner_id.id
|
||||
if partner_id:
|
||||
sinfo = pso.search_read([
|
||||
('product_tmpl_id', '=', mline.product_id.product_tmpl_id.id),
|
||||
('product_id', 'in', (False, mline.product_id.id)),
|
||||
('partner_id', '=', partner_id),
|
||||
('product_code', '!=', False),
|
||||
('company_id', 'in', (False, mline.company_id.id)),
|
||||
], ['product_code'], limit=1, order='product_id')
|
||||
# if I order by product_id, I get the null values at the end
|
||||
if sinfo:
|
||||
code = sinfo[0]['product_code']
|
||||
mline.product_supplier_code = code
|
||||
43
purchase_stock_usability_akretion/views/purchase_order.xml
Normal file
43
purchase_stock_usability_akretion/views/purchase_order.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2023 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="purchase_order_tree" model="ir.ui.view">
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="picking_type_id" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_order_view_tree" model="ir.ui.view">
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase_stock.purchase_order_view_tree_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="picking_type_id" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_order_kpis_tree" model="ir.ui.view">
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_kpis_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="picking_type_id" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
</odoo>
|
||||
21
purchase_stock_usability_akretion/views/stock_move.xml
Normal file
21
purchase_stock_usability_akretion/views/stock_move.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2023 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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_move_tree" model="ir.ui.view">
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<!-- 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_supplier_code" optional="hide" attrs="{'column_invisible': [('parent.purchase_id', '=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
31
purchase_stock_usability_akretion/views/stock_move_line.xml
Normal file
31
purchase_stock_usability_akretion/views/stock_move_line.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2023 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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_move_line_tree" model="ir.ui.view">
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_move_line_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_supplier_code" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- View embedded in picking -->
|
||||
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_supplier_code" optional="hide" attrs="{'column_invisible': [('parent.purchase_id', '=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
26
purchase_stock_usability_akretion/views/stock_picking.xml
Normal file
26
purchase_stock_usability_akretion/views/stock_picking.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017-2022 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_stock_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': [('purchase_id', '=', False)]}"/>
|
||||
</field>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
|
||||
<field name="product_supplier_code" optional="hide" attrs="{'column_invisible': [('parent.purchase_id', '=', False)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user