-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[ADD] inventory: Improve stock info and UI in product form #887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
arkp-odoo
wants to merge
1
commit into
odoo:18.0
Choose a base branch
from
odoo-dev:18.0-quantity-on-hand-arkp
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+94
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
from . import models | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
'name': 'Quantity on hand', | ||
'version': '1.0', | ||
'depends': ['stock'], | ||
'installable': True, | ||
'data': [ | ||
'views/product_template_views.xml', | ||
], | ||
'license': 'LGPL-3', | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
from . import product_template |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = 'product.template' | ||
|
||
is_multicompany = fields.Boolean(compute="_compute_is_multicompany") | ||
|
||
@api.depends('company_id') | ||
def _compute_is_multicompany(self): | ||
for record in self: | ||
record.is_multicompany = len(self.env.user.company_ids) > 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
<record id="view_product_template_form_inherited" model="ir.ui.view"> | ||
<field name="name">product.template.form.custom.inherit</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_only_form_view" /> | ||
<field name="arch" type="xml"> | ||
|
||
<xpath expr="//button[@name='action_update_quantity_on_hand']" position="attributes"> | ||
<attribute name="invisible">1</attribute> | ||
</xpath> | ||
|
||
<xpath expr="//button[@invisible='not show_on_hand_qty_status_button']" position="attributes"> | ||
<attribute name="invisible">1</attribute> | ||
</xpath> | ||
|
||
<xpath expr="//field[@name='virtual_available']" position='attributes'> | ||
<attribute name='decoration-danger'>virtual_available < 0</attribute> | ||
<attribute name='decoration-primary'>virtual_available == 0</attribute> | ||
</xpath> | ||
|
||
<xpath expr="//button[@name='action_product_tmpl_forecast_report']/div/span[hasclass('o_stat_value', 'd-flex', 'gap-1')]/field[@name='uom_name']" position='replace'> | ||
<span>Forecasted</span> | ||
</xpath> | ||
|
||
<xpath expr="//button[@name='action_product_tmpl_forecast_report']/div/span[hasclass('o_stat_value', 'd-flex', 'gap-1')]" position='before'> | ||
<span class="o_stat_value d-flex gap-1"> | ||
<field name="qty_available" nolabel="1" class="oe_inline" /> | ||
<field name="uom_name" class="oe_inline" /> | ||
</span> | ||
</xpath> | ||
|
||
<xpath expr="//button[@name='action_product_tmpl_forecast_report']/div/span[hasclass('o_stat_text')]" position='attributes'> | ||
<attribute name='invisible'>1</attribute> | ||
</xpath> | ||
|
||
</field> | ||
</record> | ||
|
||
<record id="product_template_form_view_inherit" model="ir.ui.view"> | ||
<field name="name">product.template.common.form.inherit</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_form_view" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='product_tooltip']" position='attributes'> | ||
<attribute name='invisible'>type == 'consu'</attribute> | ||
</xpath> | ||
|
||
<xpath expr="//field[@name='product_tooltip']" position="after"> | ||
<label for="qty_available" invisible='not is_storable'>Quantity On Hand</label> | ||
<span class="d-flex gap-3"> | ||
<field name="qty_available" | ||
readonly="is_multicompany" | ||
class="oe_inline" | ||
invisible='not is_storable' | ||
/> | ||
<field name="uom_name" class="oe_inline" invisible='not is_storable' /> | ||
<button type="action" | ||
name="%(stock.action_product_stock_view)d" | ||
class="oe_stat_button oe_inline opacity-0 opacity-100-hover" | ||
invisible='not is_storable'> | ||
Update | ||
</button> | ||
</span> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.