OCA / commission

Odoo Commission Management
GNU Affero General Public License v3.0
111 stars 344 forks source link

Migration to version 15.0 #328

Closed OCA-git-bot closed 6 months ago

OCA-git-bot commented 3 years ago

Todo

https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-15.0

Modules to migrate

Missing module? Check https://github.com/OCA/maintainer-tools/wiki/%5BFAQ%5D-Missing-modules-in-migration-issue-list

pedrobaeza commented 2 years ago

My intention for this version is to split the current base module sale_commission into 3:

Then a theoretical purchase_commission can come for filling such gap.

What do you think about this?

manuelcalerosolis commented 2 years ago

@pedrobaeza, we are interested in migrating to v 15.0, we are missing it, if you think we can start by migrating sale_commission to commission, in a first stage.

pedrobaeza commented 2 years ago

Great, go ahead.

manuelcalerosolis commented 2 years ago

@pedrobaeza

Do you propose changing the name of the tables from "sale.commission" to "commission"?

Or is this change going to be very traumatic for migrations from versions prior to 15.0?

pedrobaeza commented 2 years ago

No, let's do it. Migration scripts can handle that. I will take care of it when merged.

houssine78 commented 2 years ago

Hi @manuelcalerosolis @pedrobaeza

I saw that you proposed a refactor of the sale_commission module for v15. I see that Manuel proposed this PR https://github.com/OCA/commission/pull/343 that brings the base module commission.

Then I see the following PR https://github.com/OCA/commission/pull/345 from @slominchar which seems to be a straight port of the v14 module.

Do you have any insight on the actual roadmap ? I'll be glad to make the review as soon I'm fixed of the porting roadmap.

Thanks !

pedrobaeza commented 2 years ago

Yes, you can review such PR, but formally there's a problem with git commits.

BT-aestebanez commented 2 years ago

is there any plan to merge https://github.com/OCA/commission/pull/363 ?

pedrobaeza commented 2 years ago

Not while the PR is not in good state, and the current diff is not correct. I plan to work on it on August.

BT-aestebanez commented 2 years ago

Thanks for the feedback and the estimation :) @BT-fschubert FYI

ValentinVinagre commented 2 years ago

Hi @manuelcalerosolis @pedrobaeza @yostashiro @AungKoKoLin1997 exist in this moment 2 MIG PR's for the commission module in v.15 first -> https://github.com/OCA/commission/pull/363 second -> https://github.com/OCA/commission/pull/372

Which one is currently active? what is left to check? Pedro, how do you see that the modules have been separated? We need the modules for clients, we were waiting to see if this migration would be finished in the summer, but since we have seen that it is not... we want to see what remains to be done. Thanks 😄

pedrobaeza commented 2 years ago

The problem with both PRs is that they are not doing the split in the best way using correctly git. Do you want to do it, Valentín?

standingmind commented 2 years ago

@pedrobaeza I want to work in migration of this sale_commission but I want to clear first. We will split sale_commission into 3 modules as you mentioned. But I want to know settlement should be exist in which module?

AungKoKoLin1997 commented 2 years ago

The problem with both PRs is that they are not doing the split in the best way using correctly git. Do you want to do it, Valentín?

@pedrobaeza Sorry for my PR. I didn't fully understand this https://github.com/OCA/commission/issues/328#issuecomment-986704280. Now I try to split the current base module sale_commission into 3 modules as you mentioned.

Could you please tell me my understanding is enough or not? And I don't get the main point of why need to split commission and account_commission. I think we can't do anything only with commission module(just my pov). So, I am not sure but should we combine these two into one module?

pedrobaeza commented 2 years ago

commission module that contains the basic definition of agents, commission types, mixins.

Thinking this twice, I think the settlement basic model with lines, having agent, date and amount, it's also a good idea. Later modules will add any kind of extra field for linking with their sources.

And I don't get the main point of why need to split commission and account_commission

The idea here is to avoid dependency on the invoices lines as the source of the settlements. This way, you can have settlements coming directly from sales orders, purchase orders, or any other kind of code that doesn't depend on invoices. Imagine for example a commission system that comes from the leads. We are not implementing this latter, but this design will fit with such requirement.

