From 21cb37a42479daa24d2421fc2e7c70f2a3bb8bfc Mon Sep 17 00:00:00 2001 From: Yoshi Tashiro Date: Sat, 19 Nov 2022 07:58:27 +0000 Subject: [PATCH 001/151] [FIX] update dotfiles w/ copier: flake8 source --- .copier-answers.yml | 2 +- .pre-commit-config.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 85280cc5f..e8f8a6e99 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.11.0 +_commit: v1.11.1 _src_path: https://github.com/OCA/oca-addons-repo-template.git ci: GitHub dependency_installation_mode: PIP diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c74928c7..f8b0a807b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -104,7 +104,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 3.0.3 + rev: 3.1.8 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements @@ -113,7 +113,7 @@ repos: - requirements.txt - --header - "# generated from manifests external_dependencies" - - repo: https://gitlab.com/PyCQA/flake8 + - repo: https://github.com/PyCQA/flake8 rev: 3.9.2 hooks: - id: flake8 From 5add607a8dcf1f703f583fabcc44a697ce8270b8 Mon Sep 17 00:00:00 2001 From: marta pexego Date: Fri, 13 Jul 2012 12:51:04 +0200 Subject: [PATCH 002/151] sale_commissions: added module migrated to 6.1. (../../7.0-pexego_sale_commission rev 7) --- sale_commission/__init__.py | 33 + sale_commission/__openerp__.py | 56 ++ sale_commission/cc_commission_report.xml | 13 + sale_commission/i18n/ca.po | 813 +++++++++++++++++++ sale_commission/i18n/es.po | 813 +++++++++++++++++++ sale_commission/i18n/sale_commission.pot | 813 +++++++++++++++++++ sale_commission/invoice.py | 135 +++ sale_commission/invoice_view.xml | 94 +++ sale_commission/partner.py | 40 + sale_commission/partner_agent.py | 89 ++ sale_commission/partner_agent_view.xml | 31 + sale_commission/partner_view.xml | 39 + sale_commission/product_view.xml | 18 + sale_commission/report/settlement_report.rml | 238 ++++++ sale_commission/sale_order.py | 171 ++++ sale_commission/sale_order_view.xml | 65 ++ sale_commission/saleagent.py | 101 +++ sale_commission/saleagent_demo.xml | 59 ++ sale_commission/saleagent_view.xml | 152 ++++ sale_commission/security/ir.model.access.csv | 28 + sale_commission/settled.py | 488 +++++++++++ sale_commission/settled_view.xml | 347 ++++++++ sale_commission/settlement_wizard.xml | 15 + sale_commission/stock_picking.py | 65 ++ sale_commission/stock_picking_view.xml | 38 + sale_commission/wizard/__init__.py | 23 + sale_commission/wizard/wizard_invoice.py | 68 ++ sale_commission/wizard/wizard_invoice.xml | 32 + 28 files changed, 4877 insertions(+) create mode 100644 sale_commission/__init__.py create mode 100644 sale_commission/__openerp__.py create mode 100644 sale_commission/cc_commission_report.xml create mode 100644 sale_commission/i18n/ca.po create mode 100644 sale_commission/i18n/es.po create mode 100644 sale_commission/i18n/sale_commission.pot create mode 100644 sale_commission/invoice.py create mode 100644 sale_commission/invoice_view.xml create mode 100644 sale_commission/partner.py create mode 100644 sale_commission/partner_agent.py create mode 100644 sale_commission/partner_agent_view.xml create mode 100644 sale_commission/partner_view.xml create mode 100644 sale_commission/product_view.xml create mode 100644 sale_commission/report/settlement_report.rml create mode 100644 sale_commission/sale_order.py create mode 100644 sale_commission/sale_order_view.xml create mode 100644 sale_commission/saleagent.py create mode 100644 sale_commission/saleagent_demo.xml create mode 100644 sale_commission/saleagent_view.xml create mode 100644 sale_commission/security/ir.model.access.csv create mode 100644 sale_commission/settled.py create mode 100644 sale_commission/settled_view.xml create mode 100644 sale_commission/settlement_wizard.xml create mode 100644 sale_commission/stock_picking.py create mode 100644 sale_commission/stock_picking_view.xml create mode 100644 sale_commission/wizard/__init__.py create mode 100644 sale_commission/wizard/wizard_invoice.py create mode 100644 sale_commission/wizard/wizard_invoice.xml diff --git a/sale_commission/__init__.py b/sale_commission/__init__.py new file mode 100644 index 000000000..9da1854e5 --- /dev/null +++ b/sale_commission/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +import saleagent +import invoice +import partner_agent +import partner +import settled +import sale_order +import stock_picking +import wizard + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/sale_commission/__openerp__.py b/sale_commission/__openerp__.py new file mode 100644 index 000000000..3be21099f --- /dev/null +++ b/sale_commission/__openerp__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## +{ + 'name' : 'Sales commissions', + 'version': '1.0', + 'author' : 'Pexego', + "category": "Generic Modules/Sales & Purchases", + 'depends' : [ + 'base', + 'account', + 'product', + 'sale', + 'hr', + 'stock' + ], + 'description': 'Sales commissions', + 'init_xml' : [], + 'update_xml': [ + 'security/ir.model.access.csv', + 'saleagent_view.xml', + 'partner_agent_view.xml', + 'wizard/wizard_invoice.xml', + 'partner_view.xml', + 'settled_view.xml', + 'invoice_view.xml', + 'sale_order_view.xml', + 'product_view.xml', + 'stock_picking_view.xml', + 'cc_commission_report.xml', + ], + 'demo_xml': [ + ], + 'active': False, + 'installable': True +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/sale_commission/cc_commission_report.xml b/sale_commission/cc_commission_report.xml new file mode 100644 index 000000000..925cc6a6d --- /dev/null +++ b/sale_commission/cc_commission_report.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/sale_commission/i18n/ca.po b/sale_commission/i18n/ca.po new file mode 100644 index 000000000..3f549217f --- /dev/null +++ b/sale_commission/i18n/ca.po @@ -0,0 +1,813 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * sale_commission +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2011-05-02 11:44+0000\n" +"PO-Revision-Date: 2011-05-02 15:04+0100\n" +"Last-Translator: Raimon Esteve \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" + +#. module: sale_commission +#: field:res.partner,agent:0 +msgid "Creditor/Agent" +msgstr "Agent" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "INVOICE NO" +msgstr "Factura Nº" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Monthly" +msgstr "Mensual" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settled_invoice_agent +#: model:ir.ui.menu,name:sale_commission.menu_agent_invoice_settled +#: view:settled.invoice.agent:0 +msgid "Settled invoices summary" +msgstr "Resum de factures liquidades" + +#. module: sale_commission +#: view:res.partner:0 +msgid "Consultancy" +msgstr "Consultoria" + +#. module: sale_commission +#: view:sale.agent:0 +#: view:settled.invoice.agent:0 +#: view:settlement.agent:0 +msgid "Group By..." +msgstr "Agrupar per..." + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +msgid "Select period to recalculate commissions" +msgstr "Selecciona període per recalcular comissions" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement +msgid "settlement" +msgstr "Liquidació" + +#. module: sale_commission +#: field:commission.section,commission_until:0 +msgid "Until" +msgstr "Fins" + +#. module: sale_commission +#: view:sale.agent:0 +#: field:sale.agent,settlement_ids:0 +msgid "Settlements executed" +msgstr "Liquidacions realitzades" + +#. module: sale_commission +#: view:settled.invoice.agent:0 +msgid "Invoice summary" +msgstr "Resum de factures" + +#. module: sale_commission +#: sql_constraint:sale.order:0 +msgid "Order Reference must be unique !" +msgstr "¡La referencia de la comanda ha de ser única!" + +#. module: sale_commission +#: field:settlement.agent,total_sections:0 +msgid "Total sections" +msgstr "Total trams" + +#. module: sale_commission +#: field:settlement.line,invoice_date:0 +msgid "Invoice Date" +msgstr "Data de factura" + +#. module: sale_commission +#: model:ir.actions.report.xml,name:sale_commission.settlement_report +msgid "Settlement report" +msgstr "Informe de liquidació" + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +msgid "Recalculate agents commissions" +msgstr "Recalcular comissiones" + +#. module: sale_commission +#: view:settlement:0 +msgid "Agents summary" +msgstr "Resum dels agents" + +#. module: sale_commission +#: view:res.partner:0 +#: view:sale.order:0 +msgid "Agents and Commissions" +msgstr "Agents i comissions" + +#. module: sale_commission +#: help:sale.agent,employee_id:0 +msgid "Employee associated to agent, is necessary for set an employee to settle commissions in wage." +msgstr "Empleat associat a l'agent, es necessari associar un empleat per liquidar les comissions en la nòmina (no implementat)." + +#. module: sale_commission +#: view:settlement.agent:0 +#: field:settlement.line,settlement_agent_id:0 +msgid "Settlement agent" +msgstr "Liquidació del agent" + +#. module: sale_commission +#: view:account.invoice.line:0 +msgid "Notes" +msgstr "Notes" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Annual" +msgstr "Anual" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:193 +#, python-format +msgid "Error!" +msgstr "Error!" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_agent +msgid "Sale agent" +msgstr "Agent de vendes" + +#. module: sale_commission +#: field:stock.picking,agent_ids:0 +msgid "Agentes" +msgstr "Agents" + +#. module: sale_commission +#: field:settlement.agent,total_per:0 +msgid "Total percentages" +msgstr "Total percentatges" + +#. module: sale_commission +#: field:sale.agent,employee_id:0 +msgid "Associated Employee" +msgstr "Empleat associat" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Customer assigned" +msgstr "Client assignat" + +#. module: sale_commission +#: field:settlement.line,amount:0 +msgid "Invoice line amount" +msgstr "Import de la línia de factura" + +#. module: sale_commission +#: view:settlement:0 +msgid "Create Invoices" +msgstr "Crear factures" + +#. module: sale_commission +#: field:account.invoice,agent_id:0 +#: field:invoice.line.agent,agent_id:0 +#: field:res.partner.agent,agent_id:0 +#: view:sale.agent:0 +#: field:sale.order.agent,agent_id:0 +#: view:settled.invoice.agent:0 +#: field:settled.invoice.agent,agent_id:0 +#: view:settlement.agent:0 +#: field:settlement.agent,agent_id:0 +msgid "Agent" +msgstr "Agent" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_agent_settlement +msgid "Agents setlements summary" +msgstr "Resum de liquidacions dels agents" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_recalculate_commission +msgid "Recalculate agents commissions " +msgstr "Recalcular comissions dels agents " + +#. module: sale_commission +#: field:res.partner,commission_ids:0 +#: view:res.partner.agent:0 +#: field:sale.order,sale_agent_ids:0 +#: view:sale.order.agent:0 +#: view:stock.picking:0 +msgid "Agents" +msgstr "Agents" + +#. module: sale_commission +#: code:addons/sale_commission/wizard/wizard_invoice.py:55 +#, python-format +msgid "No Invoices were created" +msgstr "No s'han creat factures" + +#. module: sale_commission +#: view:settled.wizard:0 +msgid "Select period to Settle" +msgstr "Seleccionar període a liquidar" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_res_partner +#: field:res.partner.agent,partner_id:0 +#: field:sale.agent,partner_id:0 +msgid "Partner" +msgstr "Empresa" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order +msgid "Sales Order" +msgstr "Comanda de venda" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AGENT:" +msgstr "AGENT:" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order_line +msgid "Sales Order Line" +msgstr "Línia comanda de venta" + +#. module: sale_commission +#: field:settled.invoice.wizard,journal_id:0 +msgid "Target journal" +msgstr "Diari" + +#. module: sale_commission +#: field:commission.section,commission_from:0 +#: field:recalculate.commission.wizard,date_from:0 +#: field:settled.wizard,date_from:0 +#: field:settlement,date_from:0 +msgid "From" +msgstr "Des de" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_commission_form +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_types +msgid "Commission Types" +msgstr "Tipus de comissions" + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "Create" +msgstr "Crear" + +#. module: sale_commission +#: field:sale.agent,name:0 +msgid "Saleagent Name" +msgstr "Nom de l'agent de vendes" + +#. module: sale_commission +#: field:commission.section,percent:0 +msgid "Percent" +msgstr "Per cent" + +#. module: sale_commission +#: view:commission:0 +#: field:commission.section,commission_id:0 +#: model:ir.model,name:sale_commission.model_commission +#: view:sale.agent:0 +#: field:settlement.line,commission_id:0 +msgid "Commission" +msgstr "Comissió" + +#. module: sale_commission +#: field:settlement,state:0 +msgid "State" +msgstr "Estat" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:251 +#, python-format +msgid "Error, partner fail !" +msgstr "Error, ha fallat en la empresa !" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_stock_picking +msgid "Picking List" +msgstr "Albarà" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement_line +msgid "settlement.line" +msgstr "Línia de liquidació" + +#. module: sale_commission +#: help:sale.agent,code:0 +msgid "Se obtiene del código de la empresa relacionada" +msgstr "S'obté del codi de la empresa relacionada" + +#. module: sale_commission +#: field:commission,sections:0 +msgid "Sections" +msgstr "Trams" + +#. module: sale_commission +#: view:settlement.agent:0 +msgid "Agent summary" +msgstr "Resum de l'agent" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AMOUNT INVOICED" +msgstr "IMPORT FACTURAT" + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "Create invoice" +msgstr "Crear factura" + +#. module: sale_commission +#: help:account.invoice.line,commission_ids:0 +msgid "Commissions asociated to invoice line." +msgstr "Comissions associades a la línia de factura." + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_invoice_agent +msgid "Resumen de facturas liquidadas" +msgstr "Resum de factures liquidades" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "SETTLEMENT:" +msgstr "LIQUIDACIÓ:" + +#. module: sale_commission +#: help:res.partner,agent:0 +msgid "If you check this field will be available as creditor or agent." +msgstr "Si marca aquest camp estarà disponible com a comercial o agent." + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "_Cancel" +msgstr "_Cancelar" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_res_partner_agent +msgid "res.partner.agent" +msgstr "res.partner.agent" + +#. module: sale_commission +#: field:sale.agent,commission:0 +msgid "Commission by default" +msgstr "Comissió per defecte" + +#. module: sale_commission +#: field:settlement,date:0 +msgid "Created Date" +msgstr "Data de creació" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Search Agent" +msgstr "Buscar agent" + +#. module: sale_commission +#: field:account.invoice,agent_code:0 +msgid "Agent code" +msgstr "Codi de l'agent" + +#. module: sale_commission +#: view:settled.wizard:0 +msgid "Run Settlement Agents" +msgstr "Executar liquidacions dels agents" + +#. module: sale_commission +#: field:settlement,settlement_agent_id:0 +msgid "Settlement agents" +msgstr "Liquidació dels agents" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_saleagent_form +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_agent +msgid "Sale agents" +msgstr "Agents de vendes" + +#. module: sale_commission +#: constraint:product.product:0 +msgid "Several dimension values for the same dimension type" +msgstr "Varis valors de dimensió pel tipus de la mateix dimensió" + +#. module: sale_commission +#: view:commission:0 +msgid "General info." +msgstr "Info. general" + +#. module: sale_commission +#: view:settlement.agent:0 +#: field:settlement.agent,invoices:0 +msgid "Invoices" +msgstr "Factures" + +#. module: sale_commission +#: field:product.product,commission_exent:0 +msgid "Commission exent" +msgstr "Exempt de comissions" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_settlement +#: view:settlement:0 +msgid "Settlements" +msgstr "Liquidacions" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_line_id:0 +#: model:ir.model,name:sale_commission.model_account_invoice_line +msgid "Invoice Line" +msgstr "Línia de factura" + +#. module: sale_commission +#: field:settlement.line,currency_id:0 +msgid "Currency" +msgstr "Moneda" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "TOTAL :" +msgstr "TOTAL :" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_invoice_wizard +msgid "settled.invoice.wizard" +msgstr "settled.invoice.wizard" + +#. module: sale_commission +#: selection:settlement,state:0 +msgid "Invoiced" +msgstr "Facturat" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Saleagent" +msgstr "Agent" + +#. module: sale_commission +#: field:sale.order.agent,sale_id:0 +msgid "Sale order" +msgstr "Ordre de venda" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_settled_invoice +#: view:settled.invoice.wizard:0 +msgid "Create invoices" +msgstr "Crear factures" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement_agent +msgid "settlement.agent" +msgstr "settlement.agent" + +#. module: sale_commission +#: view:invoice.line.agent:0 +msgid "Commissions and Agents" +msgstr "Comissions i agents" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Quarterly" +msgstr "Quadrimestral" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settlement +msgid "Settlement Summary" +msgstr "Resum de la liquidació" + +#. module: sale_commission +#: selection:res.partner.agent,type:0 +#: view:sale.agent:0 +#: selection:sale.agent,type:0 +msgid "Adviser" +msgstr "Agent" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_date:0 +#: field:res.partner.agent,type:0 +msgid "unknown" +msgstr "desconegut" + +#. module: sale_commission +#: selection:res.partner.agent,type:0 +#: view:sale.agent:0 +#: selection:sale.agent,type:0 +msgid "Commercial" +msgstr "Comercial" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settlement_agent +msgid "Settlement Agents Summary" +msgstr "Resum d'agents en liquidació" + +#. module: sale_commission +#: field:sale.agent,active:0 +msgid "Active" +msgstr "Actiu" + +#. module: sale_commission +#: view:commission:0 +msgid "sections" +msgstr "trams" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:193 +#, python-format +msgid "You can't delete it, if it isn't in cancel state." +msgstr "No pot borar aquest registre. Només en estat cancel·lat" + +#. module: sale_commission +#: view:res.partner:0 +#: view:sale.order:0 +#: view:stock.picking:0 +msgid "Agents/Consultancy" +msgstr "Agents/Comercials" + +#. module: sale_commission +#: selection:commission,type:0 +msgid "Fix percentage" +msgstr "Percentatge fixe" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order_agent +msgid "sale.order.agent" +msgstr "sale.order.agent" + +#. module: sale_commission +#: view:settled.invoice.agent:0 +#: view:settlement:0 +#: view:settlement.line:0 +msgid "Settled total" +msgstr "Total liquidat" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_wizard +msgid "settled.wizard" +msgstr "settled.wizard" + +#. module: sale_commission +#: code:addons/sale_commission/wizard/wizard_invoice.py:55 +#, python-format +msgid "Error" +msgstr "Error" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Related entity or employee" +msgstr "Entitat o empleat relacionat" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:252 +#, python-format +msgid "Agent to settle hasn't assigned partner." +msgstr "L'agent a liquidar no té una empresa assignada." + +#. module: sale_commission +#: field:settled.invoice.agent,settlement_agent_id:0 +msgid "Agent settl." +msgstr "Liq. de l'agent." + +#. module: sale_commission +#: field:settlement.line,commission:0 +msgid "Quantity" +msgstr "Quantitat" + +#. module: sale_commission +#: field:commission,type:0 +#: field:sale.agent,type:0 +msgid "Type" +msgstr "Tipus" + +#. module: sale_commission +#: field:sale.agent,code:0 +msgid "Code" +msgstr "Codi" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_amount:0 +msgid "Amount assigned in invoice" +msgstr "Import assignat en la factura" + +#. module: sale_commission +#: field:recalculate.commission.wizard,date_to:0 +#: field:settled.wizard,date_to:0 +#: field:settlement,date_to:0 +msgid "To" +msgstr "A" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_commission_section +msgid "Commission section" +msgstr "Tram de la comissió" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_id:0 +#: model:ir.model,name:sale_commission.model_account_invoice +#: view:settled.invoice.agent:0 +#: field:settled.invoice.agent,invoice_id:0 +#: field:settlement.line,invoice_id:0 +msgid "Invoice" +msgstr "Factura" + +#. module: sale_commission +#: view:account.invoice.line:0 +#: field:account.invoice.line,commission_ids:0 +#: view:commission:0 +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_conf +msgid "Commissions" +msgstr "Comissions" + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +#: view:settled.wizard:0 +#: view:settlement:0 +#: selection:settlement,state:0 +msgid "Cancel" +msgstr "Cancel·lar" + +#. module: sale_commission +#: help:sale.agent,partner_id:0 +msgid "Associated partner, is necessary for income invoices." +msgstr "Empresa associada, es necessari per les factures entrants generades." + +#. module: sale_commission +#: view:sale.agent:0 +#: view:settlement.agent:0 +#: field:settlement.agent,settlement_id:0 +msgid "Settlement" +msgstr "Liquidació" + +#. module: sale_commission +#: field:sale.agent,retention_id:0 +msgid "Applied retention" +msgstr "Retenció aplicada" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_number:0 +msgid "Invoice no" +msgstr "Factura nº" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "INVOICE DATE" +msgstr "DATA FACTURA" + +#. module: sale_commission +#: code:addons/sale_commission/invoice.py:82 +#: code:addons/sale_commission/partner_agent.py:80 +#: code:addons/sale_commission/sale_order.py:67 +#, python-format +msgid "Fee installments!" +msgstr "Fee installments!" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_agents_settlement +msgid "Perform agents settlements" +msgstr "Realitza liquidació d'agents" + +#. module: sale_commission +#: view:settlement.agent:0 +msgid "Line details" +msgstr "Línies de detalle" + +#. module: sale_commission +#: code:addons/sale_commission/invoice.py:84 +#: code:addons/sale_commission/partner_agent.py:81 +#: code:addons/sale_commission/sale_order.py:68 +#, python-format +msgid "A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill." +msgstr "S'ha assignat una comissió per trams que no coincideix amb la definició per defecte de l'agent. Aquest tram només s'aplica a aquesta factura" + +#. module: sale_commission +#: view:commission:0 +msgid "Definition of rates" +msgstr "Definició de taques" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_product_product +msgid "Product" +msgstr "Producte" + +#. module: sale_commission +#: field:sale.agent,settlement:0 +msgid "Period settlement" +msgstr "Període de liquidació" + +#. module: sale_commission +#: field:sale.agent,customer:0 +msgid "Customer" +msgstr "Client" + +#. module: sale_commission +#: view:settlement.line:0 +msgid "Settlement lines" +msgstr "Línies de liquidació" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_invoice_line_agent +msgid "invoice.line.agent" +msgstr "invoice.line.agent" + +#. module: sale_commission +#: field:commission,name:0 +msgid "Name" +msgstr "Nom" + +#. module: sale_commission +#: field:account.invoice,country:0 +msgid "Country" +msgstr "País" + +#. module: sale_commission +#: selection:commission,type:0 +msgid "By sections" +msgstr "Per trams" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_date:0 +msgid "Invoice date" +msgstr "Data de factura" + +#. module: sale_commission +#: field:settlement.agent,lines:0 +msgid "Lines" +msgstr "Línies" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Semiannual" +msgstr "Semestral" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_commisions_report +msgid "Reports" +msgstr "Informes" + +#. module: sale_commission +#: field:invoice.line.agent,quantity:0 +#: field:settled.invoice.agent,settled_amount:0 +msgid "Settled amount" +msgstr "Import liquidat" + +#. module: sale_commission +#: field:invoice.line.agent,commission_id:0 +#: field:res.partner.agent,commission_id:0 +#: field:sale.order.agent,commission_id:0 +msgid "Applied commission" +msgstr "Comissió aplicada" + +#. module: sale_commission +#: field:invoice.line.agent,settled:0 +#: selection:settlement,state:0 +msgid "Settled" +msgstr "Liquidat" + +#. module: sale_commission +#: field:settlement,name:0 +msgid "Settlement period" +msgstr "Període de liquidació" + +#. module: sale_commission +#: field:commission,fix_qty:0 +msgid "Fix Percentage" +msgstr "Percentatge fixe" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AMOUNT SETTLED" +msgstr "IMPORT LIQUIDAT" + +#. module: sale_commission +#: field:settled.invoice.wizard,product_id:0 +msgid "Product for account" +msgstr "Producte per comptabilitzar" + +#. module: sale_commission +#: constraint:product.product:0 +msgid "Error: Invalid ean code" +msgstr "Error: Codi EAN erroni" + +#. module: sale_commission +#: field:settlement.line,invoice_line_id:0 +msgid "Settled invoice line" +msgstr "Línia de factura liquidada" + +#. module: sale_commission +#: field:settlement,total:0 +#: field:settlement.agent,total:0 +msgid "Total" +msgstr "Total" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_recalculate_commission_wizard +msgid "recalculate.commission.wizard" +msgstr "recalculate.commission.wizard" + diff --git a/sale_commission/i18n/es.po b/sale_commission/i18n/es.po new file mode 100644 index 000000000..bfdacfaca --- /dev/null +++ b/sale_commission/i18n/es.po @@ -0,0 +1,813 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * sale_commission +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2011-05-02 11:44+0000\n" +"PO-Revision-Date: 2011-05-02 14:17+0100\n" +"Last-Translator: Raimon Esteve \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" + +#. module: sale_commission +#: field:res.partner,agent:0 +msgid "Creditor/Agent" +msgstr "Agente" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "INVOICE NO" +msgstr "Factura Nº" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Monthly" +msgstr "Mensual" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settled_invoice_agent +#: model:ir.ui.menu,name:sale_commission.menu_agent_invoice_settled +#: view:settled.invoice.agent:0 +msgid "Settled invoices summary" +msgstr "Resumen de facturas liquidadas" + +#. module: sale_commission +#: view:res.partner:0 +msgid "Consultancy" +msgstr "Agente Comercial" + +#. module: sale_commission +#: view:sale.agent:0 +#: view:settled.invoice.agent:0 +#: view:settlement.agent:0 +msgid "Group By..." +msgstr "Agrupar por..." + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +msgid "Select period to recalculate commissions" +msgstr "Seleccionar período para recalcular comisiones" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement +msgid "settlement" +msgstr "Liquidación" + +#. module: sale_commission +#: field:commission.section,commission_until:0 +msgid "Until" +msgstr "Hasta" + +#. module: sale_commission +#: view:sale.agent:0 +#: field:sale.agent,settlement_ids:0 +msgid "Settlements executed" +msgstr "Liquidaciones realizadas" + +#. module: sale_commission +#: view:settled.invoice.agent:0 +msgid "Invoice summary" +msgstr "Resumen de facturas" + +#. module: sale_commission +#: sql_constraint:sale.order:0 +msgid "Order Reference must be unique !" +msgstr "¡La referencia del pedido debe ser única!" + +#. module: sale_commission +#: field:settlement.agent,total_sections:0 +msgid "Total sections" +msgstr "Total tramos" + +#. module: sale_commission +#: field:settlement.line,invoice_date:0 +msgid "Invoice Date" +msgstr "Fecha de factura" + +#. module: sale_commission +#: model:ir.actions.report.xml,name:sale_commission.settlement_report +msgid "Settlement report" +msgstr "Informe de liquidación" + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +msgid "Recalculate agents commissions" +msgstr "Recalcular comisiones" + +#. module: sale_commission +#: view:settlement:0 +msgid "Agents summary" +msgstr "Resumen de agentes" + +#. module: sale_commission +#: view:res.partner:0 +#: view:sale.order:0 +msgid "Agents and Commissions" +msgstr "Agentes y comisiones" + +#. module: sale_commission +#: help:sale.agent,employee_id:0 +msgid "Employee associated to agent, is necessary for set an employee to settle commissions in wage." +msgstr "Empleado asociado al agente, es necesario asociar un empleado para liquidar las comisiones en nómina (no implementado)." + +#. module: sale_commission +#: view:settlement.agent:0 +#: field:settlement.line,settlement_agent_id:0 +msgid "Settlement agent" +msgstr "Liquidación de agente" + +#. module: sale_commission +#: view:account.invoice.line:0 +msgid "Notes" +msgstr "Notas" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Annual" +msgstr "Anual" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:193 +#, python-format +msgid "Error!" +msgstr "Error!" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_agent +msgid "Sale agent" +msgstr "Agente de ventas" + +#. module: sale_commission +#: field:stock.picking,agent_ids:0 +msgid "Agentes" +msgstr "Agentes" + +#. module: sale_commission +#: field:settlement.agent,total_per:0 +msgid "Total percentages" +msgstr "Total porcentajes" + +#. module: sale_commission +#: field:sale.agent,employee_id:0 +msgid "Associated Employee" +msgstr "Empleado asociado" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Customer assigned" +msgstr "Cliente asignado" + +#. module: sale_commission +#: field:settlement.line,amount:0 +msgid "Invoice line amount" +msgstr "Importe de la línea de factura" + +#. module: sale_commission +#: view:settlement:0 +msgid "Create Invoices" +msgstr "Crear facturas" + +#. module: sale_commission +#: field:account.invoice,agent_id:0 +#: field:invoice.line.agent,agent_id:0 +#: field:res.partner.agent,agent_id:0 +#: view:sale.agent:0 +#: field:sale.order.agent,agent_id:0 +#: view:settled.invoice.agent:0 +#: field:settled.invoice.agent,agent_id:0 +#: view:settlement.agent:0 +#: field:settlement.agent,agent_id:0 +msgid "Agent" +msgstr "Agente" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_agent_settlement +msgid "Agents setlements summary" +msgstr "Resumen de liquidaciones de agentes" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_recalculate_commission +msgid "Recalculate agents commissions " +msgstr "Recalcular comisiones de agentes " + +#. module: sale_commission +#: field:res.partner,commission_ids:0 +#: view:res.partner.agent:0 +#: field:sale.order,sale_agent_ids:0 +#: view:sale.order.agent:0 +#: view:stock.picking:0 +msgid "Agents" +msgstr "Agentes" + +#. module: sale_commission +#: code:addons/sale_commission/wizard/wizard_invoice.py:55 +#, python-format +msgid "No Invoices were created" +msgstr "No se crearon facturas" + +#. module: sale_commission +#: view:settled.wizard:0 +msgid "Select period to Settle" +msgstr "Seleccionar período a liquidar" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_res_partner +#: field:res.partner.agent,partner_id:0 +#: field:sale.agent,partner_id:0 +msgid "Partner" +msgstr "Empresa" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AGENT:" +msgstr "AGENTE:" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order_line +msgid "Sales Order Line" +msgstr "Línea pedido de venta" + +#. module: sale_commission +#: field:settled.invoice.wizard,journal_id:0 +msgid "Target journal" +msgstr "Diario" + +#. module: sale_commission +#: field:commission.section,commission_from:0 +#: field:recalculate.commission.wizard,date_from:0 +#: field:settled.wizard,date_from:0 +#: field:settlement,date_from:0 +msgid "From" +msgstr "Desde" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_commission_form +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_types +msgid "Commission Types" +msgstr "Tipos de comisiones" + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "Create" +msgstr "Crear" + +#. module: sale_commission +#: field:sale.agent,name:0 +msgid "Saleagent Name" +msgstr "Nombre del agente de ventas" + +#. module: sale_commission +#: field:commission.section,percent:0 +msgid "Percent" +msgstr "Por ciento" + +#. module: sale_commission +#: view:commission:0 +#: field:commission.section,commission_id:0 +#: model:ir.model,name:sale_commission.model_commission +#: view:sale.agent:0 +#: field:settlement.line,commission_id:0 +msgid "Commission" +msgstr "Comisión" + +#. module: sale_commission +#: field:settlement,state:0 +msgid "State" +msgstr "Estado" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:251 +#, python-format +msgid "Error, partner fail !" +msgstr "Error, fallo en la empresa !" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_stock_picking +msgid "Picking List" +msgstr "Albarán" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement_line +msgid "settlement.line" +msgstr "Línea de liquidación" + +#. module: sale_commission +#: help:sale.agent,code:0 +msgid "Se obtiene del código de la empresa relacionada" +msgstr "Se obtiene del código de la empresa relacionada" + +#. module: sale_commission +#: field:commission,sections:0 +msgid "Sections" +msgstr "Tramos" + +#. module: sale_commission +#: view:settlement.agent:0 +msgid "Agent summary" +msgstr "Resumen de agente" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AMOUNT INVOICED" +msgstr "IMPORTE FACTURADO" + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "Create invoice" +msgstr "Crear factura" + +#. module: sale_commission +#: help:account.invoice.line,commission_ids:0 +msgid "Commissions asociated to invoice line." +msgstr "Comisiones asociadas a la línea de factura." + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_invoice_agent +msgid "Resumen de facturas liquidadas" +msgstr "Resumen de facturas liquidadas" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "SETTLEMENT:" +msgstr "LIQUIDACIÓN:" + +#. module: sale_commission +#: help:res.partner,agent:0 +msgid "If you check this field will be available as creditor or agent." +msgstr "Si marca este campo estará disponible como comecial o como agente." + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "_Cancel" +msgstr "_Cancelar" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_res_partner_agent +msgid "res.partner.agent" +msgstr "res.partner.agent" + +#. module: sale_commission +#: field:sale.agent,commission:0 +msgid "Commission by default" +msgstr "Comisión por defecto" + +#. module: sale_commission +#: field:settlement,date:0 +msgid "Created Date" +msgstr "Fecha de creación" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Search Agent" +msgstr "Buscar agente" + +#. module: sale_commission +#: field:account.invoice,agent_code:0 +msgid "Agent code" +msgstr "Código del agente" + +#. module: sale_commission +#: view:settled.wizard:0 +msgid "Run Settlement Agents" +msgstr "Ejecutar liquidaciones de agentes" + +#. module: sale_commission +#: field:settlement,settlement_agent_id:0 +msgid "Settlement agents" +msgstr "Liquidación de agentes" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_saleagent_form +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_agent +msgid "Sale agents" +msgstr "Agentes de ventas" + +#. module: sale_commission +#: constraint:product.product:0 +msgid "Several dimension values for the same dimension type" +msgstr "Varios valores de dimensión para el tipo de la misma dimensión" + +#. module: sale_commission +#: view:commission:0 +msgid "General info." +msgstr "Info. general" + +#. module: sale_commission +#: view:settlement.agent:0 +#: field:settlement.agent,invoices:0 +msgid "Invoices" +msgstr "Facturas" + +#. module: sale_commission +#: field:product.product,commission_exent:0 +msgid "Commission exent" +msgstr "Exento de comisiones" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_settlement +#: view:settlement:0 +msgid "Settlements" +msgstr "Liquidaciones" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_line_id:0 +#: model:ir.model,name:sale_commission.model_account_invoice_line +msgid "Invoice Line" +msgstr "Línea de factura" + +#. module: sale_commission +#: field:settlement.line,currency_id:0 +msgid "Currency" +msgstr "Moneda" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "TOTAL :" +msgstr "TOTAL :" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_invoice_wizard +msgid "settled.invoice.wizard" +msgstr "settled.invoice.wizard" + +#. module: sale_commission +#: selection:settlement,state:0 +msgid "Invoiced" +msgstr "Facturado" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Saleagent" +msgstr "Agente" + +#. module: sale_commission +#: field:sale.order.agent,sale_id:0 +msgid "Sale order" +msgstr "Orden de venta" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_settled_invoice +#: view:settled.invoice.wizard:0 +msgid "Create invoices" +msgstr "Crear facturas" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement_agent +msgid "settlement.agent" +msgstr "settlement.agent" + +#. module: sale_commission +#: view:invoice.line.agent:0 +msgid "Commissions and Agents" +msgstr "Comisiones y agentes" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Quarterly" +msgstr "Cuatrimestral" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settlement +msgid "Settlement Summary" +msgstr "Resumen de liquidación" + +#. module: sale_commission +#: selection:res.partner.agent,type:0 +#: view:sale.agent:0 +#: selection:sale.agent,type:0 +msgid "Adviser" +msgstr "Agente" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_date:0 +#: field:res.partner.agent,type:0 +msgid "unknown" +msgstr "desconocido" + +#. module: sale_commission +#: selection:res.partner.agent,type:0 +#: view:sale.agent:0 +#: selection:sale.agent,type:0 +msgid "Commercial" +msgstr "Comercial" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settlement_agent +msgid "Settlement Agents Summary" +msgstr "Resumen de agentes en liquidación" + +#. module: sale_commission +#: field:sale.agent,active:0 +msgid "Active" +msgstr "Activo" + +#. module: sale_commission +#: view:commission:0 +msgid "sections" +msgstr "tramos" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:193 +#, python-format +msgid "You can't delete it, if it isn't in cancel state." +msgstr "No se puede borrar. No está en estado cancelado" + +#. module: sale_commission +#: view:res.partner:0 +#: view:sale.order:0 +#: view:stock.picking:0 +msgid "Agents/Consultancy" +msgstr "Agentes/Comerciales" + +#. module: sale_commission +#: selection:commission,type:0 +msgid "Fix percentage" +msgstr "Porcentaje fijo" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order_agent +msgid "sale.order.agent" +msgstr "sale.order.agent" + +#. module: sale_commission +#: view:settled.invoice.agent:0 +#: view:settlement:0 +#: view:settlement.line:0 +msgid "Settled total" +msgstr "Total liquidado" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_wizard +msgid "settled.wizard" +msgstr "settled.wizard" + +#. module: sale_commission +#: code:addons/sale_commission/wizard/wizard_invoice.py:55 +#, python-format +msgid "Error" +msgstr "Error" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Related entity or employee" +msgstr "Entidad o empleado relacionado" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:252 +#, python-format +msgid "Agent to settle hasn't assigned partner." +msgstr "El agente a liquidar no tiene una empresa asignada." + +#. module: sale_commission +#: field:settled.invoice.agent,settlement_agent_id:0 +msgid "Agent settl." +msgstr "Liq.de agente." + +#. module: sale_commission +#: field:settlement.line,commission:0 +msgid "Quantity" +msgstr "Cantidad" + +#. module: sale_commission +#: field:commission,type:0 +#: field:sale.agent,type:0 +msgid "Type" +msgstr "Tipo" + +#. module: sale_commission +#: field:sale.agent,code:0 +msgid "Code" +msgstr "Código" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_amount:0 +msgid "Amount assigned in invoice" +msgstr "Importe asignado en factura" + +#. module: sale_commission +#: field:recalculate.commission.wizard,date_to:0 +#: field:settled.wizard,date_to:0 +#: field:settlement,date_to:0 +msgid "To" +msgstr "A" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_commission_section +msgid "Commission section" +msgstr "Tramo de comisión" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_id:0 +#: model:ir.model,name:sale_commission.model_account_invoice +#: view:settled.invoice.agent:0 +#: field:settled.invoice.agent,invoice_id:0 +#: field:settlement.line,invoice_id:0 +msgid "Invoice" +msgstr "Factura" + +#. module: sale_commission +#: view:account.invoice.line:0 +#: field:account.invoice.line,commission_ids:0 +#: view:commission:0 +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_conf +msgid "Commissions" +msgstr "Comisiones" + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +#: view:settled.wizard:0 +#: view:settlement:0 +#: selection:settlement,state:0 +msgid "Cancel" +msgstr "Cancelar" + +#. module: sale_commission +#: help:sale.agent,partner_id:0 +msgid "Associated partner, is necessary for income invoices." +msgstr "Empresa asociada, es necesario para las facturas entrantes generadas." + +#. module: sale_commission +#: view:sale.agent:0 +#: view:settlement.agent:0 +#: field:settlement.agent,settlement_id:0 +msgid "Settlement" +msgstr "Liquidación" + +#. module: sale_commission +#: field:sale.agent,retention_id:0 +msgid "Applied retention" +msgstr "Retención aplicada" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_number:0 +msgid "Invoice no" +msgstr "Factura nº" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "INVOICE DATE" +msgstr "FECHA FACTURA" + +#. module: sale_commission +#: code:addons/sale_commission/invoice.py:82 +#: code:addons/sale_commission/partner_agent.py:80 +#: code:addons/sale_commission/sale_order.py:67 +#, python-format +msgid "Fee installments!" +msgstr "Fee installments!" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_agents_settlement +msgid "Perform agents settlements" +msgstr "Realizar liquidación de agentes" + +#. module: sale_commission +#: view:settlement.agent:0 +msgid "Line details" +msgstr "Líneas de detalle" + +#. module: sale_commission +#: code:addons/sale_commission/invoice.py:84 +#: code:addons/sale_commission/partner_agent.py:81 +#: code:addons/sale_commission/sale_order.py:68 +#, python-format +msgid "A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill." +msgstr "Se ha asignado una comisión por tramos que no coincide con la definida por defecto para el agente, por lo que ese tramo solo se aplica a esta factura" + +#. module: sale_commission +#: view:commission:0 +msgid "Definition of rates" +msgstr "Definición de tasas" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_product_product +msgid "Product" +msgstr "Producto" + +#. module: sale_commission +#: field:sale.agent,settlement:0 +msgid "Period settlement" +msgstr "Período de liquidación" + +#. module: sale_commission +#: field:sale.agent,customer:0 +msgid "Customer" +msgstr "Cliente" + +#. module: sale_commission +#: view:settlement.line:0 +msgid "Settlement lines" +msgstr "Líneas de liquidación" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_invoice_line_agent +msgid "invoice.line.agent" +msgstr "invoice.line.agent" + +#. module: sale_commission +#: field:commission,name:0 +msgid "Name" +msgstr "Nombre" + +#. module: sale_commission +#: field:account.invoice,country:0 +msgid "Country" +msgstr "País" + +#. module: sale_commission +#: selection:commission,type:0 +msgid "By sections" +msgstr "Por tramos" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_date:0 +msgid "Invoice date" +msgstr "Fecha de factura" + +#. module: sale_commission +#: field:settlement.agent,lines:0 +msgid "Lines" +msgstr "Líneas" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Semiannual" +msgstr "Semestral" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_commisions_report +msgid "Reports" +msgstr "Informes" + +#. module: sale_commission +#: field:invoice.line.agent,quantity:0 +#: field:settled.invoice.agent,settled_amount:0 +msgid "Settled amount" +msgstr "Importe liquidado" + +#. module: sale_commission +#: field:invoice.line.agent,commission_id:0 +#: field:res.partner.agent,commission_id:0 +#: field:sale.order.agent,commission_id:0 +msgid "Applied commission" +msgstr "Comisión aplicada" + +#. module: sale_commission +#: field:invoice.line.agent,settled:0 +#: selection:settlement,state:0 +msgid "Settled" +msgstr "Liquidado" + +#. module: sale_commission +#: field:settlement,name:0 +msgid "Settlement period" +msgstr "Período de liquidación" + +#. module: sale_commission +#: field:commission,fix_qty:0 +msgid "Fix Percentage" +msgstr "Porcentaje fijo" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AMOUNT SETTLED" +msgstr "IMPORTE LIQUIDADO" + +#. module: sale_commission +#: field:settled.invoice.wizard,product_id:0 +msgid "Product for account" +msgstr "Producto para contabilizar" + +#. module: sale_commission +#: constraint:product.product:0 +msgid "Error: Invalid ean code" +msgstr "Error: Código EAN erróneo" + +#. module: sale_commission +#: field:settlement.line,invoice_line_id:0 +msgid "Settled invoice line" +msgstr "Línea de factura liquidada" + +#. module: sale_commission +#: field:settlement,total:0 +#: field:settlement.agent,total:0 +msgid "Total" +msgstr "Total" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_recalculate_commission_wizard +msgid "recalculate.commission.wizard" +msgstr "recalculate.commission.wizard" + diff --git a/sale_commission/i18n/sale_commission.pot b/sale_commission/i18n/sale_commission.pot new file mode 100644 index 000000000..f0329b44f --- /dev/null +++ b/sale_commission/i18n/sale_commission.pot @@ -0,0 +1,813 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * sale_commission +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2011-05-02 11:44+0000\n" +"PO-Revision-Date: 2011-05-02 11:44+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: sale_commission +#: field:res.partner,agent:0 +msgid "Creditor/Agent" +msgstr "Creditor/Agent" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "INVOICE NO" +msgstr "INVOICE NO" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Monthly" +msgstr "Monthly" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settled_invoice_agent +#: model:ir.ui.menu,name:sale_commission.menu_agent_invoice_settled +#: view:settled.invoice.agent:0 +msgid "Settled invoices summary" +msgstr "Settled invoices summary" + +#. module: sale_commission +#: view:res.partner:0 +msgid "Consultancy" +msgstr "Consultancy" + +#. module: sale_commission +#: view:sale.agent:0 +#: view:settled.invoice.agent:0 +#: view:settlement.agent:0 +msgid "Group By..." +msgstr "Group By..." + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +msgid "Select period to recalculate commissions" +msgstr "Select period to recalculate commissions" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement +msgid "settlement" +msgstr "settlement" + +#. module: sale_commission +#: field:commission.section,commission_until:0 +msgid "Until" +msgstr "Until" + +#. module: sale_commission +#: view:sale.agent:0 +#: field:sale.agent,settlement_ids:0 +msgid "Settlements executed" +msgstr "Settlements executed" + +#. module: sale_commission +#: view:settled.invoice.agent:0 +msgid "Invoice summary" +msgstr "Invoice summary" + +#. module: sale_commission +#: sql_constraint:sale.order:0 +msgid "Order Reference must be unique !" +msgstr "Order Reference must be unique !" + +#. module: sale_commission +#: field:settlement.agent,total_sections:0 +msgid "Total sections" +msgstr "Total sections" + +#. module: sale_commission +#: field:settlement.line,invoice_date:0 +msgid "Invoice Date" +msgstr "Invoice Date" + +#. module: sale_commission +#: model:ir.actions.report.xml,name:sale_commission.settlement_report +msgid "Settlement report" +msgstr "Settlement report" + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +msgid "Recalculate agents commissions" +msgstr "Recalculate agents commissions" + +#. module: sale_commission +#: view:settlement:0 +msgid "Agents summary" +msgstr "Agents summary" + +#. module: sale_commission +#: view:res.partner:0 +#: view:sale.order:0 +msgid "Agents and Commissions" +msgstr "Agents and Commissions" + +#. module: sale_commission +#: help:sale.agent,employee_id:0 +msgid "Employee associated to agent, is necessary for set an employee to settle commissions in wage." +msgstr "Employee associated to agent, is necessary for set an employee to settle commissions in wage." + +#. module: sale_commission +#: view:settlement.agent:0 +#: field:settlement.line,settlement_agent_id:0 +msgid "Settlement agent" +msgstr "Settlement agent" + +#. module: sale_commission +#: view:account.invoice.line:0 +msgid "Notes" +msgstr "Notes" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Annual" +msgstr "Annual" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:193 +#, python-format +msgid "Error!" +msgstr "Error!" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_agent +msgid "Sale agent" +msgstr "Sale agent" + +#. module: sale_commission +#: field:stock.picking,agent_ids:0 +msgid "Agentes" +msgstr "Agentes" + +#. module: sale_commission +#: field:settlement.agent,total_per:0 +msgid "Total percentages" +msgstr "Total percentages" + +#. module: sale_commission +#: field:sale.agent,employee_id:0 +msgid "Associated Employee" +msgstr "Associated Employee" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Customer assigned" +msgstr "Customer assigned" + +#. module: sale_commission +#: field:settlement.line,amount:0 +msgid "Invoice line amount" +msgstr "Invoice line amount" + +#. module: sale_commission +#: view:settlement:0 +msgid "Create Invoices" +msgstr "Create Invoices" + +#. module: sale_commission +#: field:account.invoice,agent_id:0 +#: field:invoice.line.agent,agent_id:0 +#: field:res.partner.agent,agent_id:0 +#: view:sale.agent:0 +#: field:sale.order.agent,agent_id:0 +#: view:settled.invoice.agent:0 +#: field:settled.invoice.agent,agent_id:0 +#: view:settlement.agent:0 +#: field:settlement.agent,agent_id:0 +msgid "Agent" +msgstr "Agent" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_agent_settlement +msgid "Agents setlements summary" +msgstr "Agents setlements summary" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_recalculate_commission +msgid "Recalculate agents commissions " +msgstr "Recalculate agents commissions " + +#. module: sale_commission +#: field:res.partner,commission_ids:0 +#: view:res.partner.agent:0 +#: field:sale.order,sale_agent_ids:0 +#: view:sale.order.agent:0 +#: view:stock.picking:0 +msgid "Agents" +msgstr "Agents" + +#. module: sale_commission +#: code:addons/sale_commission/wizard/wizard_invoice.py:55 +#, python-format +msgid "No Invoices were created" +msgstr "No Invoices were created" + +#. module: sale_commission +#: view:settled.wizard:0 +msgid "Select period to Settle" +msgstr "Select period to Settle" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_res_partner +#: field:res.partner.agent,partner_id:0 +#: field:sale.agent,partner_id:0 +msgid "Partner" +msgstr "Partner" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order +msgid "Sales Order" +msgstr "Sales Order" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AGENT:" +msgstr "AGENT:" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order_line +msgid "Sales Order Line" +msgstr "Sales Order Line" + +#. module: sale_commission +#: field:settled.invoice.wizard,journal_id:0 +msgid "Target journal" +msgstr "Target journal" + +#. module: sale_commission +#: field:commission.section,commission_from:0 +#: field:recalculate.commission.wizard,date_from:0 +#: field:settled.wizard,date_from:0 +#: field:settlement,date_from:0 +msgid "From" +msgstr "From" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_commission_form +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_types +msgid "Commission Types" +msgstr "Commission Types" + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "Create" +msgstr "Create" + +#. module: sale_commission +#: field:sale.agent,name:0 +msgid "Saleagent Name" +msgstr "Saleagent Name" + +#. module: sale_commission +#: field:commission.section,percent:0 +msgid "Percent" +msgstr "Percent" + +#. module: sale_commission +#: view:commission:0 +#: field:commission.section,commission_id:0 +#: model:ir.model,name:sale_commission.model_commission +#: view:sale.agent:0 +#: field:settlement.line,commission_id:0 +msgid "Commission" +msgstr "Commission" + +#. module: sale_commission +#: field:settlement,state:0 +msgid "State" +msgstr "State" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:251 +#, python-format +msgid "Error, partner fail !" +msgstr "Error, partner fail !" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_stock_picking +msgid "Picking List" +msgstr "Picking List" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement_line +msgid "settlement.line" +msgstr "settlement.line" + +#. module: sale_commission +#: help:sale.agent,code:0 +msgid "Se obtiene del código de la empresa relacionada" +msgstr "Se obtiene del código de la empresa relacionada" + +#. module: sale_commission +#: field:commission,sections:0 +msgid "Sections" +msgstr "Sections" + +#. module: sale_commission +#: view:settlement.agent:0 +msgid "Agent summary" +msgstr "Agent summary" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AMOUNT INVOICED" +msgstr "AMOUNT INVOICED" + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "Create invoice" +msgstr "Create invoice" + +#. module: sale_commission +#: help:account.invoice.line,commission_ids:0 +msgid "Commissions asociated to invoice line." +msgstr "Commissions asociated to invoice line." + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_invoice_agent +msgid "Resumen de facturas liquidadas" +msgstr "Resumen de facturas liquidadas" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "SETTLEMENT:" +msgstr "SETTLEMENT:" + +#. module: sale_commission +#: help:res.partner,agent:0 +msgid "If you check this field will be available as creditor or agent." +msgstr "If you check this field will be available as creditor or agent." + +#. module: sale_commission +#: view:settled.invoice.wizard:0 +msgid "_Cancel" +msgstr "_Cancel" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_res_partner_agent +msgid "res.partner.agent" +msgstr "res.partner.agent" + +#. module: sale_commission +#: field:sale.agent,commission:0 +msgid "Commission by default" +msgstr "Commission by default" + +#. module: sale_commission +#: field:settlement,date:0 +msgid "Created Date" +msgstr "Created Date" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Search Agent" +msgstr "Search Agent" + +#. module: sale_commission +#: field:account.invoice,agent_code:0 +msgid "Agent code" +msgstr "Agent code" + +#. module: sale_commission +#: view:settled.wizard:0 +msgid "Run Settlement Agents" +msgstr "Run Settlement Agents" + +#. module: sale_commission +#: field:settlement,settlement_agent_id:0 +msgid "Settlement agents" +msgstr "Settlement agents" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_saleagent_form +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_agent +msgid "Sale agents" +msgstr "Sale agents" + +#. module: sale_commission +#: constraint:product.product:0 +msgid "Several dimension values for the same dimension type" +msgstr "Several dimension values for the same dimension type" + +#. module: sale_commission +#: view:commission:0 +msgid "General info." +msgstr "General info." + +#. module: sale_commission +#: view:settlement.agent:0 +#: field:settlement.agent,invoices:0 +msgid "Invoices" +msgstr "Invoices" + +#. module: sale_commission +#: field:product.product,commission_exent:0 +msgid "Commission exent" +msgstr "Commission exent" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_settlement +#: view:settlement:0 +msgid "Settlements" +msgstr "Settlements" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_line_id:0 +#: model:ir.model,name:sale_commission.model_account_invoice_line +msgid "Invoice Line" +msgstr "Invoice Line" + +#. module: sale_commission +#: field:settlement.line,currency_id:0 +msgid "Currency" +msgstr "Currency" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "TOTAL :" +msgstr "TOTAL :" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_invoice_wizard +msgid "settled.invoice.wizard" +msgstr "settled.invoice.wizard" + +#. module: sale_commission +#: selection:settlement,state:0 +msgid "Invoiced" +msgstr "Invoiced" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Saleagent" +msgstr "Saleagent" + +#. module: sale_commission +#: field:sale.order.agent,sale_id:0 +msgid "Sale order" +msgstr "Sale order" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_settled_invoice +#: view:settled.invoice.wizard:0 +msgid "Create invoices" +msgstr "Create invoices" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settlement_agent +msgid "settlement.agent" +msgstr "settlement.agent" + +#. module: sale_commission +#: view:invoice.line.agent:0 +msgid "Commissions and Agents" +msgstr "Commissions and Agents" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Quarterly" +msgstr "Quarterly" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settlement +msgid "Settlement Summary" +msgstr "Settlement Summary" + +#. module: sale_commission +#: selection:res.partner.agent,type:0 +#: view:sale.agent:0 +#: selection:sale.agent,type:0 +msgid "Adviser" +msgstr "Adviser" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_date:0 +#: field:res.partner.agent,type:0 +msgid "unknown" +msgstr "unknown" + +#. module: sale_commission +#: selection:res.partner.agent,type:0 +#: view:sale.agent:0 +#: selection:sale.agent,type:0 +msgid "Commercial" +msgstr "Commercial" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.act_settlement_agent +msgid "Settlement Agents Summary" +msgstr "Settlement Agents Summary" + +#. module: sale_commission +#: field:sale.agent,active:0 +msgid "Active" +msgstr "Active" + +#. module: sale_commission +#: view:commission:0 +msgid "sections" +msgstr "sections" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:193 +#, python-format +msgid "You can't delete it, if it isn't in cancel state." +msgstr "You can't delete it, if it isn't in cancel state." + +#. module: sale_commission +#: view:res.partner:0 +#: view:sale.order:0 +#: view:stock.picking:0 +msgid "Agents/Consultancy" +msgstr "Agents/Consultancy" + +#. module: sale_commission +#: selection:commission,type:0 +msgid "Fix percentage" +msgstr "Fix percentage" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_sale_order_agent +msgid "sale.order.agent" +msgstr "sale.order.agent" + +#. module: sale_commission +#: view:settled.invoice.agent:0 +#: view:settlement:0 +#: view:settlement.line:0 +msgid "Settled total" +msgstr "Settled total" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_settled_wizard +msgid "settled.wizard" +msgstr "settled.wizard" + +#. module: sale_commission +#: code:addons/sale_commission/wizard/wizard_invoice.py:55 +#, python-format +msgid "Error" +msgstr "Error" + +#. module: sale_commission +#: view:sale.agent:0 +msgid "Related entity or employee" +msgstr "Related entity or employee" + +#. module: sale_commission +#: code:addons/sale_commission/settled.py:252 +#, python-format +msgid "Agent to settle hasn't assigned partner." +msgstr "Agent to settle hasn't assigned partner." + +#. module: sale_commission +#: field:settled.invoice.agent,settlement_agent_id:0 +msgid "Agent settl." +msgstr "Agent settl." + +#. module: sale_commission +#: field:settlement.line,commission:0 +msgid "Quantity" +msgstr "Quantity" + +#. module: sale_commission +#: field:commission,type:0 +#: field:sale.agent,type:0 +msgid "Type" +msgstr "Type" + +#. module: sale_commission +#: field:sale.agent,code:0 +msgid "Code" +msgstr "Code" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_amount:0 +msgid "Amount assigned in invoice" +msgstr "Amount assigned in invoice" + +#. module: sale_commission +#: field:recalculate.commission.wizard,date_to:0 +#: field:settled.wizard,date_to:0 +#: field:settlement,date_to:0 +msgid "To" +msgstr "To" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_commission_section +msgid "Commission section" +msgstr "Commission section" + +#. module: sale_commission +#: field:invoice.line.agent,invoice_id:0 +#: model:ir.model,name:sale_commission.model_account_invoice +#: view:settled.invoice.agent:0 +#: field:settled.invoice.agent,invoice_id:0 +#: field:settlement.line,invoice_id:0 +msgid "Invoice" +msgstr "Invoice" + +#. module: sale_commission +#: view:account.invoice.line:0 +#: field:account.invoice.line,commission_ids:0 +#: view:commission:0 +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions +#: model:ir.ui.menu,name:sale_commission.menu_sale_commissions_conf +msgid "Commissions" +msgstr "Commissions" + +#. module: sale_commission +#: view:recalculate.commission.wizard:0 +#: view:settled.wizard:0 +#: view:settlement:0 +#: selection:settlement,state:0 +msgid "Cancel" +msgstr "Cancel" + +#. module: sale_commission +#: help:sale.agent,partner_id:0 +msgid "Associated partner, is necessary for income invoices." +msgstr "Associated partner, is necessary for income invoices." + +#. module: sale_commission +#: view:sale.agent:0 +#: view:settlement.agent:0 +#: field:settlement.agent,settlement_id:0 +msgid "Settlement" +msgstr "Settlement" + +#. module: sale_commission +#: field:sale.agent,retention_id:0 +msgid "Applied retention" +msgstr "Applied retention" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_number:0 +msgid "Invoice no" +msgstr "Invoice no" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "INVOICE DATE" +msgstr "INVOICE DATE" + +#. module: sale_commission +#: code:addons/sale_commission/invoice.py:82 +#: code:addons/sale_commission/partner_agent.py:80 +#: code:addons/sale_commission/sale_order.py:67 +#, python-format +msgid "Fee installments!" +msgstr "Fee installments!" + +#. module: sale_commission +#: model:ir.actions.act_window,name:sale_commission.action_agents_settlement +msgid "Perform agents settlements" +msgstr "Perform agents settlements" + +#. module: sale_commission +#: view:settlement.agent:0 +msgid "Line details" +msgstr "Line details" + +#. module: sale_commission +#: code:addons/sale_commission/invoice.py:84 +#: code:addons/sale_commission/partner_agent.py:81 +#: code:addons/sale_commission/sale_order.py:68 +#, python-format +msgid "A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill." +msgstr "A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill." + +#. module: sale_commission +#: view:commission:0 +msgid "Definition of rates" +msgstr "Definition of rates" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_product_product +msgid "Product" +msgstr "Product" + +#. module: sale_commission +#: field:sale.agent,settlement:0 +msgid "Period settlement" +msgstr "Period settlement" + +#. module: sale_commission +#: field:sale.agent,customer:0 +msgid "Customer" +msgstr "Customer" + +#. module: sale_commission +#: view:settlement.line:0 +msgid "Settlement lines" +msgstr "Settlement lines" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_invoice_line_agent +msgid "invoice.line.agent" +msgstr "invoice.line.agent" + +#. module: sale_commission +#: field:commission,name:0 +msgid "Name" +msgstr "Name" + +#. module: sale_commission +#: field:account.invoice,country:0 +msgid "Country" +msgstr "Country" + +#. module: sale_commission +#: selection:commission,type:0 +msgid "By sections" +msgstr "By sections" + +#. module: sale_commission +#: field:settled.invoice.agent,invoice_date:0 +msgid "Invoice date" +msgstr "Invoice date" + +#. module: sale_commission +#: field:settlement.agent,lines:0 +msgid "Lines" +msgstr "Lines" + +#. module: sale_commission +#: selection:sale.agent,settlement:0 +msgid "Semiannual" +msgstr "Semiannual" + +#. module: sale_commission +#: model:ir.ui.menu,name:sale_commission.menu_commisions_report +msgid "Reports" +msgstr "Reports" + +#. module: sale_commission +#: field:invoice.line.agent,quantity:0 +#: field:settled.invoice.agent,settled_amount:0 +msgid "Settled amount" +msgstr "Settled amount" + +#. module: sale_commission +#: field:invoice.line.agent,commission_id:0 +#: field:res.partner.agent,commission_id:0 +#: field:sale.order.agent,commission_id:0 +msgid "Applied commission" +msgstr "Applied commission" + +#. module: sale_commission +#: field:invoice.line.agent,settled:0 +#: selection:settlement,state:0 +msgid "Settled" +msgstr "Settled" + +#. module: sale_commission +#: field:settlement,name:0 +msgid "Settlement period" +msgstr "Settlement period" + +#. module: sale_commission +#: field:commission,fix_qty:0 +msgid "Fix Percentage" +msgstr "Fix Percentage" + +#. module: sale_commission +#: report:settlement.report:0 +msgid "AMOUNT SETTLED" +msgstr "AMOUNT SETTLED" + +#. module: sale_commission +#: field:settled.invoice.wizard,product_id:0 +msgid "Product for account" +msgstr "Product for account" + +#. module: sale_commission +#: constraint:product.product:0 +msgid "Error: Invalid ean code" +msgstr "Error: Invalid ean code" + +#. module: sale_commission +#: field:settlement.line,invoice_line_id:0 +msgid "Settled invoice line" +msgstr "Settled invoice line" + +#. module: sale_commission +#: field:settlement,total:0 +#: field:settlement.agent,total:0 +msgid "Total" +msgstr "Total" + +#. module: sale_commission +#: model:ir.model,name:sale_commission.model_recalculate_commission_wizard +msgid "recalculate.commission.wizard" +msgstr "recalculate.commission.wizard" + diff --git a/sale_commission/invoice.py b/sale_commission/invoice.py new file mode 100644 index 000000000..34bb313c5 --- /dev/null +++ b/sale_commission/invoice.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +"""invoice agents""" + +from osv import fields, osv +from tools.translate import _ + +class invoice_line_agent(osv.osv): + """invoice agents""" + + _name = "invoice.line.agent" + + _columns = { + 'invoice_line_id':fields.many2one('account.invoice.line', 'Invoice Line', required=True, ondelete='cascade', help=''), + 'invoice_id':fields.related('invoice_line_id', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice'), + 'invoice_date':fields.related('invoice_id',type='date_invoice', readonly=True), + 'agent_id': fields.many2one('sale.agent', 'Agent', required=True, ondelete='cascade', help=''), + 'commission_id':fields.many2one('commission', 'Applied commission', required=True, ondelete='cascade', help=''), + 'settled':fields.boolean('Settled', readonly=True), + 'quantity':fields.float('Settled amount') + } + _defaults = { + 'settled': lambda *a: False, + 'quantity':lambda *a: 0 + } + + + def calculate_commission (self, cr, uid, ids): + for line_agent in self.browse(cr,uid,ids): + if line_agent.commission_id.type == 'fijo' and line_agent.commission_id.fix_qty: + quantity = line_agent.invoice_line_id.price_subtotal * (line_agent.commission_id.fix_qty / 100.0) + self.write(cr,uid,line_agent.id, {'quantity':quantity}) + + def onchange_agent_id(self, cr, uid, ids, agent_id): + """al cambiar el agente se le carga la comisión""" + result = {} + v = {} + if agent_id: + agent = self.pool.get('sale.agent').browse(cr, uid, agent_id) + v['commission_id'] = agent.commission.id + agent_line = self.browse(cr, uid, ids) + if agent_line: + v['quantity'] = agent_line[0].invoice_line_id.price_subtotal * (agent.commission.fix_qty / 100.0) + else: + v['quantity'] = 0 + + result['value'] = v + return result + + def onchange_commission_id(self, cr, uid, ids, agent_id, commission_id): + """alerta al usuario sobre la comisión elegida""" + result = {} + v = {} + if commission_id: + partner_commission = self.pool.get('commission').browse(cr, uid, commission_id) + agent_line = self.browse(cr, uid, ids) + v['quantity'] = agent_line[0].invoice_line_id.price_subtotal * (partner_commission.fix_qty / 100.0) + result['value']=v + if partner_commission.sections: + if agent_id: + agent = self.pool.get('sale.agent').browse(cr, uid, agent_id) + + if agent.commission.id != partner_commission.id: + result['warning'] = {} + result['warning']['title'] = _('Fee installments!') + #result['warning']['message'] = 'Se ha asignado una comisión por tramos que no coincide con la definida para el agente por defecto, por lo que estos tramos se aplicarán tan solo sobre esta factura.' + result['warning']['message'] = _('A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill.') + return result + + +invoice_line_agent() + +class account_invoice_line(osv.osv): + """Enlazamos las comisiones a la factura""" + + _inherit = "account.invoice.line" + + _columns = { + 'commission_ids': fields.one2many('invoice.line.agent', 'invoice_line_id', 'Commissions', help="Commissions asociated to invoice line."), + } + +account_invoice_line() + +class account_invoice(osv.osv): + """heredamos las facturas para añadirles el representante de venta""" + + _inherit = "account.invoice" + + _columns = { + 'agent_id': fields.many2one('sale.agent', 'Agent'), + 'agent_code':fields.related ('agent_id', 'code', readonly=True, type='char', string='Agent code' ), + 'country':fields.related ('address_invoice_id', 'country_id', readonly=True, type='many2one', string= 'Country', relation='res.country' ), + } + + def onchange_partner_id(self, cr, uid, ids, type, part, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): + """Al cambiar la empresa nos treamos el representante asociado a la empresa""" + res = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, part, date_invoice=date_invoice, payment_term=payment_term, partner_bank_id=partner_bank_id, company_id=company_id) + + if part and res.get('value', False): + partner = self.pool.get('res.partner').browse(cr, uid, part) + if partner.commission_ids: + res['value']['agent_id'] = partner.commission_ids[0].agent_id.id + + return res + + def _refund_cleanup_lines(self, cr, uid, lines): + """ugly function to map all fields of account.invoice.line when creates refund invoice""" + res = super(account_invoice, self)._refund_cleanup_lines(cr, uid, lines) + for line in res: + if 'commission_ids' in line[2]: + line[2]['commission_ids'] = [(6,0, line[2].get('commission_ids', [])) ] + + return res + +account_invoice() diff --git a/sale_commission/invoice_view.xml b/sale_commission/invoice_view.xml new file mode 100644 index 000000000..b9edc536b --- /dev/null +++ b/sale_commission/invoice_view.xml @@ -0,0 +1,94 @@ + + + + + + invoice.line.agent.tree + invoice.line.agent + tree + + + + + + + + + + + + invoice.line.agent.form + invoice.line.agent + form + +
+ + + + + + +
+ + + account.invoice.line.agent.form + account.invoice.line + form + + + + + + + + + + + + + + + + + + + + + account.invoice.supplier.form.add_agent_field + account.invoice + form + + + + + + + + + + account.invoice.form.add_agent_field + account.invoice + form + + + + + + + + + + account.invoice.form.add_code_country + account.invoice + tree + + + + + + + + + +
+
\ No newline at end of file diff --git a/sale_commission/partner.py b/sale_commission/partner.py new file mode 100644 index 000000000..6efbbb960 --- /dev/null +++ b/sale_commission/partner.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +"""añadimos algún campo relacionado con el intrastat""" + +from osv import fields, osv + +class res_partner(osv.osv): + """añadimos algún campo relacionado con elas comisiones""" + + _name = "res.partner" + _inherit = "res.partner" + _columns = { + 'commission_ids': fields.one2many('res.partner.agent', 'partner_id', 'Agents'), + 'agent': fields.boolean('Creditor/Agent', help="If you check this field will be available as creditor or agent.") + } + +res_partner() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/sale_commission/partner_agent.py b/sale_commission/partner_agent.py new file mode 100644 index 000000000..429d4fe58 --- /dev/null +++ b/sale_commission/partner_agent.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +"""objeto de comportamiento many2many que relaciona agentes o comerciales con partners""" + +from osv import fields, osv +from tools.translate import _ + +class res_partner_agent(osv.osv): + "objeto de comportamiento many2many que relaciona agentes o comerciales con partners" + _name = "res.partner.agent" + + def name_get(self, cr, uid, ids, context=None): + """devuelve como nombre del agente del partner el nombre del agente""" + if context is None: context = {} + res = [] + for obj in self.browse(cr, uid, ids): + res.append((obj.id, obj.agent_id.name)) + + return res + + def _get_partner_agents_to_update_from_sale_agents(self, cr, uid, ids, context=None): + """devuelve los ids de partner agents a actualizar desde el lanzamiento de un evento de actualización en agentes de ventas""" + if context is None: context = {} + result = [] + for agent_obj_id in self.browse(cr, uid, ids): + partner_agents_ids = self.pool.get('res.partner.agent').search(cr, uid, [('agent_id', '=', agent_obj_id.id)]) + result.extend(partner_agents_ids) + return result + + _columns = { + 'partner_id':fields.many2one('res.partner', 'Partner', required=True, ondelete='cascade', help='', select=1), + 'agent_id':fields.many2one('sale.agent', 'Agent', required=True, ondelete='cascade', help=''), + 'commission_id':fields.many2one('commission', 'Applied commission', required=True, ondelete='cascade', help=''), + 'type': fields.related('agent_id', 'type', type="selection", selection=[('asesor', 'Adviser'), ('comercial', 'Commercial')], readonly=True, + store={'sale.agent': (_get_partner_agents_to_update_from_sale_agents, ['type'], 10), + 'res.partner.agent': (lambda self, cr, uid, ids, c={}: ids, None, 20)}) + } + + def onchange_agent_id(self, cr, uid, ids, agent_id): + """al cambiar el agente cargamos sus comisión""" + result = {} + v = {} + if agent_id: + agent = self.pool.get('sale.agent').browse(cr, uid, agent_id) + v['commission_id'] = agent.commission.id + + result['value'] = v + return result + + def onchange_commission_id(self, cr, uid, ids, agent_id=False, commission_id=False): + """al cambiar la comisión comprobamos la selección""" + result = {} + + if commission_id: + partner_commission = self.pool.get('commission').browse(cr, uid, commission_id) + if partner_commission.sections: + if agent_id: + agent = self.pool.get('sale.agent').browse(cr, uid, agent_id) + if agent.commission.id != partner_commission.id: + result['warning'] = {} + result['warning']['title'] = _('Fee installments!') + result['warning']['message'] = _('A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill.') + + return result + + +res_partner_agent() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/sale_commission/partner_agent_view.xml b/sale_commission/partner_agent_view.xml new file mode 100644 index 000000000..c63687ddd --- /dev/null +++ b/sale_commission/partner_agent_view.xml @@ -0,0 +1,31 @@ + + + + + + partner.agent.comision.tree.inherit + res.partner.agent + tree + + + + + + + + + + + partner.agent.comision.form.inherit + res.partner.agent + form + +
+ + + + +
+ +
+
diff --git a/sale_commission/partner_view.xml b/sale_commission/partner_view.xml new file mode 100644 index 000000000..33f97193d --- /dev/null +++ b/sale_commission/partner_view.xml @@ -0,0 +1,39 @@ + + + + + + res.partner.form.add_agent + res.partner + form + + + + + + + + + + + res.partner.form.add_agents + res.partner + form + + + + + + + + + + + + + + + + + + diff --git a/sale_commission/product_view.xml b/sale_commission/product_view.xml new file mode 100644 index 000000000..217521f41 --- /dev/null +++ b/sale_commission/product_view.xml @@ -0,0 +1,18 @@ + + + + + + product.normal.form.exclude_commissions + product.product + + form + + + + + + + + + diff --git a/sale_commission/report/settlement_report.rml b/sale_commission/report/settlement_report.rml new file mode 100644 index 000000000..32f0c8009 --- /dev/null +++ b/sale_commission/report/settlement_report.rml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects, 's')]] +
+ [[ repeatIn(s.settlement_agent_id, 'agent') ]] + [[ agent.agent_id.partner_id and setLang(agent.agent_id.partner_id.lang) ]] + + + + SETTLEMENT: [[ (s.date_from and s.date_to) and formatLang(s.date_from, date=True) + '//' + formatLang(s.date_to, date=True) or s.name ]] + + + + + + + + + + AGENT: [[ agent.agent_id.name ]] + + + + + + + + + + INVOICE NO [[not agent.invoices and removeParentNode('blockTable')]] + + + INVOICE DATE + + + AMOUNT INVOICED + + + AMOUNT SETTLED + + + + +
+ [[repeatIn(agent.invoices,'invoice')]] + + + + [[ invoice.invoice_number or '' ]] + + + [[ invoice.invoice_date or '' ]] + + + [[ formatLang(invoice.invoice_amount or 0.0) ]] [[ invoice.currency_id and invoice.currency_id.code or '']] + + + [[ formatLang(invoice.settled_amount or 0.0) ]] [[ invoice.currency_id and invoice.currency_id.code or '']] + + + +
+ + + + TOTAL : [[ not agent.invoices and removeParentNode('blockTable') ]] + + + [[ formatLang(agent.total or 0.0) ]] + + + + +
+ +
+
\ No newline at end of file diff --git a/sale_commission/sale_order.py b/sale_commission/sale_order.py new file mode 100644 index 000000000..68574f7d9 --- /dev/null +++ b/sale_commission/sale_order.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +"""Modificamos las ventas para incluir el comportamiento de comisiones""" + +from osv import fields, osv +from tools.translate import _ + +class sale_order_agent(osv.osv): + _name = "sale.order.agent" + + def name_get(self, cr, uid, ids, context=None): + """devuelve como nombre del agente del partner el nombre del agente""" + if context is None: context = {} + res = [] + for obj in self.browse(cr, uid, ids): + res.append((obj.id, obj.agent_id.name)) + return res + + _columns = { + 'sale_id':fields.many2one('sale.order', 'Sale order', required=False, ondelete='cascade', help=''), + 'agent_id':fields.many2one('sale.agent', 'Agent', required=True, ondelete='cascade', help=''), + 'commission_id':fields.many2one('commission', 'Applied commission', required=True, ondelete='cascade', help=''), + } + + def onchange_agent_id(self, cr, uid, ids, agent_id): + """al cambiar el agente cargamos sus comisión""" + result = {} + v = {} + if agent_id: + agent = self.pool.get('sale.agent').browse(cr, uid, agent_id) + v['commission_id'] = agent.commission.id + + result['value'] = v + return result + + def onchange_commission_id(self, cr, uid, ids, agent_id=False, commission_id=False): + """al cambiar la comisión comprobamos la selección""" + result = {} + + if commission_id: + partner_commission = self.pool.get('commission').browse(cr, uid, commission_id) + if partner_commission.sections: + if agent_id: + agent = self.pool.get('sale.agent').browse(cr, uid, agent_id) + if agent.commission.id != partner_commission.id: + result['warning'] = {} + result['warning']['title'] = _('Fee installments!') + result['warning']['message'] = _('A commission has been assigned by sections that does not match that defined for the agent by default, so that these sections shall apply only on this bill.') + return result + +sale_order_agent() + +class sale_order(osv.osv): + """Modificamos las ventas para incluir el comportamiento de comisiones""" + + _inherit = "sale.order" + + _columns = { + 'sale_agent_ids':fields.one2many('sale.order.agent', 'sale_id', 'Agents', states={'draft': [('readonly', False)]}) + } + + def create(self, cr, uid, values, context=None): + """ + """ + res = super(sale_order, self).create(cr, uid, values, context=context) + if 'sale_agent_ids' in values: + for sale_order_agent in values['sale_agent_ids']: + self.pool.get('sale.order.agent').write(cr, uid, sale_order_agent[1], {'sale_id':res}) + return res + + def write(self, cr, uid, ids, values, context=None): + """ + """ + + if 'sale_agent_ids' in values: + for sale_order_agent in values['sale_agent_ids']: + for id in ids: + if sale_order_agent[2]: + sale_order_agent[2]['sale_id']=id + else: + self.pool.get('sale.order.agent').unlink(cr, uid, sale_order_agent[1]) + return super(sale_order, self).write(cr, uid, ids, values, context=context) + + def onchange_partner_id(self, cr, uid, ids, part): + """heredamos el evento de cambio del campo partner_id para actualizar el campo agent_id""" + sale_agent_ids=[] + res = super(sale_order, self).onchange_partner_id(cr, uid, ids, part) + if res.get('value', False) and part: + sale_order_agent = self.pool.get('sale.order.agent') + if ids: + sale_order_agent.unlink(cr, uid, sale_order_agent.search(cr, uid ,[('sale_id','=',ids)])) + partner = self.pool.get('res.partner').browse(cr, uid, part) + for partner_agent in partner.commission_ids: + vals={ + 'agent_id':partner_agent.agent_id.id, + 'commission_id':partner_agent.commission_id.id, + #'sale_id':ids + } + if ids: + for id in ids: + vals['sale_id']=id + sale_agent_id=sale_order_agent.create(cr, uid, vals) + sale_agent_ids.append(int(sale_agent_id)) + res['value']['sale_agent_ids'] = sale_agent_ids + return res + + + def action_ship_create(self, cr, uid, ids, context=None): + """extend this method to add agent_id to picking""" + res = super(sale_order, self).action_ship_create(cr, uid, ids, context=context) + + for order in self.browse(cr, uid, ids): + pickings = [x.id for x in order.picking_ids] + agents = [x.agent_id.id for x in order.sale_agent_ids] + if pickings and agents: + self.pool.get('stock.picking').write(cr, uid, pickings, {'agent_ids': [[6, 0, agents]] }) + return res + +sale_order() + + +class sale_order_line(osv.osv): + """Modificamos las lineas ventas para incluir las comisiones en las facturas creadas desde ventas""" + + _inherit = "sale.order.line" + + + def invoice_line_create(self, cr, uid, ids, context=None): + if context is None: + context = {} + + res = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context) + so_ref = self.browse(cr,uid,ids)[0].order_id + for so_agent_id in so_ref.sale_agent_ids: + inv_lines = self.pool.get('account.invoice.line').browse(cr, uid, res) + for inv_line in inv_lines: + if inv_line.product_id and inv_line.product_id.commission_exent != True: + vals = { + 'invoice_line_id': inv_line.id, + 'agent_id': so_agent_id.agent_id.id, + 'commission_id': so_agent_id.commission_id.id, + 'settled': False + } + line_agent_id=self.pool.get('invoice.line.agent').create(cr, uid, vals) + self.pool.get('invoice.line.agent').calculate_commission(cr, uid, [line_agent_id]) + return res + +sale_order_line() + + + diff --git a/sale_commission/sale_order_view.xml b/sale_commission/sale_order_view.xml new file mode 100644 index 000000000..957f90bae --- /dev/null +++ b/sale_commission/sale_order_view.xml @@ -0,0 +1,65 @@ + + + + + + + + sale.agent.order.inherit.form + sale.order + form + + + + + + + + + + + + + + + + + + + sale.agent.comision.tree + sale.order.agent + tree + + + + + + + + + + + sale.order.agent.comision.form. + sale.order.agent + form + +
+ + + + +
+ +
+
\ No newline at end of file diff --git a/sale_commission/saleagent.py b/sale_commission/saleagent.py new file mode 100644 index 000000000..727ce5a06 --- /dev/null +++ b/sale_commission/saleagent.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +from osv import fields, osv + + +class commission(osv.osv): + """Objeto comisión""" + + _name = "commission" + _description = "Commission" + _columns = { + 'name': fields.char('Name', size=64, required=True), + 'type': fields.selection((('fijo', 'Fix percentage'), ('tramos', 'By sections')), 'Type', required=True), + 'fix_qty': fields.float('Fix Percentage'), + 'sections': fields.one2many('commission.section', 'commission_id', 'Sections') + } + _defaults = { + 'type' : lambda *a: 'fijo', + } + + def calcula_tramos(self, cr, uid, ids, base): + commission = self.browse(cr, uid, ids)[0] + #Cálculo de tramos + for section in commission.sections: + if base >= section.commission_from and (base < section.commission_until or section.commission_until == 0): + res = base * section.percent / 100.0 + return res + return 0.0 + +commission() + + +class commission_section(osv.osv): + """periodo de las comisiones""" + + _name = "commission.section" + _description = "Commission section" + _columns = { + 'commission_from': fields.float('From'), + 'commission_until': fields.float('Until'), + 'percent': fields.float('Percent'), + 'commission_id': fields.many2one('commission', 'Commission') + + } + +commission_section() + +class sale_agent(osv.osv): + """Agente de ventas""" + + _name = "sale.agent" + _description = "Sale agent" + + _columns = { + 'name': fields.char('Saleagent Name', size=125, required=True), + 'type': fields.selection((('asesor', 'Adviser'), ('comercial', 'Commercial')), 'Type', required=True), + 'partner_id': fields.many2one('res.partner', 'Partner', ondelete='cascade', help='Associated partner, is necessary for income invoices.'), + 'code':fields.related ('partner_id','ref', string='Code', readonly=True, type='char', help='Se obtiene del código de la empresa relacionada'), + 'employee_id': fields.many2one('hr.employee', 'Associated Employee', help='Employee associated to agent, is necessary for set an employee to settle commissions in wage.'), + 'customer': fields.one2many('res.partner.agent', 'agent_id', 'Customer', readonly=True), + 'commission': fields.many2one('commission', 'Commission by default', required=True), + 'settlement': fields.selection((('m', 'Monthly'),('t', 'Quarterly'),('s', 'Semiannual'),('a', 'Annual')), 'Period settlement', required=True), + 'active': fields.boolean('Active'), + 'retention_id': fields.many2one ('account.tax', 'Applied retention'), + 'settlement_ids': fields.one2many ('settlement.agent', 'agent_id', 'Settlements executed', readonly=True) + } + _defaults = { + 'active': lambda *a: True, + 'type' : lambda *a: 'asesor', + } + + def calcula_tramos (self, cr, uid, ids, base): + """calcula los tramos por factura""" + agente = self.browse(cr, uid, ids)[0] + return agente.commission.calcula_tramos(base) + + +sale_agent()# + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/sale_commission/saleagent_demo.xml b/sale_commission/saleagent_demo.xml new file mode 100644 index 000000000..3b8fcfcdb --- /dev/null +++ b/sale_commission/saleagent_demo.xml @@ -0,0 +1,59 @@ + + + + + Pritesh Sales Agent + + + + Ahmedabad + Defalt Agent Pritesh + 380007 + M. + + 56 Beijing street + default + + + + + + Pritesh Sales Agent + + + + + + Eiffel pvt ltd + + + + + Ahmedabad + Eiffel India + 380007 + M. + + Wall Street 2 + default + + + + + Tiny Belgium + + + + + Belgium + Tiny Belgium + 2457 + M. + + Belgium Gao + default + + + + + diff --git a/sale_commission/saleagent_view.xml b/sale_commission/saleagent_view.xml new file mode 100644 index 000000000..c92bc216d --- /dev/null +++ b/sale_commission/saleagent_view.xml @@ -0,0 +1,152 @@ + + + + + + + saleagent.info.tree + sale.agent + tree + + + + + + + + + + + + + + saleagent.info.form + sale.agent + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + commission.sale.agent.search + sale.agent + search + + + + + + + + + + + + + + + + + + + + + + + Sale agents + ir.actions.act_window + sale.agent + form + tree,form + + + + + + + + commission.tree + commission + tree + + + + + + + + + + Commissions + commission + form + +
+ + + + + + + + + + + + + + + + +
+ + + + Commission Types + ir.actions.act_window + commission + form + tree,form + + + + + + + + +
+
diff --git a/sale_commission/security/ir.model.access.csv b/sale_commission/security/ir.model.access.csv new file mode 100644 index 000000000..c412ecfe5 --- /dev/null +++ b/sale_commission/security/ir.model.access.csv @@ -0,0 +1,28 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_invoice_line_agent_fin_invoice","access_invoice_line_agent_fin_invoice","model_invoice_line_agent","account.group_account_invoice",1,1,1,1 +"access_invoice_line_agent_fin_manager","access_invoice_line_agent_fin_manager","model_invoice_line_agent","account.group_account_manager",1,1,1,1 +"access_invoice_line_agent_fin_accountant","access_invoice_line_agent_fin_accountant","model_invoice_line_agent","account.group_account_user",1,0,0,0 +"access_settlement_fin_manager","access_settlement_fin_manager","model_settlement","account.group_account_manager",1,1,1,1 +"access_settlement_salesman","access_settlement_salesman","model_settlement","base.group_sale_manager",1,0,0,0 +"access_settlement_sale_manager","access_settlement_sales_manager","model_settlement","base.group_sale_manager",1,0,0,0 +"access_settlement_line_fin_manager","access_settlement_line_fin_manager","model_settlement_line","account.group_account_manager",1,1,1,1 +"access_settlement_line_salesman","access_settlement_line_salesman","model_settlement_line","base.group_sale_salesman",1,0,0,0 +"access_settlement_line_sale_manager","access_settlement_line_sales_manager","model_settlement_line","base.group_sale_manager",1,0,0,0 +"access_settlement_agent_fin_manager","access_settlement_agent_fin_manager","model_settlement_agent","account.group_account_manager",1,1,1,1 +"access_commission_salesman","access_commission_salesman","model_commission","base.group_sale_salesman",1,0,0,0 +"access_commission_sale_manager","access_commission_sale_manager","model_commission","base.group_sale_manager",1,1,1,1 +"access_commission_partner_manager","access_commission_partner_manager","model_commission","base.group_partner_manager",1,0,0,0 +"access_commission_section_salesman","access_commission_section_salesman","model_commission_section","base.group_sale_salesman",1,0,0,0 +"access_commission_section_sale_manager","access_commission_section_sale_manager","model_commission_section","base.group_sale_manager",1,1,1,1 +"access_commission_section_partner_manager","access_commission_section_partner_manager","model_commission_section","base.group_partner_manager",1,0,0,0 +"access_sale_agent_salesman","access_sale_agent_salesman","model_sale_agent","base.group_sale_salesman",1,0,0,0 +"access_sale_agent_sale_manager","access_sale_agent_sale_manager","model_sale_agent","base.group_sale_manager",1,1,1,1 +"access_sale_agent_partner_manager","access_sale_agent_partner_manager","model_sale_agent","base.group_partner_manager",1,0,0,0 +"access_sale_order_agent_salesman","access_sale_order_agent_salesman","model_sale_order_agent","base.group_sale_salesman",1,0,0,0 +"access_sale_order_agent_sale_manager","access_sale_order_agent_sale_manager","model_sale_order_agent","base.group_sale_manager",1,1,1,1 +"access_res_partner_agent_salesman","access_res_partner_agent_salesman","model_res_partner_agent","base.group_sale_salesman",1,0,0,0 +"access_res_partner_agent_sale_manager","access_sale_agent_res_partner_manager","model_res_partner_agent","base.group_sale_manager",1,1,1,1 +"access_res_partner_agent_partner_manager","access_res_partner_agent_partner_manager","model_res_partner_agent","base.group_partner_manager",1,0,0,0 +"access_settled_invoice_agent_salesman","access_settled_invoice_agent_salesman","model_settled_invoice_agent","base.group_sale_salesman",1,0,0,0 +"access_settled_invoice_agent_sale_manager","access_settled_invoice_agent_sale_manager","model_settled_invoice_agent","base.group_sale_manager",1,1,1,1 +"access_settled_invoice_agent_partner_manager","access_settled_invoice_agent_partner_manager","model_settled_invoice_agent","base.group_partner_manager",1,0,0,0 diff --git a/sale_commission/settled.py b/sale_commission/settled.py new file mode 100644 index 000000000..26ac86aab --- /dev/null +++ b/sale_commission/settled.py @@ -0,0 +1,488 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 Pexego Sistemas Informáticos (). All Rights Reserved +# $Id$ +# +# 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 . +# +############################################################################## + +"""Objetos sobre las liquidación""" + +from osv import fields, osv +from tools.translate import _ +import time +import tools + +class settled_wizard (osv.osv_memory): + """settled.wizard""" + + _name = 'settled.wizard' + _columns = { + #'settlement':fields.selection((('m', 'Monthly'),('t', 'Quarterly'),('s', 'Semiannual'),('a', 'Annual')), 'Settlement period', required=True), + 'date_from':fields.date ('From',required=True), + 'date_to':fields.date ('To',required=True), + + } + _defaults = { + } + + def settlement_exec(self, cr, uid, ids, context=None): + """se ejecuta correctamente desde dos.""" + for o in self.browse(cr, uid, ids, context=context): + + pool_liq = self.pool.get('settlement') + liq_id = pool_liq.search(cr, uid, [('date_to', '>=', o.date_from)]) + + vals={ + 'name': o.date_from+ " // " + o.date_to, + 'date_from':o.date_from, + 'date_to':o.date_to + } + liq_id = pool_liq.create(cr, uid, vals) + pool_liq.calcula(cr, uid, liq_id, context['active_ids'], o.date_from, o.date_to) + + + return { + 'type': 'ir.actions.act_window_close', + } + + + def action_cancel(self, cr, uid, ids, conect=None): + """CANCEL LIQUIDACIÓN""" + return { + 'type': 'ir.actions.act_window_close', + } + + + +settled_wizard() + + +class recalculate_commision_wizard (osv.osv_memory): + """settled.wizard""" + + _name = 'recalculate.commission.wizard' + _columns = { + 'date_from':fields.date ('From',required=True), + 'date_to':fields.date ('To',required=True), + + } + _defaults = { + } + + def recalculate_exec(self, cr, uid, ids, context=None): + """se ejecuta correctamente desde dos.""" + user = self.pool.get('res.users').browse(cr, uid, uid) + + for o in self.browse(cr, uid, ids, context=context): + + sql = 'SELECT invoice_line_agent.id FROM account_invoice_line ' \ + 'INNER JOIN invoice_line_agent ON invoice_line_agent.invoice_line_id=account_invoice_line.id ' \ + 'INNER JOIN account_invoice ON account_invoice_line.invoice_id = account_invoice.id ' \ + 'WHERE invoice_line_agent.agent_id in (' + ",".join(map(str, context['active_ids'])) + ') AND invoice_line_agent.settled=False ' \ + 'AND account_invoice.state<>\'draft\' AND account_invoice.type=\'out_invoice\''\ + 'AND account_invoice.date_invoice >= \'' + o.date_from + '\' AND account_invoice.date_invoice <= \'' + o.date_to +'\''\ + ' AND account_invoice.company_id = ' + str(user.company_id.id) + + cr.execute(sql) + res = cr.fetchall() + inv_line_agent_ids = [x[0] for x in res] + + self.pool.get ('invoice.line.agent').calculate_commission( cr, uid, inv_line_agent_ids) + + + return { + 'type': 'ir.actions.act_window_close', + } + + + def action_cancel(self, cr, uid, ids, conect=None): + """CANCEL CALCULATE""" + return { + 'type': 'ir.actions.act_window_close', + } + + + +recalculate_commision_wizard() + + + + +class settlement (osv.osv): + """Objeto Liquidación""" + + _name = 'settlement' + _columns = { + 'name': fields.char('Settlement period', size=64, required=True, readonly=True), + 'total': fields.float('Total', readonly=True), + 'date_from':fields.date('From'), + 'date_to':fields.date('To'), + 'settlement_agent_id': fields.one2many('settlement.agent', 'settlement_id', 'Settlement agents', readonly=True), + 'date': fields.datetime('Created Date', required=True), + 'state': fields.selection([('invoiced', 'Invoiced'),('settled', 'Settled'), ('cancel', 'Cancel')], 'State', required=True, readonly=True) + } + _defaults = { + 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), + 'state': lambda *a: 'settled' + } + + def action_invoice_create(self, cursor, user, ids, journal_id, product_id, context=None): + + agents_pool=self.pool.get('settlement.agent') + res={} + for settlement in self.browse(cursor, user, ids, context=context): + settlement_agent_ids = map(lambda x: x.id, settlement.settlement_agent_id) + invoices_agent = agents_pool.action_invoice_create(cursor, user, settlement_agent_ids, journal_id, product_id) + + res[settlement.id] = invoices_agent.values() + return res + + + + + def calcula(self, cr, uid, ids, agent_ids, date_from, date_to): + """genera una entrada de liquidación por agente""" + + # Busca todas las líneas de liquidación facturadas en un período + pool_agent = self.pool.get('sale.agent') + agents = pool_agent.browse(cr, uid, agent_ids) + total = 0 + for agent in agents: + # genera una entrada de liquidación por agente + liq_agent_id = self.pool.get('settlement.agent').create(cr, uid, {'agent_id': agent.id, 'settlement_id': ids}) + self.pool.get('settlement.agent').calcula(cr, uid, liq_agent_id, date_from, date_to) + liq_agent = self.pool.get('settlement.agent').browse(cr, uid, liq_agent_id) + total = total + liq_agent.total + + return self.write (cr, uid, ids, {'total': total}) + + def action_cancel(self, cr, uid, ids, context=None): + """Cancela la liquidación""" + if context is None: context={} + for settle in self.browse(cr, uid, ids): + for settle_line in settle.settlement_agent_id: + for line in settle_line.lines: + commission_ids = line.invoice_line_id and [x.id for x in line.invoice_line_id.commission_ids] or [] + if commission_ids: + self.pool.get('invoice.line.agent').write(cr, uid, commission_ids, {'settled': False, 'quantity': 0.0}) + + return self.write(cr, uid, ids, {'state': 'cancel'}) + + def unlink(self, cr, uid, ids, context=None): + """permite borrar liquidaciones canceladas""" + for settle in self.browse(cr, uid, ids): + if settle.state != 'cancel': + raise osv.except_osv(_('Error!'), _("You can\'t delete it, if it isn't in cancel state.")) + + return super(settlement, self).unlink(cr, uid, ids, context=context) + +settlement() + + +class settlement_agent (osv.osv): + """Liquidaciones de Agentes""" + + _name = 'settlement.agent' + + def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id): + '''Call after the creation of the invoice line''' + return + + def _get_address_invoice(self, cursor, user, settlement): + '''Return {'contact': address, 'invoice': address} for invoice''' + partner_obj = self.pool.get('res.partner') + partner = settlement.agent_id.partner_id + + return partner_obj.address_get(cursor, user, [partner.id], + ['contact', 'invoice']) + + def _invoice_hook(self, cursor, user, picking, invoice_id): + '''Call after the creation of the invoice''' + return + + + _columns = { + 'agent_id': fields.many2one('sale.agent', 'Agent', required=True, select=1), + 'total_per': fields.float('Total percentages', readonly=True), + 'total_sections': fields.float('Total sections', readonly=True), + 'total': fields.float('Total', readonly=True), + 'lines': fields.one2many('settlement.line', 'settlement_agent_id', 'Lines', readonly=True), + 'invoices': fields.one2many('settled.invoice.agent', 'settlement_agent_id', 'Invoices', readonly=True), + 'settlement_id': fields.many2one('settlement', 'Settlement', required=True, ondelete="cascade") + } + + + + def get_currency_id(self, cursor, user, picking): + return False + + + def action_invoice_create(self, cursor, user, ids, journal_id, product_id, context=None): + '''Return ids of created invoices for the settlements''' + + invoice_obj = self.pool.get('account.invoice') + invoice_line_obj = self.pool.get('account.invoice.line') + invoices_group = {} + res = {} + + for settlement in self.browse(cursor, user, ids, context=context): + + payment_term_id = False + partner = settlement.agent_id and settlement.agent_id.partner_id + if not partner: + raise osv.except_osv(_('Error, partner fail !'), + _('Agent to settle hasn\'t assigned partner.')) + + #El tipo es de facura de proveedor + account_id = partner.property_account_payable.id + + address_contact_id, address_invoice_id = \ + self._get_address_invoice(cursor, user, settlement).values() + + # No se agrupa + + invoice_vals = { + 'name': settlement.settlement_id.name, + 'origin': (settlement.settlement_id.name or '') , + 'type': 'in_invoice', + 'account_id': account_id, + 'partner_id': partner.id, + 'address_invoice_id': address_invoice_id, + 'address_contact_id': address_contact_id, + #'comment': comment, + 'payment_term': payment_term_id, + 'fiscal_position': partner.property_account_position.id + } + cur_id = self.get_currency_id(cursor, user, settlement) + if cur_id: + invoice_vals['currency_id'] = cur_id + if journal_id: + invoice_vals['journal_id'] = journal_id + invoice_id = invoice_obj.create(cursor, user, invoice_vals, + context=context) + + + res[settlement.id] = invoice_id + # El producto se selecciona en el wizard correspondiente + product = self.pool.get('product.product').browse(cursor,user,product_id) + account_id = product.product_tmpl_id.property_account_expense.id + if not account_id: + account_id = product.categ_id.property_account_expense_categ.id + # Cálculo de los impuestos a aplicar + + taxes = product.supplier_taxes_id + + # se añade la retención seleccionada de la ficha del agente + if settlement.agent_id and settlement.agent_id.retention_id: + taxes.append(settlement.agent_id.retention_id) + if settlement.agent_id and settlement.agent_id.partner_id: + tax_ids = self.pool.get('account.fiscal.position').map_tax( + cursor, + user, + settlement.agent_id.partner_id.property_account_position, + taxes + ) + else: + tax_ids = map(lambda x: x.id, taxes) + for invoice in settlement.invoices: + origin = invoice.invoice_number + name = invoice.invoice_number + price_unit = invoice.settled_amount + discount = 0 + + #set UoS if it's a sale and the picking doesn't have one + uos_id = False + + account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner.property_account_position, account_id) + invoice_line_id = invoice_line_obj.create(cursor, user, { + 'name': name, + 'origin': origin, + 'invoice_id': invoice_id, + 'uos_id': uos_id, + 'product_id': product.id, + 'account_id': account_id, + 'price_unit': price_unit, + 'discount': discount, + 'quantity': 1, + 'invoice_line_tax_id': [(6, 0, tax_ids)], + #'account_analytic_id': account_analytic_id, + }, context=context) + self._invoice_line_hook(cursor, user, invoice, invoice_line_id) + + invoice_obj.button_compute(cursor, user, [invoice_id], context=context, + set_total=(type in ('in_invoice', 'in_refund'))) + self._invoice_hook(cursor, user, settlement, invoice_id) + return res + + def calcula(self, cr, uid, ids, date_from, date_to): + set_agent = self.browse(cr, uid, ids) + user = self.pool.get('res.users').browse(cr, uid, uid) + # Recalculamos todas las lineas sujetas a comision + + sql = 'SELECT invoice_line_agent.id FROM account_invoice_line ' \ + 'INNER JOIN invoice_line_agent ON invoice_line_agent.invoice_line_id=account_invoice_line.id ' \ + 'INNER JOIN account_invoice ON account_invoice_line.invoice_id = account_invoice.id ' \ + 'WHERE invoice_line_agent.agent_id=' + str(set_agent.agent_id.id) + ' AND invoice_line_agent.settled=True ' \ + 'AND account_invoice.state<>\'draft\' AND account_invoice.type=\'out_invoice\''\ + 'AND account_invoice.date_invoice >= \'' + date_from + '\' AND account_invoice.date_invoice <= \'' + date_to +'\''\ + ' AND account_invoice.company_id = ' + str(user.company_id.id) + + cr.execute(sql) + res = cr.fetchall() + inv_line_agent_ids = [x[0] for x in res] + + self.pool.get ('invoice.line.agent').calculate_commission( cr, uid, inv_line_agent_ids) + + sql = 'SELECT account_invoice_line.id FROM account_invoice_line ' \ + 'INNER JOIN invoice_line_agent ON invoice_line_agent.invoice_line_id=account_invoice_line.id ' \ + 'INNER JOIN account_invoice ON account_invoice_line.invoice_id = account_invoice.id ' \ + 'WHERE invoice_line_agent.agent_id=' + str(set_agent.agent_id.id) + ' AND invoice_line_agent.settled=False ' \ + 'AND account_invoice.state<>\'draft\' AND account_invoice.type=\'out_invoice\''\ + 'AND account_invoice.date_invoice >= \'' + date_from + '\' AND account_invoice.date_invoice <= \'' + date_to +'\''\ + ' AND account_invoice.company_id = ' + str(user.company_id.id) + + cr.execute(sql) + res = cr.fetchall() + inv_line_ids = [x[0] for x in res] + total_per = 0 + total_sections = 0 + total = 0 + sections = {} + for inv_line_id in inv_line_ids: + linea_id = self.pool.get('settlement.line').create(cr, uid, {'invoice_line_id': inv_line_id, 'settlement_agent_id': ids}) + self.pool.get('settlement.line').calcula(cr, uid, linea_id) + + line = self.pool.get('settlement.line').browse(cr, uid, linea_id) + + # Marca la comision en la factura como liquidada y establece la cantidad + # Si es por tramos la cantidad será cero, pero se reflejará sobre el tramo del Agente + + + if line.commission_id.type == "fijo": + total_per = total_per + line.commission + inv_ag_ids = self.pool.get('invoice.line.agent').search(cr, uid, [('invoice_line_id', '=', inv_line_id), ('agent_id', '=', set_agent.agent_id.id)]) + self.pool.get('invoice.line.agent').write(cr, uid, inv_ag_ids, {'settled': True, 'quantity': line.commission}) + if line.commission_id.type == "tramos": + if line.invoice_line_id.product_id.commission_exent != True: + # Hacemos un agregado de la base de cálculo agrupándolo por las distintas comisiones en tramos que tenga el agente asignadas + if line.commission_id.id in sections: + sections[line.commission_id.id]['base'] = sections[line.commission_id.id]['base'] + line.invoice_line_id.price_subtotal + sections[line.commission_id.id]['lines'].append(line) # Añade la línea de la que se añade esta base para el cálculo por tramos + else: + sections[line.commission_id.id] = {'type': line.commission_id, 'base':line.invoice_line_id.price_subtotal, 'lines':[line]} + + #Tramos para cada tipo de comisión creados + + for tramo in sections: + #Cálculo de la comisión para cada tramo + sections[tramo].update({'commission': sections[tramo]['type'].calcula_tramos(sections[tramo]['base'])}) + total_sections = total_sections+sections[tramo]['commission'] + # reparto de la comisión para cada linea + + for linea_tramo in sections[tramo]['lines']: + com_por_linea = sections[tramo]['commission']* (linea_tramo.invoice_line_id.price_subtotal/sections[tramo]['base']) + linea_tramo.write({'commission':com_por_linea}) + inv_ag_ids = self.pool.get('invoice.line.agent').search(cr, uid, [('invoice_line_id', '=', linea_tramo.invoice_line_id.id), ('agent_id', '=', set_agent.agent_id.id)]) + self.pool.get('invoice.line.agent').write(cr, uid, inv_ag_ids, {'settled': True, 'quantity': com_por_linea}) + + + total = total_per + total_sections + self.write (cr, uid, ids, {'total_per': total_per, 'total_sections': total_sections, 'total': total}) + +settlement_agent() + +class settlement_line (osv.osv): + """Línea de las liquidaciones de los agentes + Una línea por línea de factura + """ + + _name = 'settlement.line' + _columns = { + 'invoice_id':fields.related('invoice_line_id', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice'), + 'invoice_date':fields.related('invoice_id','date_invoice', type='date', readonly=True, string='Invoice Date'), + 'settlement_agent_id': fields.many2one('settlement.agent', 'Settlement agent', required=True, select=1, ondelete="cascade"), + 'invoice_line_id': fields.many2one('account.invoice.line', 'Settled invoice line', required=True), + 'amount': fields.float('Invoice line amount', readonly=True), + 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), + 'commission_id': fields.many2one('commission', 'Commission', readonly=True), + 'commission': fields.float('Quantity', readonly=True), + } + + _defaults = { + 'currency_id': lambda self,cr,uid,context: self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id + } + + def calcula(self, cr, uid, ids): + line = self.browse(cr, uid, ids) + amount=0 + user = self.pool.get('res.users').browse(cr, uid, uid) + + for commission in line.invoice_line_id.commission_ids: # Recorre los agentes y condiciones asignados a la factura + if commission.agent_id.id == line.settlement_agent_id.agent_id.id: # selecciona el asignado al agente para el que está liquidando + commission_app = commission.commission_id # Obtiene el objeto + invoice_line_amount = line.invoice_line_id.price_subtotal + if commission_app.type=="fijo": + commission_per = commission_app.fix_qty + amount = amount + line.invoice_line_id.price_subtotal * float(commission_per) / 100 + + elif commission_app.type=="tramos": + invoice_line_amount = 0 + amount = 0 + + cc_amount_subtotal = line.invoice_id.currency_id.id != user.company_id.currency_id.id and self.pool.get('res.currency').compute(cr, uid, line.invoice_id.currency_id.id, user.company_id.currency_id.id, invoice_line_amount, round = False) or invoice_line_amount + cc_commission_amount = line.invoice_id.currency_id.id != user.company_id.currency_id.id and self.pool.get('res.currency').compute(cr, uid, line.invoice_id.currency_id.id, user.company_id.currency_id.id, amount, round = False) or amount + + self.write(cr, uid, ids, {'amount': cc_amount_subtotal, 'commission_id': commission_app.id, 'commission': cc_commission_amount, 'currency_id': user.company_id.currency_id.id}) + +settlement_line() + + + +class settled_invoice_agent(osv.osv): + _name = "settled.invoice.agent" + _description = "Resumen de facturas liquidadas" + _auto = False + _columns = { + 'agent_id':fields.many2one('sale.agent', 'Agent', readonly=True, select=1), + 'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True, select=1), + 'settlement_agent_id': fields.many2one('settlement.agent', 'Agent settl.', readonly=True, select=1, ondelete="cascade"), + 'invoice_number':fields.related('invoice_id', 'number', type='char', string='Invoice no', readonly=True ), + 'invoice_date':fields.related('invoice_id', 'date_invoice', string ='Invoice date', type='date', readonly=True, select=1 ), + 'invoice_amount':fields.float( 'Amount assigned in invoice', readonly=True), + 'settled_amount':fields.float('Settled amount', readonly=True), + #'currency_id': fields.many2one('res.currency', 'Currency', readonly=True, select="1") + } + + + def init(self, cr): + tools.sql.drop_view_if_exists(cr, "settled_invoice_agent") + + cr.execute(""" + create or replace view settled_invoice_agent as ( + SELECT (account_invoice_line.invoice_id*10000+settlement_agent.agent_id) as id, settlement_agent.id as settlement_agent_id, + account_invoice_line.invoice_id as invoice_id, settlement_agent.agent_id as agent_id, + sum(settlement_line.amount) as invoice_amount, + sum(settlement_line.commission) as settled_amount + FROM settlement_agent + INNER JOIN settlement_line ON settlement_agent.id = settlement_line.settlement_agent_id + INNER JOIN account_invoice_line ON account_invoice_line.id = settlement_line.invoice_line_id + GROUP BY account_invoice_line.invoice_id, settlement_agent.agent_id, settlement_agent.id + + )""") + +settled_invoice_agent() diff --git a/sale_commission/settled_view.xml b/sale_commission/settled_view.xml new file mode 100644 index 000000000..a08fd9fcf --- /dev/null +++ b/sale_commission/settled_view.xml @@ -0,0 +1,347 @@ + + + + + + Select period to settle + settled.wizard + form + +
+ + + + + + -
+ + -
-
+ diff --git a/sale_commission/views/product_template_view.xml b/sale_commission/views/product_template_view.xml index 653aae545..75503befd 100644 --- a/sale_commission/views/product_template_view.xml +++ b/sale_commission/views/product_template_view.xml @@ -1,20 +1,17 @@ - - + + + product.template.common.form.commission + product.template + + + + + - - product.template.common.form.commission - product.template - - - - - - - - + diff --git a/sale_commission/views/res_partner_view.xml b/sale_commission/views/res_partner_view.xml index e97f5d653..f7a73401a 100644 --- a/sale_commission/views/res_partner_view.xml +++ b/sale_commission/views/res_partner_view.xml @@ -1,79 +1,76 @@ - - - - - res.partner.form.agent - res.partner - - - - - - - - - - - - + + + res.partner.form.agent + res.partner + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + - - + + + - - res.partner.select - res.partner - - - - - - - + + res.partner.select + res.partner + + + + + + + - - Agents - ir.actions.act_window - res.partner - form - kanban,tree,form - {"search_default_agent": 1, 'default_agent': 1, 'default_customer': 0, 'default_supplier': 1} - - + + Agents + ir.actions.act_window + res.partner + form + kanban,tree,form + {"search_default_agent": 1, 'default_agent': 1, 'default_customer': 0, 'default_supplier': 1} + + - + - - + diff --git a/sale_commission/views/sale_commission_view.xml b/sale_commission/views/sale_commission_view.xml index d966d3a57..ee7a969df 100644 --- a/sale_commission/views/sale_commission_view.xml +++ b/sale_commission/views/sale_commission_view.xml @@ -1,69 +1,69 @@ - - + + + Sales commissions tree + sale.commission + + + + + + + + - - Sales commissions tree - sale.commission - - - - - - - - - - - Sales commissions form - sale.commission - - - - - - - - - - - - + + Sales commissions form + sale.commission + + + + + + + + + + + - + + + - - - - - - - + attrs="{'invisible': [('commission_type', '!=', 'fixed')], 'required': [('commission_type', '=', 'fixed')]}" /> - - - + + + + + + + + + + + + - - Commission types - ir.actions.act_window - sale.commission - form - tree,form - + + Commission types + ir.actions.act_window + sale.commission + form + tree,form + - + - + - - + diff --git a/sale_commission/views/sale_order_view.xml b/sale_commission/views/sale_order_view.xml index 50d3f6d32..6fdde56da 100644 --- a/sale_commission/views/sale_order_view.xml +++ b/sale_commission/views/sale_order_view.xml @@ -1,43 +1,47 @@ - - + - - sale.agent.order.inherit.form - sale.order - - - - {'partner_id': partner_id} - - - - - - - - - - - - + + sale.agent.order.inherit.form + sale.order + + + + {'partner_id': partner_id} - - - - sale.order.line.agent.tree - sale.order.line.agent - - - - - + + + + + + + + + + + + + - + + + + + + + + sale.order.line.agent.tree + sale.order.line.agent + + + + + + + - - + diff --git a/sale_commission/views/settlement_view.xml b/sale_commission/views/settlement_view.xml index c24422e44..7cb76518c 100644 --- a/sale_commission/views/settlement_view.xml +++ b/sale_commission/views/settlement_view.xml @@ -1,151 +1,149 @@ - - + + + Settlements tree + sale.commission.settlement + + + + + + + + + + - - Settlements tree - sale.commission.settlement - - - - - - - - - - - - - sale.commission.settlement.search - sale.commission.settlement - - - - - - - - - - - - - - + + sale.commission.settlement.search + sale.commission.settlement + + + + + + + + + + + + + + - - Settlements - sale.commission.settlement - -
-
-
+ + Settlements + sale.commission.settlement + + +
+
+ - - - - - - - - - - - - - - - - - - - - + + - - + + + + - - -
+ + + + + + + + + + + + + + + + +
+
+ + + Settlement lines + sale.commission.settlement.line + + + + + + + + + + + - - Settlement lines - sale.commission.settlement.line - - - - - - - - - - - + + sale.commission.settlement.line.search + sale.commission.settlement.line + + + + + + + + + + + + + + - - sale.commission.settlement.line.search - sale.commission.settlement.line - - - - - - - - - - - - - - + + sale.commission.settlement.line.graph + sale.commission.settlement.line + + + + + + + + - - sale.commission.settlement.line.graph - sale.commission.settlement.line - - - - - - - - + + Settlments + ir.actions.act_window + sale.commission.settlement + form + tree,form + - - Agents settlements analysis - ir.actions.act_window - sale.commission.settlement.line - form - graph - + - -
-
+ diff --git a/sale_commission/wizard/__init__.py b/sale_commission/wizard/__init__.py index 33e5fb0db..c402b61d9 100644 --- a/sale_commission/wizard/__init__.py +++ b/sale_commission/wizard/__init__.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# © 2011 Pexego Sistemas Informáticos () -# © 2015 Pedro M. Baeza () -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import wizard_invoice from . import wizard_settle diff --git a/sale_commission/wizard/wizard_invoice.py b/sale_commission/wizard/wizard_invoice.py index 2638d55ee..557f10450 100644 --- a/sale_commission/wizard/wizard_invoice.py +++ b/sale_commission/wizard/wizard_invoice.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- -# © 2011 Pexego Sistemas Informáticos () -# © 2015 Pedro M. Baeza () -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from openerp import models, fields, api, _ +from odoo import models, fields, api, _ class SaleCommissionMakeInvoice(models.TransientModel): @@ -27,11 +24,6 @@ def _default_from_settlement(self): comodel_name='account.journal', required=True, domain="[('type', '=', 'purchase')]", default=_default_journal) - refund_journal = fields.Many2one( - string='Refund Journal', - comodel_name='account.journal', required=True, - domain="[('type', '=', 'purchase_refund')]", - default=_default_refund_journal) product = fields.Many2one( string='Product for invoicing', comodel_name='product.product', required=True) @@ -41,7 +33,6 @@ def _default_from_settlement(self): column1='wizard_id', column2='settlement_id', domain="[('state', '=', 'settled')]", default=_default_settlements) - from_settlement = fields.Boolean(default=_default_from_settlement) date = fields.Date() @@ -52,7 +43,7 @@ def button_create(self): self.settlements = self.env['sale.commission.settlement'].search( [('state', '=', 'settled'), ('agent_type', '=', 'agent')]) self.settlements.make_invoices( - self.journal, self.refund_journal, self.product, date=self.date) + self.journal, self.product, date=self.date) # go to results if len(self.settlements): return { diff --git a/sale_commission/wizard/wizard_invoice.xml b/sale_commission/wizard/wizard_invoice.xml index 24d762344..440aa19a9 100644 --- a/sale_commission/wizard/wizard_invoice.xml +++ b/sale_commission/wizard/wizard_invoice.xml @@ -1,23 +1,22 @@ - - - + Make invoices sale.commission.make.invoice
- + - - +

(keep empty for invoicing all the settlements)

- + + +