Skip to content
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

[9.0][WIP] Migrated product multi image #161

Closed
wants to merge 12 commits into from

Conversation

SodexisTeam
Copy link
Member

No description provided.

@SodexisTeam SodexisTeam changed the title [9.0][MIG] Migrated product multi image to 9.0 [9.0][MIG] Migrated product multi image Jun 14, 2016
@pedrobaeza pedrobaeza mentioned this pull request Jun 14, 2016
37 tasks
Known issues / Roadmap
======================

* Provide proper migration scripts from module product_images from 7.0.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from 8.0?

@elicoidal
Copy link

Can you check travis?

@atchuthan
Copy link
Member

atchuthan commented Jun 23, 2016

@yajo: I would like your help on the hook i.e. pre_init_hook(https://github.com/OCA/server-tools/blob/9.0/base_multi_image/hooks.py).

For version 9.0, it seems the attachment=True parameter for fields.Binary() makes the field unavailable in the current table and is stored in ir_attachments as a new record.

@pedrobaeza
Copy link
Member

And what is the question or the problem?

@SodexisTeam SodexisTeam changed the title [9.0][MIG] Migrated product multi image [9.0][WIP] Migrated product multi image Jun 23, 2016
@atchuthan
Copy link
Member

When we try to call the hook available in base_multi_image with pre_init_hook_for_submodules(cr, "product.template", "image"), it results in ProgrammingError: column "image" does not exist.

So, I would like some suggestions on how this scenario could be handled.

cc: @yajo

@yajo
Copy link
Member

yajo commented Jun 23, 2016

Interesting, I did not notice the new attachment feature. It's possible that now base module needs some refactoring to use that storage by default too.

@pedrobaeza
Copy link
Member

Yeah, I also think that one is something to be taken into account in base_multi_image, not here.

@atchuthan
Copy link
Member

@dreispt Why close this PR? This PR uses the fix available in OCA/server-tools#468.

Also, you might have confused this module(OCA/product-attribute/product_multi_image) with OCA/server-tools/base_multi_image.

@dreispt dreispt reopened this Jul 4, 2016
@dreispt
Copy link
Sponsor Member

dreispt commented Jul 4, 2016

@atchuthan It was accidental, I don't what happened. Sorry! Reopened.

@atchuthan
Copy link
Member

okay @dreispt

@yajo
Copy link
Member

yajo commented Jul 5, 2016

This module received a major update in v8 in #151, could you merge with your migration to get that please?

@yajo
Copy link
Member

yajo commented Jul 5, 2016

Functional test in runbot fails:

  1. Create a product.
  2. Set an image from the thumbnail.
Odoo Server Error

Traceback (most recent call last):
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/http.py", line 646, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/http.py", line 683, in dispatch
    result = self._call_function(**self.params)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/http.py", line 319, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/http.py", line 312, in checked_call
    result = self.endpoint(*a, **kw)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/http.py", line 962, in __call__
    return self.method(*args, **kw)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/http.py", line 512, in response_wrap
    response = f(*args, **kw)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/web/controllers/main.py", line 898, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/web/controllers/main.py", line 890, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/product/product.py", line 675, in create
    product_template_id = super(product_template, self).create(cr, uid, vals, context=context)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 354, in old_api
    result = method(recs, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/mail/models/mail_thread.py", line 233, in create
    thread = super(MailThread, self).create(values)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/models.py", line 4166, in create
    self._fields[key].determine_inverse(record)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/fields.py", line 954, in determine_inverse
    self.inverse(records)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/fields.py", line 595, in _inverse_related
    other[field.name] = record_value[record]
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/models.py", line 5761, in __setitem__
    return self._fields[key].__set__(self, value)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/fields.py", line 865, in __set__
    record.write({self.name: self.convert_to_write(value)})
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 574, in new_api
    result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/product/product.py", line 699, in write
    res = super(product_template, self).write(cr, uid, ids, vals, context=context)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 381, in old_api
    result = method(recs, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/mail/models/mail_thread.py", line 279, in write
    result = super(MailThread, self).write(values)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/models.py", line 3848, in write
    self._fields[key].determine_inverse(self)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/fields.py", line 952, in determine_inverse
    getattr(records, self.inverse)()
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/base_multi_image/models/owner.py", line 81, in _set_multi_image_main
    self._set_multi_image(self.image_main)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/base_multi_image/models/owner.py", line 74, in _set_multi_image
    s.image_ids = [(0, 0, values)]
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/fields.py", line 865, in __set__
    record.write({self.name: self.convert_to_write(value)})
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 574, in new_api
    result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/product/product.py", line 699, in write
    res = super(product_template, self).write(cr, uid, ids, vals, context=context)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 381, in old_api
    result = method(recs, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/addons/mail/models/mail_thread.py", line 279, in write
    result = super(MailThread, self).write(values)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/models.py", line 3837, in write
    self._write(old_vals)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/api.py", line 574, in new_api
    result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/models.py", line 3995, in _write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/osv/fields.py", line 854, in set
    if inverse_field.ondelete == "cascade":
  File "/srv/openerp/instances/openerp-oca-runbot/parts/odoo-extra/runbot/static/build/3150039-161-870617/openerp/fields.py", line 360, in __getattr__
    raise AttributeError(name)
AttributeError: ondelete

If I attach the image from the images tab, then no exception occurs, but no image is attached neither.

@atchuthan
Copy link
Member

@yajo: already rebased commits from PR#151 to this PR

On Tuesday 05 July 2016 08:18 PM, Yajo wrote:

This module received a major update in v8 in #151
#151, could you merge
with your migration to get that please?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#161 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AEc3vnjqV1PVufmfVX_i7ruq4EWcRj8Uks5qSm65gaJpZM4I1CiG.

Thanks & Regards,
Atchuthan

"name": "Multiple Images in Products",
"version": "9.0.1.0.0",
"author": "Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Antiun Ingeniería, Tecnativa, Sodexis, "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yajo may I know who I missed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah forget it, I saw 1 per line in v8 and did not realize you mixed some in the same line. My fault.

@yajo
Copy link
Member

yajo commented Jul 18, 2016

I cannot install the sale module after product_multi_image was installed.

@yajo
Copy link
Member

yajo commented Jul 20, 2016

Please bear in mind that you probably have a bug that lets dangling images in the table when you uninstall this module. Please refer to https://github.com/OCA/server-tools/pull/485/files#diff-9ebf6925e40a87a77d2472a9134d8a2aR62 and implement that uninstall hook.

I know, that's still in PR, but I'd appreciate help to get it fixed ASAP. Thanks.

@lasley
Copy link

lasley commented Aug 9, 2016

Hi @SodexisTeam - Are you going to continue with this PR?

@atchuthan
Copy link
Member

@lasley we were busy with some customer task, so I was unable to work on this.

It seems @yajo raised an issue on odoo/odoo#13076 and it relates to the issue we are facing now.

and we have to add the uninstall hook as suggested by @yajo.

We would appreciate if you could submit your changes as PR to this branch.

@pedrobaeza
Copy link
Member

We are making it, so please wait for our PR. @yajo, @carlosdauden is the migration already available?

@yajo
Copy link
Member

yajo commented Aug 10, 2016

Nothing yet AFAIK

@lasley
Copy link

lasley commented Aug 10, 2016

Thanks for the update guys. This just came up on some of our project scope, so I have some time that can be pushed this way. Sounds like we're on the right track, but let me know if my team can assist in anything. I'll go back to lurker status now 😉

@pedrobaeza
Copy link
Member

pedrobaeza commented Aug 19, 2016

@SodexisTeam, the problems you mentioned were in base_multi_image, so basically this module should work right now. Please check.

image_small = fields.Binary(
related='image_main_small',
store=False,
multi=False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid these multi probably don't have the desired effect.
Can you confirm please? Review odoo/odoo#10799 (comment)

@yajo
Copy link
Member

yajo commented Sep 6, 2016

Please check Travis.

@pedrobaeza
Copy link
Member

Hi, @SodexisTeam / @atchuthan, any news regarding this PR?

@lasley lasley mentioned this pull request Nov 4, 2016
1 task
@lasley
Copy link

lasley commented Nov 4, 2016

I am superseding with #199, please close

@pedrobaeza pedrobaeza closed this Nov 4, 2016
@atchuthan atchuthan deleted the 9.0-product_multi_image branch November 7, 2016 06:06
DavidJForgeFlow pushed a commit to ForgeFlow/product-attribute that referenced this pull request Jul 26, 2022
[MIG] account_invoice_supplier_ref_unique: Migration to 9.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants