-
Notifications
You must be signed in to change notification settings - Fork 3
[IMP] added hooks to migrate form olf product_image modules and minor… #2
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: 8.0-product_images
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 |
|---|---|---|
|
|
@@ -37,6 +37,11 @@ | |
| readonly="True" | ||
| nolabel="1" /> | ||
| </group> | ||
| <group string="Products"> | ||
|
Owner
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. Esto se debería hacer sobre la propia variante en su pestaña correspondiente, pero creando código para la función inverse en product.product que sólo modifique para el producto en concreto.
Author
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. Esto no lo tengo muy claro. El campo images tienen un many2one a template, pero al añadir la imagen en una variante esta se copiaba a todos las variantes. El campo no se "copia" en product.product. Por esto me decidí a hacerlo de esta manera
Owner
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. Pero lo dicho, eso lo debes hacer en el inverse de la función tanto para product.template como para product.product. Si se hace en el template, escribir a cada variante el mismo. Si se hace en el product, sólo para el producto en concreto. Odoo hace algo parecido con el campo imagen normal. Echa un vistazo a su código. |
||
| <field name="product_id" invisible="1"/> | ||
| <field name="products" nolabel="1" widget="many2many_tags" | ||
| domain='[("product_tmpl_id","=",product_id)]'/> | ||
| </group> | ||
| </group> | ||
| </page> | ||
| <page string="Comments" name="page_comments"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,17 @@ | |
| </xpath> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="view_product_product_form_img_inh" model="ir.ui.view"> | ||
| <field name="name">product.product.images.m2m</field> | ||
| <field name="model">product.product</field> | ||
| <field name="inherit_id" ref="product.product_normal_form_view"/> | ||
| <field name="arch" type="xml"> | ||
| <field name="default_code" position="after"> | ||
| <field name="images" widget="many2many_tags" readonly="1"/> | ||
|
Owner
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. Por qué ponerlo como un many2many?
Author
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. Mi idea es que las imagenes solo se editen en el template. En la pestaña imagenes hay un campo produts donde se pueden añadir product.produt que serían las variantes a las que queremos asignar la imagen. El campo añadido en product.product es solo informativo donde podemos ver las imagenes con la que esta asociada el producto. Es verdad que he hecho todo esto teniendo en mente el conector y seguramente haya roto la idea que tenias para este modulo. Si es así dime como hacerlo y lo cambio
Owner
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. Ya, pero así se pierde la visualización cuando desde cualquier sitio del ERP se accede a la variante (pedido, factura, etc). Creo que es mejor lo otro que te digo. Prueba y me cuentas. |
||
| </field> | ||
| </field> | ||
| </record> | ||
|
|
||
| </data> | ||
| </openerp> | ||
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.
La extensión hasta donde recuerdo era un campo que quería eliminar. El nombre refleja ya la extensión.
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.
lo cambie porque en prestashop la extensión es obligatoria. Me pareció mas apropiado cambiarlo en este modulo ya que añadía información. La función se ejecuta en los inverse y el nombre esta hardcode 'Main image' no tiene extensión.
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, me parece correcto entonces. Pero la nueva dependencia a imghr habrá que declararla. ¿No existe una forma de hacerlo sin necesitar una librería nueva? Tal vez sería conveniente hacerlo por nombre de archivo simplemente, aunque eso no sea exacto.