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

[14.0][ADD] account_wallet - NOBUMP #9

Open
wants to merge 60 commits into
base: 14.0
Choose a base branch
from

Conversation

legalsylvain
Copy link
Collaborator

@legalsylvain legalsylvain commented Aug 1, 2022

Finish #2

Clean and refactor

  • some clean. remove commented code : 9582751, remove "cagnotte" word : 8100b55 remove openupgradelib dependency : 6f6392d
  • rename file that contains view to fit OCA convention. 6de4402 10acc32
  • remove duplicated views for account.move and account.move.line c94432c b49885a
  • refactor test functions to factorize code. 2887ce5
  • rename no_anonymous field into automatic_nominative_creation because the description is better, to have the possibility to introduce a new field only_nominative and to prevent double negation : 0d0e392 (openupgrade script included).

UX Improvment

  • add domain on product field of account.wallet.type 73f2bb4

Bugfixes

  • in initial version, wallet balance are computed on draft, posted and cancel account move lines. With that patch, only 'posted' move lines impact balance. 6b8c6d7
  • allow to select wallet on payment refund f009d90

Add Feature

  • add field only_nominative on account.wallet.type to prevent wallet without partner defined. e8c4fa3
  • allow to select wallet on the wizard account.payment.register 223e7ef
  • make credit note wallet feature working in a multi company and or multi wallet type context c23d67b

This PR contains migration scripts. please call ocabot merge with nobump option

rousseldenis and others added 30 commits July 18, 2022 09:12
As sequence should be set instead of fixed name, don't create move
with a name
Only limit cases where partner_id AND account_id are filled in
change button_box
the existing mechanism did not work
2 new methods implemented/overriden
@legalsylvain legalsylvain force-pushed the 14.0-ADD-account_wallet branch from c9aa785 to b49885a Compare August 1, 2022 20:18
Copy link
Collaborator

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

@legalsylvain Thanks for this.

@xavier-bouquiaux @Cedric-Pigeon I made comments that could break our tests but IMHO, @legalsylvain work is great.

cls.partner = cls.env.ref("base.res_partner_2")

def _provision_wallet(self, amount, wallet=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@legalsylvain I'm not in favor of this in this version as other tests depends on.

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="wallet" model="account.account">
<record id="wallet_account" model="account.account">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't change this neither.

@@ -23,43 +23,87 @@ class WalletCommon(common.SavepointCase):
def setUpClass(cls):
super(WalletCommon, cls).setUpClass()
load_file(cls.cr, "account_wallet", "tests/data/", "account_wallet_data.xml")
cls.wallet_obj = cls.env["account.wallet"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change is not necessary (in this version)

@legalsylvain
Copy link
Collaborator Author

legalsylvain commented Aug 2, 2022

Hi. @rousseldenis. Thanks for your partial review.
This PR is still work in progress. I still have to fix the main issue regarding the generation of wallet only move are posted, but also other points, like the possibility to select a wallet during payment, that's not possible for the time being.

I'll ping you when it's ready to review. I hope at the end of this week.

Regarding refactor, This PR includes breaking changes regarding your previous PR(s). Some adaptation should be done but I prefer to refactor correctly the module before the introduction into the OCA because the refactor introduce some simplification.
for exemple, 2887ce5 the test refactor.

git log --shortstat
 3 files changed, 107 insertions(+), 199 deletions(-)

Also, it is fixing some things. for exemple, regarding the xml_id, "wallet", the name is wrong, because it's not a account.wallet, but an account.account.

As said before, if you have time, I'm available to talk with you regarding the refactors.

kind regards.

…account_move_line_ids) are in the state 'posted'
@legalsylvain
Copy link
Collaborator Author

6b8c6d7 should fix the major problem of bad balance computation on draft / canceled move lines mentionned here #2 (comment)

provide also simplification.

4 files changed, 46 insertions(+), 65 deletions(-)

@legalsylvain legalsylvain force-pushed the 14.0-ADD-account_wallet branch from eca8ccc to 237427b Compare August 5, 2022 08:52
@legalsylvain legalsylvain force-pushed the 14.0-ADD-account_wallet branch from 237427b to 223e7ef Compare August 5, 2022 09:02
@legalsylvain legalsylvain changed the title [14.0][ADD] account_wallet [14.0][ADD] account_wallet - NOBUMP Aug 5, 2022
@legalsylvain legalsylvain marked this pull request as ready for review August 5, 2022 11:18
@legalsylvain
Copy link
Collaborator Author

legalsylvain commented Aug 5, 2022

Hi @rousseldenis : correction and improvement work almost finished.

Could you review ?

I have a question left, regarding the moves generated by the credit note wizard. I don't understand why the move lands in the sale journal, and not in a miscellaneous journal. Advantage to not use sale journal :

legalsylvain added a commit to legalsylvain/grap-odoo-incubator that referenced this pull request Aug 5, 2022
@rousseldenis
Copy link
Collaborator

@xavier-bouquiaux Could you review ?

@xavier-bouquiaux
Copy link

do not take my approval into account -> still reviewing
i'll be back ASAP

Copy link

@xavier-bouquiaux xavier-bouquiaux left a comment

Choose a reason for hiding this comment

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

First round of review

* Laetitia Gangloff <[email protected]>
* Cedric Pigeon <[email protected]>
* Denis Roussel <[email protected]>
* Xavier Bouquiaux <[email protected]>

Choose a reason for hiding this comment

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

@legalsylvain
add yourself here at the very least


@api.depends(lambda self: self._get_compute_balance_fields())
def _compute_balance(self):
for wallet in self:
balance = 0
for move_line in wallet.account_move_line_ids:
for move_line in wallet.account_move_line_ids.filtered(

Choose a reason for hiding this comment

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

This one is a HUGE change
i'll have to test

@@ -15,3 +15,7 @@ class AccountMove(models.Model):
help="Use this field to give coupon to a customer",
states={"draft": [("readonly", False)]},
)

def action_post(self):
self.mapped("line_ids").create_or_set_wallet()

Choose a reason for hiding this comment

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

This one is linked to the other but it's also a MAJOR change

<field name="inherit_id" ref="account.view_account_payment_register_form" />
<field name="arch" type="xml">
<field name="journal_id" position="after">
<field name="account_wallet_id" />

Choose a reason for hiding this comment

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

shouldn't you put some kind of domain ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, I was thinking that depending on accounting choice, it was possible to make many different accounts.

you can add a domain, if you want. (but in the python part don't you think ?)

if vals["debit"] > 0:
if self.payment_type == "inbound" and vals["debit"] > 0:
vals.update({"account_wallet_id": self.account_wallet_id.id})
if self.payment_type == "outbound" and vals["credit"] > 0:

Choose a reason for hiding this comment

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

Question : why the if ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you're right, fixed !

@oca-clabot
Copy link

Hey @legalsylvain, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: https://odoo-community.org/page/cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

@legalsylvain
Copy link
Collaborator Author

answered to all comments. (except your remark regarding the HUGE change).
please ping me if you have other remarks.

@openupgrade.migrate()
def migrate(env, version):
if openupgrade.column_exists(env.cr, "account_wallet_type", "no_anonymous"):
openupgrade.rename_columns(

Choose a reason for hiding this comment

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

TypeError: rename_columns() missing 1 required positional argument: 'column_spec'

should be

Suggested change
openupgrade.rename_columns(
openupgrade.rename_columns(env.cr, ...

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 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 PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants