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

[IMP] contract: Allow to single invoice a contract by users #1005

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

Conversation

etobella
Copy link
Member

@etobella etobella commented Oct 11, 2023

It should allow you to process sale orders and other kinds, as it is using the cron function

@dixmit

@pedrobaeza
Copy link
Member

Why this? You already have the button to manually invoice it on the contract itsel.

@pedrobaeza pedrobaeza added this to the 14.0 milestone Oct 11, 2023
@etobella
Copy link
Member Author

etobella commented Oct 11, 2023

That button is only accessible on debug mode, and it does not verify dates, so, If I push the button three times It will create the invoice three times.

Wit my new way an standard user can create the invoices without worrying if he/she is doing something wrong

@pedrobaeza
Copy link
Member

Then I think it's better to fine tune that button, showing it to billing users, and showing the popup to decide if force or not to make the invoice.

@etobella
Copy link
Member Author

So, should I keep my button and remove the old one?

@pedrobaeza
Copy link
Member

I think it should be only one button to do both things according a check saying to force or not.

@etobella etobella force-pushed the 14.0-contract-improve branch 3 times, most recently from 4ad40fc to 5b7145f Compare October 18, 2023 16:05
@damdam-s
Copy link
Member

damdam-s commented Nov 3, 2023

functionnal test OK

@damdam-s
Copy link
Member

any issue w/ this one?

@etobella
Copy link
Member Author

Just waiting for approvals

@damdam-s
Copy link
Member

ok thanks
@etobella FYI i'm currently working on a refactor for the cron to use the "wizard" method to have the same behaviour from the cron and from the wizard. Any objection?

@etobella
Copy link
Member Author

good for me

@damdam-s
Copy link
Member

@etobella here is the PR against this PR dixmit#2

etobella and others added 4 commits February 21, 2024 17:26
… controlled way

It should allow you to process sale orders and other kinds
Remove the extra button not necessary any more
if the method creating invoice generates more than one invoice, we have
`[account.move(ID1, ID2)` for example and the `message_post()` fails w/ a `singleton error.

Adding a loop level allows to properly post messages no matter of the number of invoices generated by the wizard
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 Jun 23, 2024
@github-actions github-actions bot closed this Jul 28, 2024
@etobella etobella reopened this Jul 28, 2024
@etobella
Copy link
Member Author

@pedrobaeza I think the changes fits your requests 😄

@@ -633,17 +664,24 @@ def _get_recurring_create_func(self, create_type="invoice"):
return self.__class__._recurring_create_invoice

@api.model
def _cron_recurring_create(self, date_ref=False, create_type="invoice"):
def _cron_recurring_create(
self, date_ref=False, create_type="invoice", domain=None
Copy link
Member

Choose a reason for hiding this comment

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

Changing the number of arguments is conflicting, as any override of this method won't know about the new argument, and it will fail, or at least, ignore this new argument. Can you avoid it?

@@ -317,7 +321,9 @@ def test_contract_invoice_followers(self):
self.contract.message_subscribe(
partner_ids=self.contract.partner_id.ids, subtype_ids=subtype_ids
)
self.contract._recurring_create_invoice()
self.env["contract.manually.single.invoice"].create(
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you should change this test, but only add a new one for the new use case. This also proves that there's no change in the previous behavior for compatibility reasons.

name="%(contract.contract_manually_single_invoice_act_window)s"
type="action"
string="Process manually"
context="{'default_contract_id': id, 'default_date': recurring_next_date}"
Copy link
Member

Choose a reason for hiding this comment

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

Use active_id instead

type="action"
string="Process manually"
context="{'default_contract_id': id, 'default_date': recurring_next_date}"
attrs="{'invisible': [('id', '=', False)]}"
Copy link
Member

Choose a reason for hiding this comment

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

Hide it in the generation_type is not invoice.

@@ -574,6 +601,10 @@ def recurring_create_invoice(self):
This method triggers the creation of the next invoices of the contracts
even if their next invoicing date is in the future.
"""
_logger.warning(
Copy link
Member

Choose a reason for hiding this comment

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

I don't get why repeating the message_post code.

<field name="model">contract.manually.single.invoice</field>
<field name="arch" type="xml">
<form string="Contract Manually Single Invoice">
<!-- TODO -->
Copy link
Member

Choose a reason for hiding this comment

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

?

@@ -70,6 +74,10 @@ def recurring_create_sale(self):
This method triggers the creation of the next sale order of the
contracts even if their next sale order date is in the future.
"""
_logger.warning(
Copy link
Member

Choose a reason for hiding this comment

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

This is for sales, not invoices.

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

Successfully merging this pull request may close these issues.

5 participants