-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[IMP] 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
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models | ||
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', | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_template |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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: | ||
user = self.env.user | ||
record.is_multicompany = len(user.company_ids) > 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can use |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,76 @@ | ||||||||
<?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"> | ||||||||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
<attribute name="invisible">1</attribute> | ||||||||
</xpath> | ||||||||
|
||||||||
<xpath expr="//field[@name='virtual_available']" | ||||||||
position='attributes'> | ||||||||
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Applies throughout the diff |
||||||||
<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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing copyright statement
(throughout the whole diff)