-
Notifications
You must be signed in to change notification settings - Fork 247
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
[FIX] product_variants_no_automatic_creation: Updated for Odoo 9.0 #1098
Open
aduijs
wants to merge
1
commit into
odoomrp:9.0
Choose a base branch
from
aduijs:9.0
base: 9.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.
Open
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 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 |
---|---|---|
|
@@ -17,18 +17,54 @@ | |
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_only_form_view" /> | ||
<field name="arch" type="xml"> | ||
<button string="Variant Prices" position="attributes"> | ||
<xpath expr="//button[@name='103']" position="attributes"> | ||
|
||
<attribute name="invisible">1</attribute> | ||
</button> | ||
<button string="Variant Prices" position="after"> | ||
</xpath> | ||
<xpath expr="//button[@name='103']" position="after"> | ||
|
||
<button class="oe_inline oe_stat_button" name="action_open_attribute_prices" | ||
icon="fa-strikethrough" type="object" string="Variant Prices"> | ||
</button> | ||
</button> | ||
<field name="attribute_line_ids" position="before"> | ||
</xpath> | ||
<xpath expr="//field[@name='attribute_line_ids']" position="before"> | ||
|
||
<group> | ||
<field name="no_create_variants" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.ui.view" id="product_variants_view"> | ||
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. This is copied-pasted from 8.0, but you have to update all the changes introduce in 8.0. See https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-9.0 |
||
<field name="name">product.product.variants.form</field> | ||
<field name="model">product.product</field> | ||
<field name="inherit_id" ref="product.product_normal_form_view"/> | ||
<field name="arch" type="xml"> | ||
<field name="name" position="attributes"> | ||
<attribute name="attrs">{'invisible':['|',('id','!=',False),('product_tmpl_id','!=',False)],'readonly':[('product_tmpl_id','!=',False)]}</attribute> | ||
</field> | ||
<field name="product_tmpl_id" position="attributes"> | ||
<attribute name="readonly" /> | ||
<attribute name="attrs">{'readonly':[('id','!=',False)],'required':[('id','!=',False)]}</attribute> | ||
</field> | ||
<xpath expr="//field[@name='product_tmpl_id']/.." position="after"> | ||
<p class="oe_grey" attrs="{'invisible':[('id','!=',False)]}"> | ||
Select a template for a variant. Keep empty for a new full product. | ||
</p> | ||
</xpath> | ||
<field name="attribute_value_ids" position="after"> | ||
<label for="product_attributes" | ||
attrs="{'invisible':['|',('id','!=',False),'|',('product_tmpl_id','=',False),('product_attributes','=',[])]}" /> | ||
<field name="product_attributes" | ||
attrs="{'invisible':['|',('id','!=',False),'|',('product_tmpl_id','=',False),('product_attributes','=',[])]}" | ||
options="{'no_create': True, 'no_delete': True}"> | ||
<tree create="0" delete="0" editable="1"> | ||
<field name="attribute" /> | ||
<field name="possible_values" invisible="1" /> | ||
<field name="value" context="{'show_attribute': False}" /> | ||
</tree> | ||
</field> | ||
</field> | ||
</field> | ||
</record> | ||
|
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.
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.
This number won't work in other database. You have to use the same expression as in original.
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.
Its not a number, its a string.. and the name of the button.
According the view (product.template.common.form) 103 is its name
So instead of looking up the text string "Variant Prices" its looking for
the name of the button
[image: Inline afbeelding 1]
and works just fine.
Its hiding the original variant prices button and adds the new one
[image: Inline afbeelding 2]
2015-12-12 7:36 GMT-05:00 Pedro M. Baeza notifications@github.com:
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.
But this is because it's replaced in execution time by its current XML-ID. Here you can see the correct expression: https://github.com/odoo/odoo/blob/9.0/addons/product/product_view.xml#L77
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.
Ok so if i understand right, these IDs are generated upon installation and
can vary per install.
so the 103 name is the name from my current install and therefore working
as intended.
And for that it was looking for the text string
2015-12-14 12:51 GMT-05:00 Pedro M. Baeza notifications@github.com:
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.
That's it