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

[10.0][IMP] account_payment_return: Add return expenses functionality #156

Merged

Conversation

luismontalba
Copy link
Member

Improvements:

  • Adds commissions expenses on each return line. When confirming return the expense is incorporated to the created move.
  • A link to the move created from the return view form.

cc @Tecnativa

@@ -157,6 +158,28 @@ def action_confirm(self):
(move_line | move_line2).reconcile()
return_line.move_line_ids.mapped('matched_debit_ids').write(
{'origin_returned_move_ids': [(6, 0, returned_moves.ids)]})
if return_line.expense_amount and return_line.expense_account:
Copy link
Member

Choose a reason for hiding this comment

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

Both expressions are the same.

@@ -231,6 +254,13 @@ class PaymentReturnLine(models.Model):
string='Amount',
help="Returned amount. Can be different from the move amount",
digits=dp.get_precision('Account'))
expense_account = fields.Many2one(
Copy link
Member

Choose a reason for hiding this comment

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

Put at journal level a default expense account and expense partner, and add an _onchange_expense_amount to bring this data to the fields.

@@ -42,6 +43,12 @@
('reconciled', '=', True)]"
/>
<field name="amount"/>
<field name="expense_account"
attrs="{'required':[('expense_amount','!=', 0)]}" />
<field name="expense_amount"
Copy link
Member

Choose a reason for hiding this comment

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

Put it first and without attrs.

@luismontalba
Copy link
Member Author

Changes proposed done in last commit.

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Little comments.

<record id="view_account_journal_form" model="ir.ui.view">
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="type">form</field>
Copy link
Member

Choose a reason for hiding this comment

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

Remove this deprecated key

@@ -281,6 +281,13 @@ def _get_partner_from_move(self):
def _onchange_move_line(self):
self._compute_amount()

@api.onchange('expense_amount')
def _onchange_expense_amount(self):
journal = self.return_id.journal_id
Copy link
Member

Choose a reason for hiding this comment

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

Put this inside if

@luismontalba luismontalba force-pushed the 10.0-imp-account_payment_return-expenses branch from b7a3d94 to 81ab48a Compare August 10, 2017 16:21
@luismontalba
Copy link
Member Author

Changes done (commit squashed).

@pedrobaeza
Copy link
Member

@cubells please review

Copy link
Member

@cubells cubells left a comment

Choose a reason for hiding this comment

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

👍

LGTM

Code review and test.

@pedrobaeza pedrobaeza merged commit bf085eb into OCA:10.0 Aug 14, 2017
@pedrobaeza pedrobaeza deleted the 10.0-imp-account_payment_return-expenses branch August 14, 2017 11:10
luismontalba pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 23, 2018
ThomasBinsfeld pushed a commit to acsone/account-payment that referenced this pull request Jan 24, 2019
ThomasBinsfeld pushed a commit to acsone/account-payment that referenced this pull request Jan 28, 2019
ernestotejeda pushed a commit to Tecnativa/account-payment that referenced this pull request Feb 7, 2020
ernestotejeda pushed a commit to Tecnativa/account-payment that referenced this pull request Feb 7, 2020
sergio-teruel pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 16, 2020
ernestotejeda pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 23, 2020
joao-p-marques pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 17, 2021
polqubiq pushed a commit to QubiQ/account-payment that referenced this pull request Apr 7, 2022
LudLaf pushed a commit to Tecnativa/account-payment that referenced this pull request Jun 2, 2022
LudLaf pushed a commit to Tecnativa/account-payment that referenced this pull request Jun 6, 2022
ChrisOForgeFlow pushed a commit to ForgeFlow/account-payment that referenced this pull request Aug 25, 2022
ChrisOForgeFlow pushed a commit to ForgeFlow/account-payment that referenced this pull request Sep 30, 2022
ChrisOForgeFlow pushed a commit to ForgeFlow/account-payment that referenced this pull request Nov 28, 2022
carlosdauden pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 7, 2023
carlosdauden pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 7, 2023
carlosdauden pushed a commit to Tecnativa/account-payment that referenced this pull request Mar 20, 2023
ao-landoo pushed a commit to landoo-es/account-payment that referenced this pull request Mar 22, 2023
Yadier-Tecnativa pushed a commit to Tecnativa/account-payment that referenced this pull request Jun 14, 2023
Ricardoalso pushed a commit to camptocamp/account-payment that referenced this pull request Nov 14, 2023
Ricardoalso pushed a commit to camptocamp/account-payment that referenced this pull request Nov 14, 2023
carlos-lopez-tecnativa pushed a commit to Tecnativa/account-payment that referenced this pull request Jul 24, 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.

3 participants