Initialize v18 branch
Rename *_usability modules to *_usability_akretion
This commit is contained in:
1
stock_account_usability_akretion/__init__.py
Normal file
1
stock_account_usability_akretion/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
30
stock_account_usability_akretion/__manifest__.py
Normal file
30
stock_account_usability_akretion/__manifest__.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2019-2021 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).
|
||||
|
||||
|
||||
{
|
||||
'name': 'Stock Account Usability',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Hidden',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Several usability enhancements on stock_account',
|
||||
'description': """
|
||||
Stock Account Usability
|
||||
=======================
|
||||
|
||||
The usability enhancements include:
|
||||
|
||||
- show to_refund on stock.move form view
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock_account', 'stock_usability'],
|
||||
'data': [
|
||||
'views/stock_move.xml',
|
||||
'views/product.xml',
|
||||
],
|
||||
'installable': False,
|
||||
}
|
||||
1
stock_account_usability_akretion/models/__init__.py
Normal file
1
stock_account_usability_akretion/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import product
|
||||
38
stock_account_usability_akretion/models/product.py
Normal file
38
stock_account_usability_akretion/models/product.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright 2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
def action_open_stock_valuation_layer(self):
|
||||
self.ensure_one()
|
||||
ppo = self.env['product.product']
|
||||
if len(self.product_variant_ids) == 1:
|
||||
action = ppo._get_stock_valuation_layer_action(self.product_variant_ids.id)
|
||||
else:
|
||||
action = ppo._get_stock_valuation_layer_action()
|
||||
action["domain"] = [('product_id', 'in', self.product_variant_ids.ids)]
|
||||
return action
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def action_open_stock_valuation_layer(self):
|
||||
self.ensure_one()
|
||||
return self._get_stock_valuation_layer_action(self.id)
|
||||
|
||||
@api.model
|
||||
def _get_stock_valuation_layer_action(self, product_id=None):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
"stock_account.stock_valuation_layer_action")
|
||||
if product_id:
|
||||
action["context"] = {
|
||||
'search_default_product_id': product_id,
|
||||
'search_default_group_by_product_id': 1,
|
||||
}
|
||||
return action
|
||||
54
stock_account_usability_akretion/views/product.xml
Normal file
54
stock_account_usability_akretion/views/product.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!--
|
||||
<record id="product_product_to_inventory_valuation" model="ir.actions.act_window">
|
||||
<field name="name">Inventory Valuation</field>
|
||||
<field name="res_model">stock.valuation.layer</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="groups_id" eval="[(4, ref('stock.group_stock_manager'))]"/>
|
||||
<field name="context">{'search_default_group_by_product_id': 1, 'search_default_product_id': active_id}</field>
|
||||
<field name="binding_model_id" ref="product.model_product_product" />
|
||||
<field name="binding_view_types">form</field>
|
||||
</record>
|
||||
|
||||
-->
|
||||
<!-- product template only form view -->
|
||||
<record id="product_template_form_view_procurement_button" model="ir.ui.view">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button"
|
||||
name="action_open_stock_valuation_layer"
|
||||
string="Inventory Valuation"
|
||||
icon="fa-usd"
|
||||
type="object" attrs="{'invisible': [('type', '!=', 'product')]}">
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- product.product only form view -->
|
||||
<record id="product_form_view_procurement_button" model="ir.ui.view">
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button"
|
||||
name="action_open_stock_valuation_layer"
|
||||
string="Inventory Valuation"
|
||||
icon="fa-usd"
|
||||
type="object" attrs="{'invisible': [('type', '!=', 'product')]}">
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
23
stock_account_usability_akretion/views/stock_move.xml
Normal file
23
stock_account_usability_akretion/views/stock_move.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 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_form" model="ir.ui.view">
|
||||
<field name="name">stock_account_usability.stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock_usability.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="price_unit" position="after">
|
||||
<field name="to_refund" readonly="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user