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

[13.0] [MIG] partner_multi_relation #913

Closed
wants to merge 43 commits into from

Conversation

Rad0van
Copy link
Sponsor

@Rad0van Rad0van commented May 13, 2020

OK, this is my second attempt at porting this to 13.0 Followed the guide for porting that @pedrobaeza and @NL66278 pointed to to my best abilities.

There are few things that are not finished though:

  • colors attribute in views/res_partner_relation_all.xml: <record id="tree_res_partner_relation_all" model="ir.ui.view"> <field name="model">res.partner.relation.all</field> <field name="arch" type="xml"> <tree string="Partner Relations" colors="gray:not active; blue:date_start &gt; current_date" editable="top" > Didn't know how to find proper replacement. Help needed here.
  • with self.env.do_in_draft(): used in tests/test_partner_relation.py and tests/test_partner_relation_all.py fails tests. Also don't know hot to replace this and with what.
  • It suffers from the same bug as 12.0. - namely the one that [FIX] partner_multi_relation (Smart Button Error) #899 tries to fix.

Also ran into the same issue as #877 Solved by changing class ResPartnerRelation(models.AbstractModel) into class ResPartnerRelation(models.Model) in res_partner_relation.py Is that correct?
Any suggestions are welcome.

NL66278 and others added 30 commits May 13, 2020 16:07
* API of _auto_init
* Menu and groups
  stuff has moved from base to sales_team in odoo 10
* Fix error on search when leaf is (1, '=', 1)
* Another comparison fix with search arguments
* Update README
* Python 2to3
* Move relation menus items under contacts
* Fix date comparison
* Fix cache invalidate on relation write
* Bump module version
* Remove test_relation_type_unlink_dberror

  This test is not required because it tests a standard behavior of SQL.
  If a foreign key column is not nullable, then the foreign row can not be deleted.

* Remove utf8 encoding comment
* Add missing dependency for partner_multi_relation
* Add missing active_test in view action
* Bug Fix
* Enable additional columns on res_partner_relation_all.

  Enable to add additional columns from res_partner_relation in the sql view of res_partner_relation_all.

* Only require inverse_name when relation type is not symmetric
* Remove deprecated @api.one and replace openerp with odoo
* Add website to manifest
* Prevent disabling allow_self if reflexive relations exist
* Enable deleting/ending invalid relations after deactivating reflexivity.
* Handle case of invalid future reflexive relations
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: partner-contact-12.0/partner-contact-12.0-partner_multi_relation
Translate-URL: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_multi_relation/
Currently translated at 86.6% (84 of 97 strings)

Translation: partner-contact-12.0/partner-contact-12.0-partner_multi_relation
Translate-URL: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_multi_relation/es/
Currently translated at 46.4% (45 of 97 strings)

Translation: partner-contact-12.0/partner-contact-12.0-partner_multi_relation
Translate-URL: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_multi_relation/it/
Currently translated at 99.0% (96 of 97 strings)

Translation: partner-contact-12.0/partner-contact-12.0-partner_multi_relation
Translate-URL: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_multi_relation/it/
@Rad0van
Copy link
Sponsor Author

Rad0van commented May 14, 2020

@Rad0van also remove the comma and you should be good to go.

Thank you so much @NL66278 !!! Now it only fails on thins I knew it would fail and I need some assistance - namely do_in_draft().

@Rad0van
Copy link
Sponsor Author

Rad0van commented May 20, 2020

I'd need some help/guidelines on how to port self.env.do_in_draft() so that the tests pass. The bug with smart button is getting partially correct patch so that should be OK somewhat.

@NL66278
Copy link
Contributor

NL66278 commented May 28, 2020

Hi, do_in_draft() no longer exists. I think it will be best to remove it (and unindent the lines under it). The intention of do_in_draft according to the 12.0 documentation was to change things only in cache. It probably will not matter, as changes in test environment are rolled back anyway.

@rousseldenis
Copy link
Sponsor Contributor

Hi, do_in_draft() no longer exists. I think it will be best to remove it (and unindent the lines under it). The intention of do_in_draft according to the 12.0 documentation was to change things only in cache. It probably will not matter, as changes in test environment are rolled back anyway.

I think do_in_draft() can be replaced by protecting : https://github.com/odoo/odoo/blob/13.0/odoo/api.py#L647

@NL66278
Copy link
Contributor

NL66278 commented Jun 23, 2020

@Rad0van is the hint given by @rousseldenis enough for you to make the needed adjustments?

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 23, 2020

@Rad0van is the hint given by @rousseldenis enough for you to make the needed adjustments?

@NL66278 I don't know how to use protecting. Without it when using without do_in_draft() tests fail for me. Don't know if it's the result of using model.Model instead of model.AbstractModel

So to summarize it's probably above my current (very limited) knowledge and skills. Would love to help though.

@BT-shautz
Copy link

