From c9c8503b7e2a2a67288ca5a40e6500ea789104a0 Mon Sep 17 00:00:00 2001 From: yannick Date: Fri, 13 Apr 2012 12:39:57 +0200 Subject: [PATCH 01/39] Merge 6.1 addons bzr revid: yannick@serveur-perso-20120413103957-hz0q2yevwxbwqqkm --- addons/l10n_fr/__openerp__.py | 1 + addons/l10n_fr/l10n_fr.py | 15 +- addons/l10n_fr/l10n_fr_view.xml | 22 + addons/l10n_fr_hr_payroll/__init__.py | 24 + addons/l10n_fr_hr_payroll/__openerp__.py | 45 + .../l10n_fr_hr_payroll/l10n_fr_hr_payroll.py | 57 + .../l10n_fr_hr_payroll_data.xml | 1132 +++++++++++++++++ .../l10n_fr_hr_payroll_view.xml | 70 + addons/l10n_fr_hr_payroll/report/__init__.py | 27 + .../l10n_fr_hr_payroll/report/fiche_paye.py | 76 ++ .../l10n_fr_hr_payroll/report/fiche_paye.rml | 452 +++++++ 11 files changed, 1920 insertions(+), 1 deletion(-) create mode 100755 addons/l10n_fr/l10n_fr_view.xml create mode 100755 addons/l10n_fr_hr_payroll/__init__.py create mode 100755 addons/l10n_fr_hr_payroll/__openerp__.py create mode 100755 addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll.py create mode 100755 addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml create mode 100755 addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_view.xml create mode 100644 addons/l10n_fr_hr_payroll/report/__init__.py create mode 100755 addons/l10n_fr_hr_payroll/report/fiche_paye.py create mode 100644 addons/l10n_fr_hr_payroll/report/fiche_paye.rml diff --git a/addons/l10n_fr/__openerp__.py b/addons/l10n_fr/__openerp__.py index 839907c778a..d15a423b0d3 100644 --- a/addons/l10n_fr/__openerp__.py +++ b/addons/l10n_fr/__openerp__.py @@ -42,6 +42,7 @@ Credits: Sistheo Zeekom CrysaLEAD "update_xml" : [ "fr_report_demo.xml", "plan_comptable_general_demo.xml", + "l10n_fr_view.xml", "l10n_fr_wizard.xml", "fr_pcg_taxes_demo.xml", "fr_tax_demo.xml", diff --git a/addons/l10n_fr/l10n_fr.py b/addons/l10n_fr/l10n_fr.py index 573f4f7519e..5efb4244306 100644 --- a/addons/l10n_fr/l10n_fr.py +++ b/addons/l10n_fr/l10n_fr.py @@ -51,4 +51,17 @@ class l10n_fr_line(osv.osv): l10n_fr_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +class res_company(osv.osv): + _inherit = 'res.company' + + _columns = { + 'siret': fields.char('SIRET', size=64), + 'ape': fields.char('APE', size=64), + } + +res_company() + + + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr/l10n_fr_view.xml b/addons/l10n_fr/l10n_fr_view.xml new file mode 100755 index 00000000000..d21993db47b --- /dev/null +++ b/addons/l10n_fr/l10n_fr_view.xml @@ -0,0 +1,22 @@ + + + + + + res.company.form.l10n.fr + res.company + form + 20 + + + + + + + + + + + + + diff --git a/addons/l10n_fr_hr_payroll/__init__.py b/addons/l10n_fr_hr_payroll/__init__.py new file mode 100755 index 00000000000..f7fcefd3c4b --- /dev/null +++ b/addons/l10n_fr_hr_payroll/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see +# +############################################################################## +import l10n_fr_hr_payroll +import report + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_hr_payroll/__openerp__.py b/addons/l10n_fr_hr_payroll/__openerp__.py new file mode 100755 index 00000000000..669a0b31ac9 --- /dev/null +++ b/addons/l10n_fr_hr_payroll/__openerp__.py @@ -0,0 +1,45 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + 'name': 'French Payroll Rules', + 'category': 'Localization/Payroll', + 'author': 'SYNERPGY', + 'depends': ['hr_payroll', 'hr_payroll_account', 'l10n_fr'], + 'version': '1.0', + 'description': """ +French Payroll Rules +======================= + + -Configuration of hr_payroll for french localization + -Contributions Rules + -Accounting configuration + -New payslip report + """, + + 'active': False, + 'update_xml':[ + 'l10n_fr_hr_payroll_view.xml', + 'l10n_fr_hr_payroll_data.xml', + ], + 'installable': True +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll.py b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll.py new file mode 100755 index 00000000000..8b08bc2385d --- /dev/null +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll.py @@ -0,0 +1,57 @@ +#-*- coding:utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv +import decimal_precision as dp + + +class res_company(osv.osv): + _inherit = 'res.company' + + _columns = { + 'plafond_secu': fields.float('Plafond de la Securite Sociale', digits_compute=dp.get_precision('Payroll')), + 'nombre_employes': fields.integer('Nombre d\'employes'), + 'cotisation_prevoyance': fields.float('Cotisation Patronale Prevoyance', digits_compute=dp.get_precision('Payroll')), + 'org_ss': fields.char('Organisme de securite sociale', size=64), + 'conv_coll': fields.char('Convention collective', size=64), + } + +res_company() + +class hr_contract(osv.osv): + _inherit = 'hr.contract' + + _columns = { + 'qualif': fields.char('Qualification', size=64), + 'niveau': fields.char('Niveau', size=64), + 'coef': fields.char('Coefficient', size=64), + } +hr_contract() + +class hr_payslip(osv.osv): + _inherit = 'hr.payslip' + + _columns = { + 'payment_mode': fields.char('Mode de paiement', size=64), + } +hr_payslip() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml new file mode 100755 index 00000000000..5cb7de70d90 --- /dev/null +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml @@ -0,0 +1,1132 @@ + + + + + + + + + + + + Heures Supplementaires + True + lightblue + + + + + + + + + + 2946 + + + + + Cout total pour l'entreprise + TOTAL + + + + + Salaire Net + NET + + + + + Salaire Brut + BRUT + + + + + Salaire de base + BASE + + + + + Indemnite + INDM + + + + + Deduction + DED + + + + + Cumul Imposable + C_IMP + + + + + Total Retenues + RETENUES + + + + + Total Charges Salariales + SALC + + + + + Cotisations Patronales + COMP + + + + + Cotisations Prevoyance Patronales + PREV + + + + + Plafond de Securite Sociale + SECU + + + + + + Autres totaux + O_TOTALS + + + + + + + + + + URSSAF + + + + Organisme de retraite complementaire + + + + Chambre du commerce et de l'industrie + + + + Organisme de prevoyance + + + + + + + + + Salaire de base + BASE + 1 + total + + + + Salaire Brut + BRUT + 1000 + + result = categories.BASE + categories.INDM - categories.DED + total + + + + + Plafond Securite Sociale + SECU + 1010 + total + + + none + code + result = contract.employee_id.company_id.plafond_secu + + + + Plafond Tranche A + TA + 1011 + total + + + none + code + result = SECU + + + + Plafond Tranche B + TB + 1012 + total + + + none + code + result = SECU * 4 + + + + Plafond Tranche C + TC + 1013 + total + + + none + code + result = SECU * 8 + + + + Plafond Tranche 1 + T1 + 1014 + total + + + none + code + result = SECU + + + + Plafond Tranche 2 + T2 + 1015 + total + + + none + code + result = SECU * 3 + + + + + Total des charges salariales + 2510 + SALC + total + + + none + code + result = categories.SALC + + + + + Total Retenues + 99999 + total + + RET + none + code + + result = categories.RETENUES + + + + Cumul Imposable + 99999 + total + + C_IMP + none + code + + result = BRUT - categories.SALC + + + + + Net + 100000 + total + + result = BRUT - categories.RETENUES + + + + Total Charges Patronales + 150000 + TCOMP + total + + + none + code + result = categories.COMP + + + + + Cout total pour l'entreprise + 200000 + TOTAL + total + + + none + code + result = categories.BRUT + categories.COMP + + + + + + + + + + Assurance maladie, maternite, invalidite, deces, solidaritee des personnes agees et handicapees + C1 + 2040 + normal + none + percentage + 0.75 + categories.BRUT + + + + + + + + Assurance maladie, maternite, invalidite, deces, solidaritee des personnes agees et handicapees + C1P + 2045 + employer + none + percentage + 13.10 + categories.BRUT + + + + + + + + + Vieillesse plafonnee + C2 + 2050 + normal + none + percentage + 6.65 + min(categories.BRUT,SECU) + + + + + + + + Vieillesse plafonnee + C2P + 2055 + employer + none + percentage + 8.3 + min(categories.BRUT,SECU) + + + + + + + + + Vieillesse deplafonnee + C3 + 2060 + normal + none + percentage + 0.1 + categories.BRUT + + + + + + + + Vieillesse deplafonnee + C3P + 2065 + employer + none + percentage + 1.6 + categories.BRUT + + + + + + + + Allocations familiales + C4P + 2075 + employer + none + percentage + 5.4 + categories.BRUT + + + + + + + + + + + + Assurance chomage + C10 + 2080 + normal + none + percentage + 2.40 + min(categories.BRUT,TB) + + + + + + + + Assurance chomage + C10P + 2085 + employer + none + percentage + 4 + min(categories.BRUT,TB) + + + + + + + + + AGS (FNGS) + C11P + 2095 + employer + none + percentage + 0.3 + min(categories.BRUT,TB) + + + + + + + ARRCO Non-cadre Tranche 1 + C12 + 2100 + normal + none + percentage + 3 + min(categories.BRUT,T1) + + + + + + + + ARRCO Non-cadre Tranche 1 + C12P + 2105 + employer + none + percentage + 4.5 + min(categories.BRUT,T1) + + + + + + + + + ARRCO Non-cadre Tranche 2 + C14 + 2110 + normal + python + result = categories.BRUT > T1 + percentage + 8 + min(categories.BRUT-T1,T2-T1) + + + + + + + + ARRCO Non-cadre Tranche 2 + C14P + 2115 + employer + python + result = categories.BRUT > T1 + percentage + 12 + min(categories.BRUT-T1,T2-T1) + + + + + + + + + + AGFF Non-cadre Tranche 1 + C13 + 2120 + normal + none + percentage + 0.8 + min(categories.BRUT,T1) + + + + + + + + AGFF Non-cadre Tranche 1 + C13P + 2125 + employer + none + percentage + 1.2 + min(categories.BRUT,T1) + + + + + + + + AGFF Non-cadre Tranche 2 + C15 + 2130 + normal + python + result = categories.BRUT > T1 + percentage + 0.9 + min(categories.BRUT-T1,T2-T1) + + + + + + + + AGFF Non-cadre Tranche 2 + C15P + 2135 + employer + python + result = categories.BRUT > T1 + percentage + 1.3 + min(categories.BRUT-T1,T2-T1) + + + + + + + + + ARRCO Cadre Tranche A + C16 + 2140 + normal + none + percentage + 3 + min(categories.BRUT,TA) + + + + + + + + ARRCO Cadre Tranche A + C16P + 2145 + employer + none + percentage + 4.5 + min(categories.BRUT,TA) + + + + + + + + + AGIRC et GMP Cadre Tranche B + C17 + 2150 + normal + python + result = categories.BRUT > TA + percentage + 7.7 + min(categories.BRUT-TA,TB-TA) + + + + + + + + AGIRC et GMP Cadre Tranche B + C17P + 2155 + employer + python + result = categories.BRUT > TA + percentage + 12.6 + min(categories.BRUT-TA,TB-TA) + + + + + + + + + AGIRC Cadre Tranche C + C18P + 2165 + employer + python + result = categories.BRUT > TB + percentage + 0 + min(categories.BRUT-TB,TC-TB) + + + + + + + + AGFF Cadre Tranche A + C18 + 2170 + normal + none + percentage + 0.8 + min(categories.BRUT,TA) + + + + + + + + AGFF Cadre Tranche A + C18P + 2175 + employer + none + percentage + 1.2 + min(categories.BRUT,TA) + + + + + + + + AGFF Non-cadre Tranche B + C18 + 2180 + normal + python + result = categories.BRUT > TA + percentage + 0.9 + min(categories.BRUT-TA,TB-TA) + + + + + + + + AGFF Cadre Tranche B + C18P + 2185 + employer + python + result = categories.BRUT > TA + percentage + 1.3 + min(categories.BRUT-TA,TB-TA) + + + + + + + CET + C19 + 2190 + normal + none + percentage + 0.13 + min(categories.BRUT,TC) + + + + + + + + CET + C19P + 2195 + employer + none + percentage + 0.22 + min(categories.BRUT,TC) + + + + + + + APEC + C20 + 2200 + normal + none + percentage + 0.024 + min(categories.BRUT,TB) + + + + + + + + APEC + C20P + 2205 + employer + none + percentage + 0.036 + min(categories.BRUT,TB) + + + + + + + + Assurance deces cadres + C21P + 2215 + employer + none + percentage + 1.5 + min(categories.BRUT,TA) + + + + + + + + + + Accident du travail + C5P + 2225 + employer + none + percentage + categories.BRUT + + + + + + + Prevoyance Cadre TA + C35 + 2230 + normal + none + percentage + min(categories.BRUT,TA) + + + + + + + Prevoyance Cadre TA + C35P + 2231 + employer + none + percentage + min(categories.BRUT,TA) + + + + + + Prevoyance Cadre TB + C36 + 2232 + normal + python + result = categories.BRUT > TA + percentage + min(categories.BRUT-TA,TB-TA) + + + + + + + Prevoyance Cadre TB + C36P + 2233 + employer + python + result = categories.BRUT > TA + percentage + min(categories.BRUT-TA,TB-TA) + + + + + + Forfait Mutuelle + C37 + 2234 + normal + none + fix + + + + + + + Forfait Mutuelle + C37P + 2235 + employer + none + fix + + + + + + Taxe Prevoyance + C40P + 2239 + employer + python + result = categories.PREV != 0 + percentage + 8 + categories.PREV + + + + + + FNAL -20 Employes + C7P + 2245 + employer + range + contract.employee_id.company_id.nombre_employes + 19 + percentage + 0.1 + min(categories.BRUT,SECU) + + + + + + + + + FNAL +20 Employes + C8P + 2255 + employer + range + contract.employee_id.company_id.nombre_employes + 20 + percentage + 0.5 + categories.BRUT + + + + + + + + + Versement Transport + C9P + 2265 + employer + range + contract.employee_id.company_id.nombre_employes + 10 + percentage + + + + + + + + + + Effort a la construction + C22P + 2275 + employer + range + contract.employee_id.company_id.nombre_employes + 20 + percentage + 0.45 + categories.BRUT + + + + + + + + Taxe d'apprentissage + C23P + 2285 + employer + none + percentage + 0.5 + categories.BRUT + + + + + + + Contribution additionnelle au developpement de l'apprentissage + C24P + 2295 + employer + none + percentage + 0.18 + categories.BRUT + + + + + + + + Formation professionnelle 10- salaries + C25P + 2305 + employer + range + contract.employee_id.company_id.nombre_employes + 9 + percentage + 0.55 + categories.BRUT + + + + + + + + + Formation professionnelle 10-19 salaries + C26P + 2315 + employer + range + contract.employee_id.company_id.nombre_employes + 10 + 19 + percentage + 1.05 + categories.BRUT + + + + + + + + + Formation professionnelle 20+ salaries + C27P + 2325 + employer + range + contract.employee_id.company_id.nombre_employes + 20 + percentage + 1.60 + categories.BRUT + + + + + + + CSG deductible + C29 + 2500 + normal + none + percentage + 5.1 + (categories.BRUT + categories.PREV)*0.97 + + + + + + + CSG non deductible + C28 + 2550 + normal + none + percentage + 2.4 + (categories.BRUT + categories.PREV)*0.97 + + + + + + + + CRDS + C30 + 2560 + normal + none + percentage + 0.5 + (categories.BRUT + categories.PREV)*0.97 + + + + + + + + + + + + Cotisations de base Employe Francais + + + + + + E-NC + Employe non-cadre + + + + + + + + E-C + Employe cadre + + + + + + + + + + + + diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_view.xml b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_view.xml new file mode 100755 index 00000000000..764213313b8 --- /dev/null +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_view.xml @@ -0,0 +1,70 @@ + + + + + + + res.company.form.l10n.fr.payroll + res.company + form + 20 + + + + + + + + + + + + + + + + + + + hr.contract.view.form.l10n.fr.payroll + hr.contract + form + 20 + + + + + + + + + + + + hr.payslip.form.l10n.fr.payroll + hr.payslip + form + 20 + + + + + + + + + + + + + + + + diff --git a/addons/l10n_fr_hr_payroll/report/__init__.py b/addons/l10n_fr_hr_payroll/report/__init__.py new file mode 100644 index 00000000000..40d2ccc3c05 --- /dev/null +++ b/addons/l10n_fr_hr_payroll/report/__init__.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# d$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import fiche_paye + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.py b/addons/l10n_fr_hr_payroll/report/fiche_paye.py new file mode 100755 index 00000000000..3419045a788 --- /dev/null +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# d$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from report import report_sxw + +class fiche_paye_parser(report_sxw.rml_parse): + + def __init__(self, cr, uid, name, context): + super(fiche_paye_parser, self).__init__(cr, uid, name, context) + self.localcontext.update({ + 'get_payslip_lines': self.get_payslip_lines, + 'get_total_by_rule_category': self.get_total_by_rule_category, + 'get_employer_line': self.get_employer_line, + }) + + def get_payslip_lines(self, obj): + payslip_line = self.pool.get('hr.payslip.line') + res = [] + ids = [] + for id in range(len(obj)): + if obj[id].appears_on_payslip == True and ( obj[id].salary_rule_id.type != 'employer' or not obj[id].salary_rule_id.parent_rule_id ): + ids.append(obj[id].id) + if ids: + res = payslip_line.browse(self.cr, self.uid, ids) + return res + + + def get_total_by_rule_category(self, obj, code): + payslip_line = self.pool.get('hr.payslip.line') + rule_cate_obj = self.pool.get('hr.salary.rule.category') + + cate_ids = rule_cate_obj.search(self.cr, self.uid, [('code', '=', code)]) + + category_total = 0 + line_ids = payslip_line.search(self.cr, self.uid, [('slip_id', '=', obj.id),('category_id.id', '=', cate_ids[0] )]) + + for line in payslip_line.browse(self.cr, self.uid, line_ids): + category_total += line.total + + return category_total + + + def get_employer_line(self, obj, parent_line): + + payslip_line = self.pool.get('hr.payslip.line') + + line_ids = payslip_line.search(self.cr, self.uid, [('slip_id', '=', obj.id), ('salary_rule_id.parent_rule_id.id', '=', parent_line.salary_rule_id.id )]) + res = payslip_line.browse(self.cr, self.uid, line_ids[0]) + + return res + + +report_sxw.report_sxw('report.fiche.paye', 'hr.payslip', 'l10n_fr_hr_payroll/report/fiche_paye.rml', parser=fiche_paye_parser) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml new file mode 100644 index 00000000000..2abc9cd53c0 --- /dev/null +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml @@ -0,0 +1,452 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[repeatIn(objects,'o')]] + + + + + + + BULLETIN DE PAIE + + + + PAIE DU [[ formatLang(o.date_from, date=True) or '']] AU [[ formatLang(o.date_to, date=True) or '' ]] + + + + Matricule : + N° s.s : + Emploi : + Qualif : + Niveau : + Coef : + Entrée : + + + [[o.employee_id.sinid or '_']] + [[o.employee_id.ssnid or '_']] + [[o.contract_id.job_id.name or '_']] + [[o.contract_id.qualif or '_']] + [[o.contract_id.niveau or '_']] + [[o.contract_id.coef or '_']] + [[o.contract_id.date_start or '_']] Sortie : [[o.contract_id.date_end or '']] + + + + + ORG. S.S : + + + [[o.employee_id.company_id.org_ss or '_']] + + + + + + + + + + + + + + + + + [[o.employee_id.company_id.partner_id.title.name or '']] [[o.employee_id.company_id.name or '_']] + [[o.employee_id.company_id.street or '_']] + [[o.employee_id.company_id.street2 or '']] + [[o.employee_id.company_id.zip or '_']] [[o.employee_id.company_id.city or '']] + SIRET : [[o.employee_id.company_id.siret or '_']] APE : [[o.employee_id.company_id.ape or '_']] + + + + + + + + + + + + + + + + [[o.employee_id.name or '_']] + [[o.employee_id.address_home_id.street or '_' ]] + [[o.employee_id.address_home_id.street2 or '' ]] + [[o.employee_id.address_home_id.zip or '_' ]] [[o.employee_id.address_home_id.city or '' ]] + + + + + + + + + + + + + + + + + + + DESIGNATION + + + QUANTITE / BASE + + + TAUX + + + MONTANT + + + CHARGES PATRONALES + + + +
+ [[repeatIn(get_payslip_lines(o.line_ids),'p')]] + + + + [[ p.code or '' ]] + + + [[ p.name or '' ]] + + + [[ ((p.amount_select== 'percentage') or removeParentNode('para')) and '' ]] [[ p.base or '' ]] + [[ ((p.amount_select== 'fix') or removeParentNode('para')) and '' ]] [[ p.quantity or '' ]] + [[ ((p.amount_select<> 'fix' and p.amount_select<> 'percentage') or removeParentNode('para')) and '' ]] + + + [[ ((p.amount_select == 'percentage' and p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]] [[ p.rate or '' ]] + [[ ((p.amount_select <> 'percentage' or p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] + + + [[ (( p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]] [[ p.amount or '' ]] + [[ (( p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] + + + [[ (( p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] [[ p.rate or '' ]] + [[ (( p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]][[ get_employer_line(o, p).rate or '']] + + + [[ (( p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] [[ p.amount or '' ]] + [[ (( p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]][[ get_employer_line(o,p).amount or '' ]] + + + +
+ + + + + + + + + + Mode de reglement : [[ o.payment_mode or '' ]] + Paye le : [[ formatLang(o.move_id.date, date=True) or '']] + + + NET A PAYER + + + TOTAL CHARGES PATRONALES + + + + + Conv. Coll.: [[ o.employee_id.company_id.conv_coll or '' ]] + + + [[ get_total_by_rule_category(o, 'NET') ]] + + + [[ get_total_by_rule_category(o, 'COMP') ]] + + + + + + + SALAIRE BRUT + + + TOTAL CHARGES SALARIALES + + + NET IMPOSABLE + + + PLAFOND S.S. + + + + + + + + COUT GLOBAL SALARIE + + + + + [[ get_total_by_rule_category(o, 'BRUT') ]] + + + [[ get_total_by_rule_category(o, 'SALC') ]] + + + [[ get_total_by_rule_category(o, 'C_IMP') ]] + + + [[ o.employee_id.company_id.plafond_secu or '' ]] + + + + + + + + [[ get_total_by_rule_category(o, 'TOTAL') ]] + + + + + + + + + + + DANS VOTRE INTERET ET POUR VOUS AIDER A FAIRE VALOIR VOS DROITS, CONSERVER CE BULLETIN DE PAIE SANS LIMITATION DE DUREE + +
+
+ From 9ba625487fa104553df76d3f8e4c2e21dbaeb14a Mon Sep 17 00:00:00 2001 From: yannick Date: Fri, 13 Apr 2012 18:05:51 +0200 Subject: [PATCH 02/39] Deleted any reference to the type field bzr revid: yannick@serveur-perso-20120413160551-fy3ucmervxo1066y --- .../l10n_fr_hr_payroll_data.xml | 278 +++++++++++++----- .../l10n_fr_hr_payroll/report/fiche_paye.py | 2 +- .../l10n_fr_hr_payroll/report/fiche_paye.rml | 13 +- 3 files changed, 207 insertions(+), 86 deletions(-) diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml index 5cb7de70d90..659af12905e 100755 --- a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml @@ -134,7 +134,6 @@ Salaire de base BASE 1 - total @@ -143,7 +142,6 @@ 1000 result = categories.BASE + categories.INDM - categories.DED - total @@ -151,7 +149,6 @@ Plafond Securite Sociale SECU 1010 - total none @@ -163,7 +160,6 @@ Plafond Tranche A TA 1011 - total none @@ -175,7 +171,6 @@ Plafond Tranche B TB 1012 - total none @@ -187,7 +182,6 @@ Plafond Tranche C TC 1013 - total none @@ -199,7 +193,6 @@ Plafond Tranche 1 T1 1014 - total none @@ -211,7 +204,6 @@ Plafond Tranche 2 T2 1015 - total none @@ -224,7 +216,6 @@ Total des charges salariales 2510 SALC - total none @@ -236,7 +227,6 @@ Total Retenues 99999 - total RET none @@ -248,7 +238,6 @@ Cumul Imposable 99999 - total C_IMP none @@ -261,7 +250,6 @@ Net 100000 - total result = BRUT - categories.RETENUES @@ -270,7 +258,6 @@ Total Charges Patronales 150000 TCOMP - total none @@ -283,7 +270,6 @@ Cout total pour l'entreprise 200000 TOTAL - total none @@ -301,7 +287,6 @@ Assurance maladie, maternite, invalidite, deces, solidaritee des personnes agees et handicapees C1 2040 - normal none percentage 0.75 @@ -316,7 +301,6 @@ Assurance maladie, maternite, invalidite, deces, solidaritee des personnes agees et handicapees C1P 2045 - employer none percentage 13.10 @@ -332,7 +316,6 @@ Vieillesse plafonnee C2 2050 - normal none percentage 6.65 @@ -347,7 +330,6 @@ Vieillesse plafonnee C2P 2055 - employer none percentage 8.3 @@ -363,7 +345,6 @@ Vieillesse deplafonnee C3 2060 - normal none percentage 0.1 @@ -378,7 +359,6 @@ Vieillesse deplafonnee C3P 2065 - employer none percentage 1.6 @@ -388,12 +368,25 @@ + + + Allocations familiales + C4 + 2070 + none + percentage + 0 + categories.BRUT + + + + + Allocations familiales C4P 2075 - employer none percentage 5.4 @@ -412,7 +405,6 @@ Assurance chomage C10 2080 - normal none percentage 2.40 @@ -427,7 +419,6 @@ Assurance chomage C10P 2085 - employer none percentage 4 @@ -437,13 +428,25 @@ + + + AGS (FNGS) + C11 + 2090 + none + percentage + 0 + min(categories.BRUT,TB) + + + + AGS (FNGS) C11P 2095 - employer none percentage 0.3 @@ -457,7 +460,6 @@ ARRCO Non-cadre Tranche 1 C12 2100 - normal none percentage 3 @@ -472,7 +474,6 @@ ARRCO Non-cadre Tranche 1 C12P 2105 - employer none percentage 4.5 @@ -488,7 +489,6 @@ ARRCO Non-cadre Tranche 2 C14 2110 - normal python result = categories.BRUT > T1 percentage @@ -504,7 +504,6 @@ ARRCO Non-cadre Tranche 2 C14P 2115 - employer python result = categories.BRUT > T1 percentage @@ -522,7 +521,6 @@ AGFF Non-cadre Tranche 1 C13 2120 - normal none percentage 0.8 @@ -531,13 +529,12 @@ - + AGFF Non-cadre Tranche 1 C13P 2125 - employer none percentage 1.2 @@ -552,7 +549,6 @@ AGFF Non-cadre Tranche 2 C15 2130 - normal python result = categories.BRUT > T1 percentage @@ -568,7 +564,6 @@ AGFF Non-cadre Tranche 2 C15P 2135 - employer python result = categories.BRUT > T1 percentage @@ -585,7 +580,6 @@ ARRCO Cadre Tranche A C16 2140 - normal none percentage 3 @@ -600,7 +594,6 @@ ARRCO Cadre Tranche A C16P 2145 - employer none percentage 4.5 @@ -616,7 +609,6 @@ AGIRC et GMP Cadre Tranche B C17 2150 - normal python result = categories.BRUT > TA percentage @@ -632,7 +624,6 @@ AGIRC et GMP Cadre Tranche B C17P 2155 - employer python result = categories.BRUT > TA percentage @@ -643,13 +634,26 @@ + + + AGIRC Cadre Tranche C + C38 + 2160 + python + result = categories.BRUT > TB + percentage + 0 + min(categories.BRUT-TB,TC-TB) + + + + AGIRC Cadre Tranche C - C18P + C38P 2165 - employer python result = categories.BRUT > TB percentage @@ -665,7 +669,6 @@ AGFF Cadre Tranche A C18 2170 - normal none percentage 0.8 @@ -680,7 +683,6 @@ AGFF Cadre Tranche A C18P 2175 - employer none percentage 1.2 @@ -695,7 +697,6 @@ AGFF Non-cadre Tranche B C18 2180 - normal python result = categories.BRUT > TA percentage @@ -711,7 +712,6 @@ AGFF Cadre Tranche B C18P 2185 - employer python result = categories.BRUT > TA percentage @@ -726,7 +726,6 @@ CET C19 2190 - normal none percentage 0.13 @@ -741,7 +740,6 @@ CET C19P 2195 - employer none percentage 0.22 @@ -755,7 +753,6 @@ APEC C20 2200 - normal none percentage 0.024 @@ -770,7 +767,6 @@ APEC C20P 2205 - employer none percentage 0.036 @@ -779,13 +775,26 @@ + + + + Assurance deces cadres + C21 + 2210 + none + percentage + 0 + min(categories.BRUT,TA) + + + + Assurance deces cadres C21P 2215 - employer none percentage 1.5 @@ -795,14 +804,25 @@ - + + + Accident du travail + C5 + 2220 + none + percentage + 0 + categories.BRUT + + + + Accident du travail C5P 2225 - employer none percentage categories.BRUT @@ -815,7 +835,6 @@ Prevoyance Cadre TA C35 2230 - normal none percentage min(categories.BRUT,TA) @@ -828,7 +847,6 @@ Prevoyance Cadre TA C35P 2231 - employer none percentage min(categories.BRUT,TA) @@ -840,7 +858,6 @@ Prevoyance Cadre TB C36 2232 - normal python result = categories.BRUT > TA percentage @@ -854,7 +871,6 @@ Prevoyance Cadre TB C36P 2233 - employer python result = categories.BRUT > TA percentage @@ -867,7 +883,6 @@ Forfait Mutuelle C37 2234 - normal none fix @@ -879,18 +894,30 @@ Forfait Mutuelle C37P 2235 - employer none fix + + + + Taxe Prevoyance + C40 + 2238 + python + result = categories.PREV != 0 + percentage + categories.PREV + + + + Taxe Prevoyance C40P 2239 - employer python result = categories.PREV != 0 percentage @@ -899,12 +926,26 @@ + + + + FNAL -20 Employes + C7 + 2240 + range + contract.employee_id.company_id.nombre_employes + 19 + percentage + min(categories.BRUT,SECU) + + + + FNAL -20 Employes C7P 2245 - employer range contract.employee_id.company_id.nombre_employes 19 @@ -916,13 +957,25 @@ - + + + FNAL +20 Employes + C8 + 2250 + range + contract.employee_id.company_id.nombre_employes + 20 + percentage + categories.BRUT + + + + FNAL +20 Employes C8P 2255 - employer range contract.employee_id.company_id.nombre_employes 20 @@ -932,15 +985,27 @@ + - + + + Versement Transport + C9 + 2260 + range + contract.employee_id.company_id.nombre_employes + 10 + percentage + + + + Versement Transport C9P 2265 - employer range contract.employee_id.company_id.nombre_employes 10 @@ -950,14 +1015,24 @@ - + + + Effort a la construction + C22 + 2270 + range + contract.employee_id.company_id.nombre_employes + 20 + percentage + + + Effort a la construction C22P 2275 - employer range contract.employee_id.company_id.nombre_employes 20 @@ -968,13 +1043,22 @@ - + + + Taxe d'apprentissage + C23 + 2280 + none + percentage + + + + Taxe d'apprentissage C23P 2285 - employer none percentage 0.5 @@ -983,12 +1067,22 @@ + + + Contribution additionnelle au developpement de l'apprentissage + C24 + 2290 + none + percentage + + + + Contribution additionnelle au developpement de l'apprentissage C24P 2295 - employer none percentage 0.18 @@ -997,13 +1091,24 @@ - + + + Formation professionnelle 10- salaries + C25 + 2300 + range + contract.employee_id.company_id.nombre_employes + 9 + percentage + + + + Formation professionnelle 10- salaries C25P 2305 - employer range contract.employee_id.company_id.nombre_employes 9 @@ -1015,13 +1120,25 @@ + + + Formation professionnelle 10-19 salaries + C26 + 2310 + range + contract.employee_id.company_id.nombre_employes + 10 + 19 + percentage + + + Formation professionnelle 10-19 salaries C26P 2315 - employer range contract.employee_id.company_id.nombre_employes 10 @@ -1033,14 +1150,24 @@ - + + + Formation professionnelle 20+ salaries + C27 + 2320 + range + contract.employee_id.company_id.nombre_employes + 20 + percentage + + + Formation professionnelle 20+ salaries C27P 2325 - employer range contract.employee_id.company_id.nombre_employes 20 @@ -1056,7 +1183,6 @@ CSG deductible C29 2500 - normal none percentage 5.1 @@ -1070,7 +1196,6 @@ CSG non deductible C28 2550 - normal none percentage 2.4 @@ -1085,7 +1210,6 @@ CRDS C30 2560 - normal none percentage 0.5 @@ -1102,7 +1226,7 @@ Cotisations de base Employe Francais - + @@ -1118,7 +1242,7 @@ E-C Employe cadre - + diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.py b/addons/l10n_fr_hr_payroll/report/fiche_paye.py index 3419045a788..027e8bfaeb8 100755 --- a/addons/l10n_fr_hr_payroll/report/fiche_paye.py +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.py @@ -39,7 +39,7 @@ class fiche_paye_parser(report_sxw.rml_parse): res = [] ids = [] for id in range(len(obj)): - if obj[id].appears_on_payslip == True and ( obj[id].salary_rule_id.type != 'employer' or not obj[id].salary_rule_id.parent_rule_id ): + if obj[id].appears_on_payslip == True and not obj[id].salary_rule_id.parent_rule_id : ids.append(obj[id].id) if ids: res = payslip_line.browse(self.cr, self.uid, ids) diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml index 2abc9cd53c0..039ce60a354 100644 --- a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml @@ -343,20 +343,17 @@ [[ ((p.amount_select<> 'fix' and p.amount_select<> 'percentage') or removeParentNode('para')) and '' ]] - [[ ((p.amount_select == 'percentage' and p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]] [[ p.rate or '' ]] - [[ ((p.amount_select <> 'percentage' or p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] + [[ ((p.amount_select == 'percentage') or removeParentNode('para')) and '' ]] [[ p.rate or '' ]] + [[ ((p.amount_select <> 'percentage') or removeParentNode('para')) and '' ]] - [[ (( p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]] [[ p.amount or '' ]] - [[ (( p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] + [[ p.amount or '' ]] - [[ (( p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] [[ p.rate or '' ]] - [[ (( p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]][[ get_employer_line(o, p).rate or '']] + [[ get_employer_line(o, p).rate or '']] - [[ (( p.salary_rule_id.type == 'employer') or removeParentNode('para')) and '' ]] [[ p.amount or '' ]] - [[ (( p.salary_rule_id.type <> 'employer') or removeParentNode('para')) and '' ]][[ get_employer_line(o,p).amount or '' ]] + [[ get_employer_line(o,p).amount or '' ]] From fc121b1ecb5831ba61c5349f5ffb03428acfbb39 Mon Sep 17 00:00:00 2001 From: yannick Date: Fri, 13 Apr 2012 18:17:56 +0200 Subject: [PATCH 03/39] Updated Contributions 2012 bzr revid: yannick@serveur-perso-20120413161756-qiocyrdeeujqtvf8 --- addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml index 659af12905e..e7a0e44d21e 100755 --- a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml @@ -1186,7 +1186,7 @@ none percentage 5.1 - (categories.BRUT + categories.PREV)*0.97 + (categories.BRUT + categories.PREV)*0.9825 @@ -1199,7 +1199,7 @@ none percentage 2.4 - (categories.BRUT + categories.PREV)*0.97 + (categories.BRUT + categories.PREV)*0.9825 @@ -1213,7 +1213,7 @@ none percentage 0.5 - (categories.BRUT + categories.PREV)*0.97 + (categories.BRUT + categories.PREV)*0.9825 From 4254162e4330140b2decf5e872862c656e1e3373 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 18 Apr 2012 11:14:10 +0200 Subject: [PATCH 04/39] Remove the '_demo' suffix in filenames... as they don't contain demo data ! bzr revid: alexis@via.ecp.fr-20120418091410-2yxefhy2lio840vu --- addons/l10n_fr/__openerp__.py | 10 +++++----- ...scal_templates_demo.xml => fr_fiscal_templates.xml} | 0 .../{fr_pcg_taxes_demo.xml => fr_pcg_taxes.xml} | 0 addons/l10n_fr/{fr_report_demo.xml => fr_report.xml} | 0 addons/l10n_fr/{fr_tax_demo.xml => fr_tax.xml} | 0 ...ble_general_demo.xml => plan_comptable_general.xml} | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename addons/l10n_fr/{fr_fiscal_templates_demo.xml => fr_fiscal_templates.xml} (100%) rename addons/l10n_fr/{fr_pcg_taxes_demo.xml => fr_pcg_taxes.xml} (100%) rename addons/l10n_fr/{fr_report_demo.xml => fr_report.xml} (100%) rename addons/l10n_fr/{fr_tax_demo.xml => fr_tax.xml} (100%) rename addons/l10n_fr/{plan_comptable_general_demo.xml => plan_comptable_general.xml} (100%) diff --git a/addons/l10n_fr/__openerp__.py b/addons/l10n_fr/__openerp__.py index 839907c778a..4dd94a92e18 100644 --- a/addons/l10n_fr/__openerp__.py +++ b/addons/l10n_fr/__openerp__.py @@ -40,12 +40,12 @@ Credits: Sistheo Zeekom CrysaLEAD "depends" : ['base_iban', 'account', 'account_chart', 'base_vat', 'l10n_fr_rib'], "init_xml" : [], "update_xml" : [ - "fr_report_demo.xml", - "plan_comptable_general_demo.xml", + "fr_report.xml", + "plan_comptable_general.xml", "l10n_fr_wizard.xml", - "fr_pcg_taxes_demo.xml", - "fr_tax_demo.xml", - "fr_fiscal_templates_demo.xml", + "fr_pcg_taxes.xml", + "fr_tax.xml", + "fr_fiscal_templates.xml", "security/ir.model.access.csv", "wizard/fr_report_bilan_view.xml", "wizard/fr_report_compute_resultant_view.xml", diff --git a/addons/l10n_fr/fr_fiscal_templates_demo.xml b/addons/l10n_fr/fr_fiscal_templates.xml similarity index 100% rename from addons/l10n_fr/fr_fiscal_templates_demo.xml rename to addons/l10n_fr/fr_fiscal_templates.xml diff --git a/addons/l10n_fr/fr_pcg_taxes_demo.xml b/addons/l10n_fr/fr_pcg_taxes.xml similarity index 100% rename from addons/l10n_fr/fr_pcg_taxes_demo.xml rename to addons/l10n_fr/fr_pcg_taxes.xml diff --git a/addons/l10n_fr/fr_report_demo.xml b/addons/l10n_fr/fr_report.xml similarity index 100% rename from addons/l10n_fr/fr_report_demo.xml rename to addons/l10n_fr/fr_report.xml diff --git a/addons/l10n_fr/fr_tax_demo.xml b/addons/l10n_fr/fr_tax.xml similarity index 100% rename from addons/l10n_fr/fr_tax_demo.xml rename to addons/l10n_fr/fr_tax.xml diff --git a/addons/l10n_fr/plan_comptable_general_demo.xml b/addons/l10n_fr/plan_comptable_general.xml similarity index 100% rename from addons/l10n_fr/plan_comptable_general_demo.xml rename to addons/l10n_fr/plan_comptable_general.xml From f1eeec97db6e9b26a78948dbe69dd3e5104efbd5 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 18 Apr 2012 11:17:02 +0200 Subject: [PATCH 05/39] Fix French chart of accounts : - type of account 44566 changed from 'view' to 'normal' - the parent of account 445662 is now 4456 bzr revid: alexis@via.ecp.fr-20120418091702-oepthwy3tyc2qy1v --- addons/l10n_fr/plan_comptable_general.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_fr/plan_comptable_general.xml b/addons/l10n_fr/plan_comptable_general.xml index b78e1821720..18a83b735dc 100644 --- a/addons/l10n_fr/plan_comptable_general.xml +++ b/addons/l10n_fr/plan_comptable_general.xml @@ -4210,7 +4210,7 @@ TVA sur autres biens et services 44566 - view + other @@ -4223,7 +4223,7 @@ other - + From 992301ddfe8b280895f210574ff36921a8c8b60d Mon Sep 17 00:00:00 2001 From: yannick Date: Sat, 21 Apr 2012 18:21:15 +0200 Subject: [PATCH 06/39] Updating l10n_fr_hr_payroll in preparation of the merge request bzr revid: yannick@serveur-perso-20120421162115-semk6axc1wh3rsve --- addons/l10n_fr_hr_payroll/__openerp__.py | 14 ++++++++++---- .../l10n_fr_hr_payroll_data.xml | 18 +++++++++++++----- .../l10n_fr_hr_payroll/report/fiche_paye.rml | 8 ++++---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/addons/l10n_fr_hr_payroll/__openerp__.py b/addons/l10n_fr_hr_payroll/__openerp__.py index 669a0b31ac9..6a3beb52718 100755 --- a/addons/l10n_fr_hr_payroll/__openerp__.py +++ b/addons/l10n_fr_hr_payroll/__openerp__.py @@ -19,9 +19,9 @@ # ############################################################################## { - 'name': 'French Payroll Rules', + 'name': 'French Payroll', 'category': 'Localization/Payroll', - 'author': 'SYNERPGY', + 'author': 'Yannick Buron (SYNERPGY)', 'depends': ['hr_payroll', 'hr_payroll_account', 'l10n_fr'], 'version': '1.0', 'description': """ @@ -29,9 +29,15 @@ French Payroll Rules ======================= -Configuration of hr_payroll for french localization - -Contributions Rules - -Accounting configuration + -All main contributions rules for french payslip, for 'cadre' and 'non-cadre' -New payslip report + + TODO : + -Integration with holidays module for deduction and allowance + -Integration with hr_payroll_account for the automatic account_move_line creation from the payslip + -Continue to integrate the contribution. Only the main contribution are currently implemented + -Remake the report under webkit + -The payslip.line with appears_in_payslip = False should appears in the payslip interface, but not in the payslip report """, 'active': False, diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml index e7a0e44d21e..31d3ebe9654 100755 --- a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml @@ -1050,6 +1050,7 @@ 2280 none percentage + categories.BRUT @@ -1074,6 +1075,7 @@ 2290 none percentage + categories.BRUT @@ -1100,6 +1102,7 @@ contract.employee_id.company_id.nombre_employes 9 percentage + categories.BRUT @@ -1130,6 +1133,7 @@ 10 19 percentage + categories.BRUT @@ -1159,6 +1163,7 @@ contract.employee_id.company_id.nombre_employes 20 percentage + categories.BRUT @@ -1224,27 +1229,30 @@ - + + Fr-Base Cotisations de base Employe Francais + + - E-NC + Fr-NC Employe non-cadre - + - E-C + Fr-C Employe cadre - + diff --git a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml index 039ce60a354..e155f23f69d 100644 --- a/addons/l10n_fr_hr_payroll/report/fiche_paye.rml +++ b/addons/l10n_fr_hr_payroll/report/fiche_paye.rml @@ -1,6 +1,6 @@ - From 0c7a63bb3aa0762aad3685f64b54fc890b1f44d5 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 14 May 2012 17:21:32 +0200 Subject: [PATCH 14/39] [imp] added option for quick create bzr revid: nicolas.vanhoren@openerp.com-20120514152132-hgo59oucjo7v65zz --- addons/web_kanban/static/src/js/kanban.js | 9 +++------ addons/web_kanban/static/src/xml/web_kanban.xml | 6 ++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 660ad4c746d..891a68f4007 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -11,10 +11,8 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ default_nr_columns: 3, view_type: "kanban", init: function (parent, dataset, view_id, options) { - this._super(parent); - this.set_default_options(options); - this.dataset = dataset; - this.view_id = view_id; + this._super(parent, dataset, view_id, options); + _.defaults(this.options, {"quick_creatable": true}); this.fields_view = {}; this.fields_keys = []; this.group_by = null; @@ -430,8 +428,7 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({ */ quick_created: function (record) { var id = record[0], self = this; - new instance.web.Model(this.dataset.model).call( - 'read', [[id], this.view.fields_keys], {}) + this.dataset.read_ids([id], this.view.fields_keys) .then(function (records) { self.view.dataset.ids.push(id); self.do_add_records(records, 'prepend'); diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index d04e240bfcc..7db4345ad32 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -20,7 +20,9 @@
-
+ +
+
@@ -35,7 +37,7 @@

- + From b26da31d090a58bde89ed5b46615cff9b6dd31f2 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 14 May 2012 17:28:46 +0200 Subject: [PATCH 15/39] [imp] made kanban view read only in o2m bzr revid: nicolas.vanhoren@openerp.com-20120514152846-pke1gtxkzn0k7l1i --- addons/web/static/src/js/view_form.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 27606a564be..5722c0b2008 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2749,6 +2749,11 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ view.view_type = 'form'; } view.options.not_interactible_on_create = true; + } else if (view.view_type === "kanban") { + if (self.get("effective_readonly")) { + view.options.action_buttons = false; + view.options.quick_creatable = false; + } } views.push(view); }); From 0a1ce4c4daab076130d86f612f8add182b8fc85d Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 14 May 2012 17:51:44 +0200 Subject: [PATCH 16/39] [imp] added slow create bzr revid: nicolas.vanhoren@openerp.com-20120514155144-4lb9la1o0qv5k18o --- addons/web_kanban/static/src/js/kanban.js | 24 ++++++++++++++++--- .../web_kanban/static/src/xml/web_kanban.xml | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 891a68f4007..9940c305f11 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -680,15 +680,33 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({ */ quick_add: function () { var self = this; - // FIXME: what if name_create fails? + self.$input.val(""); this._dataset.call( 'name_create', [self.$input.val(), new instance.web.CompoundContext( this._dataset.get_context(), this._context)]) - .then(function(record) { - self.$input.val(""); + .pipe(function(record) { self.trigger('added', record); + }, function() { + return self.slow_create(); }); }, + slow_create: function() { + var self = this; + var pop = new instance.web.form.SelectCreatePopup(this); + pop.select_element( + self.field.relation, + { + title: _t("Create: ") + (this.string || this.name), + initial_view: "form", + disable_multiple_selection: true + }, + undefined, + new instance.web.CompoundContext(self.build_context(), {"default_name": self.$input.val("")}) + ); + pop.on_select_elements.add(function(element_ids) { + self.trigger('added', element_ids); + }); + } }); }; diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index 7db4345ad32..29bb81087fe 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -69,7 +69,7 @@
- + From b992877c13eff8e8a12a567cb60dd0d0382c9f68 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 14 May 2012 18:08:26 +0200 Subject: [PATCH 17/39] [fix] small problem bzr revid: nicolas.vanhoren@openerp.com-20120514160826-2id8czonkdfe1zys --- addons/web_kanban/static/src/js/kanban.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 895384edf5f..4c03d619773 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -710,11 +710,11 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({ */ quick_add: function () { var self = this; - self.$input.val(""); this._dataset.call( 'name_create', [self.$input.val(), new instance.web.CompoundContext( this._dataset.get_context(), this._context)]) .pipe(function(record) { + self.$input.val(""); self.trigger('added', record); }, function() { return self.slow_create(); @@ -734,6 +734,7 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({ new instance.web.CompoundContext(self.build_context(), {"default_name": self.$input.val("")}) ); pop.on_select_elements.add(function(element_ids) { + self.$input.val(""); self.trigger('added', element_ids); }); } From 399fe249f8a52ddec15b40ad526eb4e3b9fba8fc Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 14 May 2012 18:33:23 +0200 Subject: [PATCH 18/39] [fix] fixed slow create bzr revid: nicolas.vanhoren@openerp.com-20120514163323-mqnqpmjng381wulr --- addons/web_kanban/static/src/js/kanban.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 4c03d619773..2a143934d2b 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -716,7 +716,8 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({ .pipe(function(record) { self.$input.val(""); self.trigger('added', record); - }, function() { + }, function(error, event) { + event.preventDefault(); return self.slow_create(); }); }, @@ -724,14 +725,14 @@ instance.web_kanban.QuickCreate = instance.web.Widget.extend({ var self = this; var pop = new instance.web.form.SelectCreatePopup(this); pop.select_element( - self.field.relation, + self._dataset.model, { title: _t("Create: ") + (this.string || this.name), initial_view: "form", disable_multiple_selection: true }, - undefined, - new instance.web.CompoundContext(self.build_context(), {"default_name": self.$input.val("")}) + [], + {"default_name": self.$input.val()} ); pop.on_select_elements.add(function(element_ids) { self.$input.val(""); From 6d70b97425e26bd6f17697baaf24dd7f4c432129 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 16 May 2012 12:16:34 +0200 Subject: [PATCH 19/39] [imp] small modif to view manager for future refactoring bzr revid: nicolas.vanhoren@openerp.com-20120516101634-bjne7hl4twvrfoy3 --- addons/web/static/src/js/view_form.js | 26 +++++++++++++++++--------- addons/web/static/src/js/views.js | 5 ++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 3c45e28e28f..f4820f3bd24 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2766,15 +2766,8 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ }); this.views = views; - this.viewmanager = new instance.web.ViewManager(this, this.dataset, views, { - $sidebar: false, - }); - this.viewmanager.template = 'One2Many.viewmanager'; - this.viewmanager.registry = instance.web.views.extend({ - list: 'instance.web.form.One2ManyListView', - form: 'instance.web.form.One2ManyFormView', - kanban: 'instance.web.form.One2ManyKanbanView', - }); + this.viewmanager = new instance.web.form.One2ManyViewManager(this, this.dataset, views, {}); + this.viewmanager.o2m = self; var once = $.Deferred().then(function() { self.init_form_last_update.resolve(); }); @@ -2958,6 +2951,21 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ }, }); +instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ + template: 'One2Many.viewmanager', + init: function(parent, dataset, views, flags) { + this._super(parent, dataset, views, _.extend({}, flags, {$sidebar: false})); + this.registry = this.registry.extend({ + list: 'instance.web.form.One2ManyListView', + form: 'instance.web.form.One2ManyFormView', + kanban: 'instance.web.form.One2ManyKanbanView', + }); + }, + switch_view: function(mode, unused) { + return this._super(mode, unused); + }, +}); + instance.web.form.One2ManyDataSet = instance.web.BufferedDataSet.extend({ get_context: function() { this.context = this.o2m.build_context([this.o2m.name]); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index de2ff53a71a..fae16dbd88f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -295,7 +295,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ if (view.embedded_view) { controller.set_embedded_view(view.embedded_view); } - controller.do_switch_view.add_last(this.on_mode_switch); + controller.do_switch_view.add_last(_.bind(this.switch_view, this)); controller.do_prev_view.add_last(this.on_prev_view); var container = this.$element.find(".oe_view_manager_view_" + view_type); view_promise = controller.appendTo(container); @@ -342,6 +342,9 @@ instance.web.ViewManager = instance.web.Widget.extend({ }); return view_promise; }, + switch_view: function(view_type, no_store) { + return this.on_mode_switch(view_type, no_store); + }, /** * Returns to the view preceding the caller view in this manager's * navigation history (the navigation history is appended to via From 4d944fd34102bdc0f33f52c358dd56b9b476c8cc Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 16 May 2012 12:52:51 +0200 Subject: [PATCH 20/39] [imp] implemented switch_view in o2m view manager and used it in kanban view bzr revid: nicolas.vanhoren@openerp.com-20120516105251-rebt18lj9bwndydw --- addons/web/static/src/js/view_form.js | 47 ++++++++++++++------------- addons/web/static/src/js/views.js | 5 +++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f4820f3bd24..25a49199241 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2962,7 +2962,30 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ }); }, switch_view: function(mode, unused) { - return this._super(mode, unused); + if (mode !== 'form') { + return this._super(mode, unused); + } + var self = this; + var id = typeof(self.o2m.dataset.index) === "number" && self.o2m.dataset.index >= 0 ? + self.o2m.dataset.ids[self.o2m.dataset.index] : null; + var pop = new instance.web.form.FormOpenPopup(self.o2m.view); + pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), { + title: _t("Open: ") + self.name, + auto_write: false, + alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined, + parent_view: self.o2m.view, + child_name: self.o2m.name, + read_function: function() { + return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments); + }, + form_view_options: {'not_interactible_on_create':true}, + readonly: self.o2m.get("effective_readonly") + }); + pop.on_write.add(function(id, data) { + self.o2m.dataset.write(id, data, {}, function(r) { + self.o2m.reload_current_view(); + }); + }); }, }); @@ -3059,28 +3082,6 @@ var lazy_build_o2m_kanban_view = function() { if (! instance.web_kanban || instance.web.form.One2ManyKanbanView) return; instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({ - open_record: function(id) { - var self = this; - var pop = new instance.web.form.FormOpenPopup(self.o2m.view); - pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), { - title: _t("Open: ") + self.name, - auto_write: false, - alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined, - parent_view: self.o2m.view, - child_name: self.o2m.name, - read_function: function() { - return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments); - }, - form_view_options: {'not_interactible_on_create':true}, - readonly: self.o2m.get("effective_readonly"), - }); - pop.on_write.add(function(id, data) { - self.o2m.dataset.write(id, data, {}, function(r) { - self.o2m.reload_current_view(); - }); - }); - - }, }); } diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index fae16dbd88f..d0af4811142 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -342,6 +342,11 @@ instance.web.ViewManager = instance.web.Widget.extend({ }); return view_promise; }, + /** + * Method used internally when a view asks to switch view. This method is meant + * to be extended by child classes to change the default behavior, which simply + * consist to switch to the asked view. + */ switch_view: function(view_type, no_store) { return this.on_mode_switch(view_type, no_store); }, From a4e5ef3bd1d962df6457f6e248f01516f101a066 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 16 May 2012 13:16:59 +0200 Subject: [PATCH 21/39] [IMP] Opportunities form view: use
for buttons, highlight first action button in topbar bzr revid: fme@openerp.com-20120516111659-zlc768ymthbyedjr --- addons/crm/crm_lead_view.xml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 44e866a3341..ca193cc48e1 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -400,7 +400,7 @@ 20
-
+
- - -
From 33c304d53154d09b20d0689717f0a17c57f63b50 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 16 May 2012 13:18:41 +0200 Subject: [PATCH 22/39] [IMP] Labels in bold bzr revid: fme@openerp.com-20120516111841-85xn2ghpbm15gjsr --- addons/web/static/src/css/base.css | 6 +++++- addons/web/static/src/css/base.sass | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 5d2102630cb..b2c4066a2c7 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "UTF-8"; +@charset "utf-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -117,6 +117,9 @@ float: right; margin-left: 8px; } +.openerp .oe_text_right { + text-align: right; +} .openerp .oe_clear { clear: both; } @@ -1546,6 +1549,7 @@ padding: 0; } .openerp .oe_form .oe_form_label_help[for], .openerp .oe_form .oe_form_label[for] { + font-weight: bold; white-space: nowrap; padding-right: 8px; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 567732ed080..411e345bc9f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -143,6 +143,8 @@ $colour4: #8a89ba .oe_right float: right margin-left: 8px + .oe_text_right + text-align: right .oe_clear clear: both .oe_wait @@ -1265,6 +1267,7 @@ $colour4: #8a89ba // FormView.label {{{ .oe_form .oe_form_label_help[for], .oe_form_label[for] + font-weight: bold white-space: nowrap padding-right: 8px span From c8838959cf64fd673ab9703cfb1d5bbcf6d3357a Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 16 May 2012 13:25:34 +0200 Subject: [PATCH 23/39] [IMP] Opportunities form view: add a clear element in case actions buttons are all hidden bzr revid: fme@openerp.com-20120516112534-suwavwiiohusvq3a --- addons/crm/crm_lead_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index ca193cc48e1..9c3bd07562c 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -411,6 +411,7 @@
+
From 57894a5361cadb6a4829de15de83a0b0ead88e16 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 16 May 2012 13:58:56 +0200 Subject: [PATCH 24/39] [imp] created AbstractFormPopup bzr revid: nicolas.vanhoren@openerp.com-20120516115856-p0tjpkfewq1y8ez8 --- addons/web/static/src/js/data.js | 3 - addons/web/static/src/js/view_form.js | 173 ++++++++++++-------------- addons/web/static/src/xml/base.xml | 27 ++-- 3 files changed, 91 insertions(+), 112 deletions(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 2dc66aaa135..29e21400b25 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -1096,7 +1096,6 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({ if (this.create_function) { return this.create_function(data, callback, error_callback); } else { - console.warn("trying to create a record using default proxy dataset behavior"); return $.async_when({"result": undefined}).then(callback); } }, @@ -1106,14 +1105,12 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({ if (this.write_function) { return this.write_function(id, data, options, callback); } else { - console.warn("trying to write a record using default proxy dataset behavior"); return $.async_when({"result": true}).then(callback); } }, on_write: function(id, data) {}, unlink: function(ids, callback, error_callback) { this.on_unlink(ids); - console.warn("trying to unlink a record using default proxy dataset behavior"); return $.async_when({"result": true}).then(callback); }, on_unlink: function(ids) {} diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 25a49199241..7fdcc030d83 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2966,8 +2966,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ return this._super(mode, unused); } var self = this; - var id = typeof(self.o2m.dataset.index) === "number" && self.o2m.dataset.index >= 0 ? - self.o2m.dataset.ids[self.o2m.dataset.index] : null; + var id = self.o2m.dataset.index !== null ? self.o2m.dataset.ids[self.o2m.dataset.index] : null; var pop = new instance.web.form.FormOpenPopup(self.o2m.view); pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), { title: _t("Open: ") + self.name, @@ -3362,12 +3361,73 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in } }); +instance.web.form.AbstractFormPopup = instance.web.OldWidget.extend({ + template: "AbstractFormPopup.render", + /** + * options: + */ + init_popup: function(model, row_id, domain, context, options) { + this.row_id = row_id; + this.model = model; + this.domain = domain || []; + this.context = context || {}; + this.options = options; + _.defaults(this.options, { + }); + }, + setup_form_view: function() { + var self = this; + var options = _.clone(self.options.form_view_options) || {}; + if (this.row_id !== null) { + options.initial_mode = this.options.readonly ? "view" : "edit"; + } + this.view_form = new instance.web.FormView(this, this.dataset, false, options); + if (this.options.alternative_form_view) { + this.view_form.set_embedded_view(this.options.alternative_form_view); + } + this.view_form.appendTo(this.$element.find(".oe-form-view-popup-form-placeholder")); + this.view_form.on_loaded.add_last(function() { + var $buttons = self.view_form.$element.find(".oe_form_buttons"); + var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; + $buttons.html(QWeb.render("AbstractFormPopup.buttons", {multi_select: multi_select})); + var $snbutton = $buttons.find(".oe_abstractformpopup-form-save-new"); + $snbutton.click(function() { + $.when(self.view_form.do_save()).then(function() { + self.view_form.reload_mutex.exec(function() { + self.view_form.on_button_new(); + }); + }); + }); + var $sbutton = $buttons.find(".oe_abstractformpopup-form-save"); + $sbutton.click(function() { + $.when(self.view_form.do_save()).then(function() { + self.view_form.reload_mutex.exec(function() { + self.check_exit(); + }); + }); + }); + var $cbutton = $buttons.find(".oe_abstractformpopup-form-close"); + $cbutton.click(function() { + self.check_exit(); + }); + if (self.row_id !== null && self.options.readonly) { + $snbutton.hide(); + $sbutton.hide(); + $cbutton.text(_t("Close")); + } + self.view_form.do_show(); + }); + }, + check_exit: function() { + this.destroy(); + }, +}); + /** * @class * @extends instance.web.OldWidget */ -instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends instance.web.form.SelectCreatePopup# */{ - template: "SelectCreatePopup", +instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend(/** @lends instance.web.form.SelectCreatePopup# */{ /** * options: * - initial_ids @@ -3383,12 +3443,14 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i */ select_element: function(model, options, domain, context) { var self = this; - this.model = model; - this.domain = domain || []; - this.context = context || {}; - this.options = _.defaults(options || {}, {"initial_view": "search", "create_function": function() { - return self.create_row.apply(self, arguments); - }, read_function: null}); + this.init_popup(model, null, domain, context, _.extend({}, options, {create_mode:true})); + _.defaults(this.options, { + "initial_view": "search", + "create_function": function() { + return self.create_row.apply(self, arguments); + }, + read_function: null, + }); this.initial_ids = this.options.initial_ids; this.created_elements = []; this.renderElement(); @@ -3521,7 +3583,6 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i } }, new_object: function() { - var self = this; if (this.searchview) { this.searchview.hide(); } @@ -3529,36 +3590,7 @@ instance.web.form.SelectCreatePopup = instance.web.OldWidget.extend(/** @lends i this.view_list.$element.hide(); } this.dataset.index = null; - this.view_form = new instance.web.FormView(this, this.dataset, false, self.options.form_view_options); - if (this.options.alternative_form_view) { - this.view_form.set_embedded_view(this.options.alternative_form_view); - } - this.view_form.appendTo(this.$element.find(".oe-select-create-popup-view-form")); - this.view_form.on_loaded.add_last(function() { - var $buttons = self.view_form.$element.find(".oe_form_buttons"); - $buttons.html(QWeb.render("SelectCreatePopup.form.buttons", {widget:self})); - var $nbutton = $buttons.find(".oe_selectcreatepopup-form-save-new"); - $nbutton.click(function() { - $.when(self.view_form.do_save()).then(function() { - self.view_form.reload_mutex.exec(function() { - self.view_form.on_button_new(); - }); - }); - }); - var $nbutton = $buttons.find(".oe_selectcreatepopup-form-save"); - $nbutton.click(function() { - $.when(self.view_form.do_save()).then(function() { - self.view_form.reload_mutex.exec(function() { - self.check_exit(); - }); - }); - }); - var $cbutton = $buttons.find(".oe_selectcreatepopup-form-close"); - $cbutton.click(function() { - self.check_exit(); - }); - }); - this.view_form.do_show(); + this.setup_form_view(); }, check_exit: function() { if (this.created_elements.length > 0) { @@ -3587,8 +3619,7 @@ instance.web.form.SelectCreateListView = instance.web.ListView.extend({ * @class * @extends instance.web.OldWidget */ -instance.web.form.FormOpenPopup = instance.web.OldWidget.extend(/** @lends instance.web.form.FormOpenPopup# */{ - template: "FormOpenPopup", +instance.web.form.FormOpenPopup = instance.web.form.AbstractFormPopup.extend(/** @lends instance.web.form.FormOpenPopup# */{ /** * options: * - alternative_form_view @@ -3600,10 +3631,10 @@ instance.web.form.FormOpenPopup = instance.web.OldWidget.extend(/** @lends insta * - readonly */ show_element: function(model, row_id, context, options) { - this.model = model; - this.row_id = row_id; - this.context = context || {}; - this.options = _.defaults(options || {}, {"auto_write": true}); + this.init_popup(model, row_id, [], context, _.extend({}, options, {create_mode:false})); + _.defaults(this.options, { + "auto_write": true, + }); this.renderElement(); instance.web.dialog(this.$element, { title: options.title || '', @@ -3615,15 +3646,16 @@ instance.web.form.FormOpenPopup = instance.web.OldWidget.extend(/** @lends insta }, start: function() { this._super(); - this.dataset = new instance.web.form.FormOpenDataset(this, this.model, this.context); - this.dataset.fop = this; + this.dataset = new instance.web.ProxyDataSet(this, this.model, this.context); + this.dataset.read_function = this.options.read_function; this.dataset.ids = [this.row_id]; this.dataset.index = 0; this.dataset.parent_view = this.options.parent_view; this.dataset.child_name = this.options.child_name; + this.dataset.on_write.add(this.write_row); this.setup_form_view(); }, - on_write: function(id, data) { + write_row: function(id, data) { if (!this.options.auto_write) return; var self = this; @@ -3635,47 +3667,6 @@ instance.web.form.FormOpenPopup = instance.web.OldWidget.extend(/** @lends insta }); }, on_write_completed: function() {}, - setup_form_view: function() { - var self = this; - var FormClass = instance.web.views.get_object('form'); - var options = _.clone(self.options.form_view_options) || {}; - options.initial_mode = this.options.readonly ? "view" : "edit"; - this.view_form = new FormClass(this, this.dataset, false, options); - if (this.options.alternative_form_view) { - this.view_form.set_embedded_view(this.options.alternative_form_view); - } - this.view_form.appendTo(this.$element.find(".oe-form-open-popup-form-view")); - this.view_form.on_loaded.add_last(function() { - var $buttons = self.view_form.$element.find(".oe_form_buttons"); - $buttons.html(QWeb.render("FormOpenPopup.form.buttons")); - var $nbutton = $buttons.find(".oe_formopenpopup-form-save"); - $nbutton.click(function() { - self.view_form.do_save().then(function() { - self.destroy(); - }); - }); - var $cbutton = $buttons.find(".oe_formopenpopup-form-close"); - $cbutton.click(function() { - self.destroy(); - }); - if (self.options.readonly) { - $nbutton.hide(); - $cbutton.text(_t("Close")); - } - self.view_form.do_show(); - }); - this.dataset.on_write.add(this.on_write); - } -}); - -instance.web.form.FormOpenDataset = instance.web.ProxyDataSet.extend({ - read_ids: function() { - if (this.fop.options.read_function) { - return this.fop.options.read_function.apply(null, arguments); - } else { - return this._super.apply(this, arguments); - } - } }); instance.web.form.FieldReference = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b2af11b7078..d46c6a9fa58 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1525,7 +1525,7 @@
- +
@@ -1539,31 +1539,22 @@
-
+
- - - + + + - - - + + + - - - -
-
-
-
- - - +