It's also important to preserve the diffs at minimum for proper commit history and for later investigations on the code history. Let me know if you have doubts about it. If you are going to OCA days at Liége, I will be there, and it's another good occasion to review it together.

AungKoKoLin1997 commented 2 years ago

Thinking this twice, I think the settlement basic model with lines, having agent, date and amount, it's also a good idea. Later modules will add any kind of extra field for linking with their sources.

I am thinking about it. Do you mean we create settlement base model like mixin and we inherit this base and create new model and have each settlement menu for other modules like sale_commission, account_commission. I mean we have a sale settlement menu for sale_commission.

How about if we split into 4 modules:

pedrobaeza commented 2 years ago

More than a mixin, I talk about a full model. All settlements, coming from any source, will generate a record of this model. The difference is that a settlement_type will differentiate it (and we can put security rules for filtering it if we want).

About the fourth module, sale_account_commission, as sale already depends on account, I don't think we should need such extra glue module. Just make sale_commission depends on account_commission, and what we can do is to make optional the transfer of the commissions via a config option.

AungKoKoLin1997 commented 2 years ago

The difference is that a settlement_type will differentiate it

Let me confirm this. When we make commission settlement, we need to choose settlement_type like sale order or account for generating settlement from sources. If we choose settlement_type to sale order when we make commission settlement, system will generate settlement from sale order lines. Is that right?

pedrobaeza commented 2 years ago

Not really, current settlement wizard will directly set the settlement_type to invoice. If tomorrow there's directly a wizard to settle sales orders, then such wizard will internally set that type in the created settlements, but the menu to see them all will be the same. Such sales wizard will also set the corresponding link for each line to each sale agent line. Do you understand what I want to say?

AungKoKoLin1997 commented 2 years ago

So, we have each wizard to settle for each source and we set the settlement_type in the created settlements. I mean if we use sale_commission, there is a wizard to settle sale orders, but the menu to see them will be the same

pedrobaeza commented 2 years ago

Yes, but for now you don't need to create such wizards except the existing one for invoices.

AungKoKoLin1997 commented 1 year ago

@pedrobaeza Can you please review this PR https://github.com/OCA/commission/pull/374? We split into three modules as we talked. But we have one concern about sale_commission. Now sale_commission performs the commissions on sales orders and propagate them to customer invoices. In the future, if we want to add directly settlements from sale orders, do we need to create new module for this part? I think we can't add this part in sale_commission module because this module depends on account_commission and may be user don't want to use account_commission. And then, I think we should add the option for transferring commssion from sale to invoice via config option in new module. Now, we can only make settlement from invoice. So, we need to propagate commission on sale orders to customer invoices. What do you think about this?

pedrobaeza commented 1 year ago

As sale depends on account, I think we can create a module sale_commission_direct_settlement that includes the settlements from sale, and you decide which one to use. What do you think?

Other option is to create sale_commission with the bare agent line additions, and sale_account_commission for transferring the lines to the invoices, and the other one for the settlements.

yostashiro commented 1 year ago

I think the first option is good as an interim arrangement. I am not aware of real need of creating settlements directly from sales orders. When such need comes out sale_commission_direct_settlement can be created.

This second option sounds more reasonable in case the need of direct settlement from sales orders turns out to be material. Maybe this can be considered for future versions.

pleirb commented 1 year ago

Hello, how are you all? In my humble capacity as a tester I am migrating from 14 to 15 and I get the following error:

insert or update on table "res_partner" violates foreign key constraint "res_partner_commission_id_fkey" DETAIL: Key (commission_id)=(9) is not present in table "commission"

I see that you are trying to solve this migration, is it possible that the error that I am getting is because details are still missing? I hope to be of help with the tests. Greetings!

pedrobaeza commented 1 year ago

https://github.com/OCA/commission/pull/426

pleirb commented 1 year ago

pedrobaeza

Thank you @pedrobaeza you are always there

github-actions[bot] commented 8 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.