@Rad0van I've done my own migration PR, but since this is the one currently on development it has been closed.
Maybe some improvements you need can be found there #932 (I'm missing the do_in_draft() too though...)

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 24, 2020

@Rad0van I've done my own migration PR, but since this is the one currently on development it has been closed.
Maybe some improvements you need can be found there #932 (I'm missing the do_in_draft() too though...)

@BT-shautz if you do what rousseldenis suggested about do_in_draft() (simply use the code without it) do your tests pass? If so I'd be happy to close this one in favor of yours.

@BT-shautz
Copy link

@BT-shautz if you do what rousseldenis suggested about do_in_draft() (simply use the code without it) do your tests pass? If so I'd be happy to close this one in favor of yours.

At the moment I haven't gone so far.
But I do have the missing colors of the "tree_res_partner_relation_all" view for example.
If I do any progress I will let you know.

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 24, 2020

@BT-shautz if you do what rousseldenis suggested about do_in_draft() (simply use the code without it) do your tests pass? If so I'd be happy to close this one in favor of yours.

At the moment I haven't gone so far.
But I do have the missing colors of the "tree_res_partner_relation_all" view for example.
If I do any progress I will let you know.

@BT-shautz the colors are fine - great to know how to do that. The important thing is whether the automatic tests will pass. Without that it can be hardly expected it will be allowed to be merged. For me it didn't work so far.

@BT-shautz
Copy link

@BT-shautz the colors are fine - great to know how to do that. The important thing is whether the automatic tests will pass. Without that it can be hardly expected it will be allowed to be merged. For me it didn't work so far.

If you remove the "with self.env.do_in_draft():" and run the tests what errors do you get? Maybe I can help you there.

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 24, 2020

@BT-shautz the colors are fine - great to know how to do that. The important thing is whether the automatic tests will pass. Without that it can be hardly expected it will be allowed to be merged. For me it didn't work so far.

If you remove the "with self.env.do_in_draft():" and run the tests what errors do you get? Maybe I can help you there.

I'll let you know in more detail. But generally attributes were not containing expected values so some of the tests (esp. the one previously running in do_in_draft()) were failing.

@NL66278
Copy link
Contributor

NL66278 commented Jun 24, 2020

@Rad0van I looked into the semantics of protecting and I have to say the proper use or workings of it are completely dark to me as well. It is only used by Odoo internally in the fields.py and models.py python modules. As far as I can see its purpose there is to prevent recomputation of some field values. So I would also advise to just leave out the do_in_draft calls, and if any problem crops up, we deal with it in another way.

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 24, 2020

@Rad0van I looked into the semantics of protecting and I have to say the proper use or workings of it are completely dark to me as well. It is only used by Odoo internally in the fields.py and models.py python modules. As far as I can see its purpose there is to prevent recomputation of some field values. So I would also advise to just leave out the do_in_draft calls, and if any problem crops up, we deal with it in another way.

@NL66278 You can see now the tests fail on asserts. My guess would be this is not really due to removal of do_in_draft() but more because of changing class ResPartnerRelation(models.AbstractModel) into class ResPartnerRelation(models.Model) in res_partner_relation.py Without that change the module fails on transitive dependencies as described in #877 Maybe using TransientModel would solve this? Update: it wouldn't...

@NL66278
Copy link
Contributor

NL66278 commented Jun 25, 2020

As the original developer of this module I feel a duty to help resolving this. I have planned to do this starting next monday. Thanks for all attempts so far!

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 25, 2020

As the original developer of this module I feel a duty to help resolving this. I have planned to do this starting next monday. Thanks for all attempts so far!

@NL66278 thanx a lot. I remade this module into product_multi_relation and currently have opened PR here: OCA/product-attribute#605 However @rousseldenis asks for some substantial changes and also some questions I am not able to answer in a good way. If you'd be so kind and have a look and maybe provide some guidance. Originally I wanted to keep the source as close to the original partner_multi_relation to be able to transfer changes from there. So I am a bit hesitant to start big changes. Would you please have a look there as well?

@NL66278
Copy link
Contributor

NL66278 commented Jun 30, 2020

@Rad0van I took up your work, added the commits missing from 12.0 and then solved the remaining problems. See here: #936. It is all working, except for some complaints about decreased coverage, but tests are running fine. Do you mind if I close this PR?

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jun 30, 2020

@Rad0van I took up your work, added the commits missing from 12.0 and then solved the remaining problems. See here: #936. It is all working, except for some complaints about decreased coverage, but tests are running fine. Do you mind if I close this PR?

@NL66278 not at all. Thank you very much. If you could maybe have a look at OCA/product-attribute#605 and provide some guidance / advice. Thanx again.

@Rad0van
Copy link
Sponsor Author

Rad0van commented Jul 2, 2020

Closing as #936 done by @NL66278 is far superior to this :-)

@Rad0van Rad0van closed this Jul 2, 2020
@Rad0van Rad0van deleted the 13.0-mig-partner_multi_relation branch September 8, 2020 12:46
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.