forked from OCA/commission
-
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.
[IMP] *_commission: Total refactorization of the modules
- Loading branch information
1 parent
39bb020
commit 598b82b
Showing
65 changed files
with
10,685 additions
and
5,505 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 |
---|---|---|
@@ -1,4 +1,37 @@ | ||
HR Commission | ||
Commissions in HR | ||
================== | ||
|
||
This module links sale_commision with hr module. | ||
This module links sale_commission with hr module. For now, it only adds another | ||
type of agent whose commissions are not invoiced in the corresponding wizard. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
* Add demo data. | ||
* Restore all 6.1 functionality about linking with wages. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
* Pedro M. Baeza <[email protected]> | ||
|
||
Icon | ||
---- | ||
* http://commons.wikimedia.org/wiki/File:Percent_18e.svg | ||
* https://openclipart.org/detail/43969/pile-of-golden-coins-by-j_alves | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Copyright (C) 2015 Pedro M. Baeza (<http://www.serviciosbaeza.com>) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
|
@@ -17,21 +19,21 @@ | |
############################################################################## | ||
|
||
{ | ||
'name': 'HR commission', | ||
'name': 'HR commissions', | ||
'version': '1.0', | ||
'author': 'Pexego', | ||
"category": "Generic Modules/Sales & Purchases", | ||
'depends': ['sale_commission', 'hr'], | ||
'author': 'Serv. Tecnol. Avanzados - Pedro M. Baeza', | ||
"category": "Human Resources", | ||
'depends': [ | ||
'sale_commission', | ||
'hr' | ||
], | ||
'license': 'AGPL-3', | ||
'contributors': [ | ||
"Davide Corio <[email protected]>", | ||
"Joao Alfredo Gama Batista <[email protected]>", | ||
"Sandy Carter <[email protected]>", | ||
"Giorgio Borelli <[email protected]>", | ||
"Daniel Campos <[email protected]>", | ||
"Pedro M. Baeza <[email protected]>", | ||
"Ana Juaristi <[email protected]>"], | ||
"data": ["views/sale_agent_view.xml"], | ||
"active": True, | ||
], | ||
"data": [ | ||
"views/res_partner_view.xml", | ||
], | ||
"installable": True, | ||
"auto_install": True, | ||
} |
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,37 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * hr_commission | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-02-19 08:46+0000\n" | ||
"PO-Revision-Date: 2015-02-19 08:46+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: hr_commission | ||
#: code:addons/hr_commission/models/res_partner.py:47 | ||
#, python-format | ||
msgid "There must one (and only one) employee linked to this partner. To do this, go to 'Human Resources' and check 'Employees'" | ||
msgstr "Debe haber un (y sólo un) empleado enlazado a esta empresa. Para hacer esto, vaya a 'Recursos humanos' y compruebe la sección 'Empleados'" | ||
|
||
#. module: hr_commission | ||
#: field:res.partner,users:0 | ||
msgid "Users" | ||
msgstr "Usuarios" | ||
|
||
#. module: hr_commission | ||
#: field:res.partner,employee:0 | ||
msgid "Employee" | ||
msgstr "Empleado" | ||
|
||
#. module: sale_commission | ||
#: selection:res.partner,agent_type:0 | ||
msgid "Salesman (employee)" | ||
msgstr "Comercial (empleado)" |
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
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
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,55 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2015 Avanzosc (<http://www.avanzosc.es>) | ||
# Copyright (C) 2015 Pedro M. Baeza (<http://www.serviciosbaeza.com>) | ||
# | ||
# 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 openerp import models, fields, api, exceptions, _ | ||
|
||
|
||
class ResPartner(models.Model): | ||
"""Add some fields related to commissions""" | ||
_inherit = "res.partner" | ||
|
||
agent_type = fields.Selection( | ||
selection_add=[("salesman", "Salesman (employee)")]) | ||
employee = fields.Many2one( | ||
comodel_name="hr.employee", compute="_get_employee") | ||
users = fields.One2many(comodel_name="res.users", | ||
inverse_name="partner_id") | ||
|
||
@api.one | ||
@api.depends('users') | ||
def _get_employee(self): | ||
self.employee = False | ||
if len(self.users) == 1 and len(self.users[0].employee_ids) == 1: | ||
self.employee = self.users[0].employee_ids[0] | ||
|
||
@api.constrains('agent_type', 'employee') | ||
def _check_employee(self): | ||
if self.agent_type == 'salesman' and not self.employee: | ||
raise exceptions.ValidationError( | ||
_("There must one (and only one) employee linked to this " | ||
"partner. To do this, go to 'Human Resources' and check " | ||
"'Employees'")) | ||
|
||
@api.onchange('agent_type') | ||
def onchange_agent_type(self): | ||
if self.agent_type == 'salesman': | ||
self.supplier = False | ||
return super(ResPartner, self).onchange_agent_type() |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.