forked from Smile-SA/odoo_addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fad62ff
commit 9789836
Showing
10 changed files
with
420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2016 Smile (<http://www.smile.fr>). All Rights Reserved | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
import models | ||
import tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2016 Smile (<http://www.smile.fr>). All Rights Reserved | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
{ | ||
"name": "Payment_writeoff amount", | ||
"version": "0.1", | ||
"sequence": 100, | ||
"category": "Accounting & Finance", | ||
"author": "Smile", | ||
"license": 'AGPL-3', | ||
"website": 'http://www.smile.fr', | ||
"description": """ | ||
Payment_writeoff amount auto paid | ||
================================= | ||
This module add fields, on company, loss and profit amounts and accounts. | ||
When a payment is done from invoice, if writeoff is in the allowed amount, mark invoice as fully paid with the profit/loss account. | ||
Suggestions & Feedback to: [email protected] | ||
""", | ||
"depends": ["account_voucher"], | ||
"data": [ | ||
'views/res_company_view.xml', | ||
], | ||
'installable': True, | ||
'auto_install': False, | ||
'application': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * smile_payment_writeoff | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0-20161028\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-11-25 13:31+0000\n" | ||
"PO-Revision-Date: 2016-11-25 13:31+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: smile_payment_writeoff | ||
#: model:ir.model,name:smile_payment_writeoff.model_res_company | ||
msgid "Companies" | ||
msgstr "Sociétés" | ||
|
||
#. module: smile_payment_writeoff | ||
#: model:ir.model.fields,field_description:smile_payment_writeoff.field_res_company_invoice_loss_account_id | ||
msgid "Loss Account" | ||
msgstr "Compte de perte" | ||
|
||
#. module: smile_payment_writeoff | ||
#: model:ir.model.fields,field_description:smile_payment_writeoff.field_res_company_invoice_loss_amount | ||
msgid "Max Loss Amount" | ||
msgstr "Montant max. de perte" | ||
|
||
#. module: smile_payment_writeoff | ||
#: model:ir.model.fields,field_description:smile_payment_writeoff.field_res_company_invoice_profit_amount | ||
msgid "Max Profit Amount" | ||
msgstr "Montant max. de profit" | ||
|
||
#. module: smile_payment_writeoff | ||
#: model:ir.model,name:smile_payment_writeoff.model_account_payment | ||
msgid "Payments" | ||
msgstr "Paiements" | ||
|
||
#. module: smile_payment_writeoff | ||
#: model:ir.model.fields,field_description:smile_payment_writeoff.field_res_company_invoice_profit_account_id | ||
msgid "Profit Account" | ||
msgstr "Compte de résultat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2016 Smile (<http://www.smile.fr>). All Rights Reserved | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
import account_payment | ||
import res_company |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2016 Smile (<http://www.smile.fr>). All Rights Reserved | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from odoo import api, models | ||
|
||
|
||
class AccountPayment(models.Model): | ||
_inherit = 'account.payment' | ||
|
||
@api.onchange('payment_difference') | ||
def onchange_writeoff_amount(self): | ||
pd = self.payment_difference | ||
if pd > 0: | ||
if pd < self.company_id.invoice_loss_amount and self.company_id.invoice_loss_account_id: | ||
self.payment_difference_handling = 'reconcile' | ||
self.writeoff_account_id = self.company_id.invoice_loss_account_id | ||
else: | ||
self.payment_difference_handling = 'open' | ||
self.writeoff_account_id = False | ||
elif pd < 0: | ||
if abs(pd) < self.company_id.invoice_profit_amount and self.company_id.invoice_loss_account_id: | ||
self.payment_difference_handling = 'reconcile' | ||
self.writeoff_account_id = self.company_id.invoice_profit_account_id | ||
else: | ||
self.payment_difference_handling = 'open' | ||
self.writeoff_account_id = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2016 Smile (<http://www.smile.fr>). All Rights Reserved | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from odoo import fields, models | ||
import odoo.addons.decimal_precision as dp | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = 'res.company' | ||
|
||
invoice_loss_amount = fields.Float(string='Max Loss Amount', digits=dp.get_precision('Account')) | ||
invoice_profit_amount = fields.Float(string='Max Profit Amount', digits=dp.get_precision('Account')) | ||
invoice_loss_account_id = fields.Many2one('account.account', 'Loss Account', ondelete='restrict') | ||
invoice_profit_account_id = fields.Many2one('account.account', 'Profit Account', ondelete='restrict') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2016 Smile (<http://www.smile.fr>). All Rights Reserved | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
import test_invoice |
Oops, something went wrong.