Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] payroll #85

Merged
merged 119 commits into from
Nov 11, 2022
Merged

[16.0][MIG] payroll #85

merged 119 commits into from
Nov 11, 2022

Conversation

mtelahun
Copy link
Contributor

Fixes: #76
cc: #78

@oca-clabot
Copy link

Hey @mtelahun, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: https://odoo-community.org/page/cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

@nimarosa
Copy link
Contributor

/ocabot migration payroll

@mtelahun
Copy link
Contributor Author

mtelahun commented Nov 2, 2022

@nimarosa @apps2grow Please review. It's ready now, including recent changes to 14.0

davejames and others added 22 commits November 11, 2022 12:06
this commit renames the module from hr_payroll to payroll. This is to avoid conflicting with the hr_payroll module included in Odoo Enterprise
Also removes links to localisations which have not yet been migrated. These can be re-added when the localisations are ported.
author nicolasrsande <nicolasrsande@gmail.com> 1643135061 -0300
committer nicolasrsande <nicolasrsande@gmail.com> 1643668459 -0300

fix typo in leave calculation

default for worked days should not compute leaves, because leaves are calculated separately

we should not add data because it interfers with custom localization payroll modules

fix pre-commit

add demo data so the test can be executed

leaves should be computed in negative value to help creating salary rules

Add mantainer key

remove mantainer in payroll_account

14.0-minor-fixes

fix typo in leave calculation

we should not add data because it interfers with custom localization payroll modules

fix pre-commit

add demo data so the test can be executed

leaves should be computed in negative value to help creating salary rules

Add mantainer key

remove mantainer in payroll_account

14.0-payroll-minor-fixes
accept suggestion use repr() on the string

change indentation of error
Currently translated at 93.6% (266 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/ca/
Currently translated at 100.0% (284 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/ca/
Currently translated at 86.9% (247 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
Currently translated at 100.0% (284 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
Currently translated at 100.0% (284 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
Currently translated at 100.0% (284 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/es_AR/
Currently translated at 78.1% (222 of 284 strings)

Translation: payroll-14.0/payroll-14.0-payroll
Translate-URL: https://translation.odoo-community.org/projects/payroll-14-0/payroll-14-0-payroll/it/
@mtelahun
Copy link
Contributor Author

@nimarosa @apps2grow Please review and merge.

  • Simple functional test
  • Had to make some changes to salary rules view to make it look good in the browser
  • Removed migration files

@nimarosa
Copy link
Contributor

@mtelahun the changes you did in views are you sure they are not related to a browser thing? Can you show a screenshot of how you se the view and we compare? But I think on my end I can't replicate.

@mtelahun
Copy link
Contributor Author

mtelahun commented Nov 11, 2022 via email

@mtelahun
Copy link
Contributor Author

Here's the diff to 14.0 for reference:

diff --git a/payroll/views/hr_salary_rule_views.xml b/payroll/views/hr_salary_rule_views.xml
index a559026..e78537e 100644
--- a/payroll/views/hr_salary_rule_views.xml
+++ b/payroll/views/hr_salary_rule_views.xml
@@ -4,7 +4,7 @@
         <field name="name">hr.salary.rule.list</field>
         <field name="model">hr.salary.rule</field>
         <field name="arch" type="xml">
-            <tree string="Salary Rules">
+            <tree>
                 <field name="name" />
                 <field name="code" decoration-bf="1" />
                 <field name="category_id" widget="badge" />
@@ -53,7 +53,7 @@
         <field name="field_parent">child_ids</field>
         <field eval="20" name="priority" />
         <field name="arch" type="xml">
-            <tree string="Salary Rules">
+            <tree>
                 <field name="name" />
                 <field name="code" />
                 <field name="category_id" invisible="True" />
@@ -126,11 +126,12 @@
                                         decoration-info="1"
                                         decoration-bf="1"
                                         nolabel="1"
+                                        colspan="2"
                                     />
                                     <field
                                         name="condition_python"
                                         attrs="{'invisible':[('condition_select','!=','python')], 'required': [('condition_select','=','python')]}"
-                                        colspan="4"
+                                        colspan="2"
                                         widget="ace"
                                         options="{'mode': 'python'}"
                                         id="condition_python"
@@ -169,6 +170,7 @@
                                         decoration-info="1"
                                         decoration-bf="1"
                                         nolabel="1"
+                                        colspan="2"
                                     />
                                     <field
                                         name="amount_percentage_base"
@@ -183,7 +185,7 @@
                                         attrs="{'invisible':[('amount_select','!=','fix')], 'required':[('amount_select','=','fix')]}"
                                     />
                                     <field
-                                        colspan="4"
+                                        colspan="2"
                                         name="amount_python_compute"
                                         attrs="{'invisible':[('amount_select','!=','code')], 'required':[('amount_select','=','code')]}"
                                         widget="ace"
@@ -216,116 +218,114 @@
                         </page>
                         <page name="inputs" string="Inputs">
                             <field name="input_ids" mode="tree">
-                                <tree string="Input Data" editable="bottom">
+                                <tree editable="bottom">
                                     <field name="code" />
                                     <field name="name" />
                                 </tree>
                             </field>
                         </page>
                         <page name="help" string="Help">
-                            <group>
-                                <div style="margin-top: 4px;">
-                                    <h3>Salary Rules formula definition (Python)</h3>
-                                    <p>
-                                        In python definition in salary rules, you can write any code like you will do
-                                        in python. Any methematical operation or python function is supported.
-                                    </p>
-                                    <p>
-                                        The following objects and variables are available to you to use it in salary rules calculations.
-                                    </p>
-                                    <ul>
-                                        <li>
-                                            <code
-                                            >payslip:</code> contains current payslip object data (hr.payslip)
-                                        </li>
-                                        <li>
-                                            <code
-                                            >payslips:</code> contains payslips data (Payslips - Browsable Object)
-                                        </li>
-                                        <li>
-                                            <code
-                                            >employee:</code> contains current employee object data (hr.employee)
-                                        </li>
-                                        <li>
-                                            <code
-                                            >contract:</code> contains current contract object data (hr.contract)
-                                        </li>
-                                        <li>
-                                            <code
-                                            >rules:</code> contains the rules code (previusly computed)
-                                        </li>
-                                        <li>
-                                            <code
-                                            >categories:</code> contains the sum of amount of all rules belonging to that category
-                                        </li>
-                                        <li>
-                                            <code
-                                            >worked_days:</code> contains the computed worked days data
-                                        </li>
-                                        <li>
-                                            <code
-                                            >inputs:</code> contains the computed input data
-                                        </li>
-                                        <li>
-                                            <code
-                                            >payroll:</code> contains miscellaneous values related to payroll
-                                        </li>
-                                        <li>
-                                            <code
-                                            >current_contract:</code> contains values related/calculated for current contract
-                                        </li>
-                                        <li>
-                                            <code
-                                            >result_rules:</code> contains the values of previusly computed lines (qty, rate, amount, total)
-                                        </li>
-                                        <li>
-                                            <code
-                                            >tools:</code> contains tools and libraries which help with mathematical operations
-                                        </li>
-                                    </ul>
-                                    <p>
-                                        The calculations should be performed using the objects and variables below.
-                                        Then, you have to use specific compute variables which will store the data
-                                        for salary rule computation.
-                                    </p>
-                                    <ul>
-                                        <li>
-                                            <code
-                                            >result:</code> the returned value should be in this variable. It matches with "amount" column.
-                                        </li>
-                                        <li>
-                                            <code
-                                            >result_rate:</code> the rate that should be applied to "result"
-                                        </li>
-                                        <li>
-                                            <code
-                                            >result_qty:</code> the quantity of units that will be multiplied to "result"
-                                        </li>
-                                        <li>
-                                            <code
-                                            >result_name:</code> overrides the current name of the rule and allows to make dynamic names
-                                        </li>
-                                    </ul>
-                                    <h3>Examples</h3>
-                                    <ul>
-                                        <li>
-                                            <code>result = contract.wage * 0.10</code>
-                                        </li>
-                                        <li>
-                                            <code>
-                                                result = contract.wage
-                                                result_qty = worked_days.WORK100.number_of_days
-                                            </code>
-                                        </li>
-                                        <li>
-                                            <code>
-                                                result = contract.wage
-                                                result_rate = 10.0
-                                            </code>
-                                        </li>
-                                    </ul>
-                                </div>
-                            </group>
+                            <div style="margin-top: 4px;">
+                                <h3>Salary Rules formula definition (Python)</h3>
+                                <p>
+                                    In python definition in salary rules, you can write any code like you will do
+                                    in python. Any methematical operation or python function is supported.
+                                </p>
+                                <p>
+                                    The following objects and variables are available to you to use it in salary rules calculations.
+                                </p>
+                                <ul>
+                                    <li>
+                                        <code
+                                        >payslip:</code> contains current payslip object data (hr.payslip)
+                                    </li>
+                                    <li>
+                                        <code
+                                        >payslips:</code> contains payslips data (Payslips - Browsable Object)
+                                    </li>
+                                    <li>
+                                        <code
+                                        >employee:</code> contains current employee object data (hr.employee)
+                                    </li>
+                                    <li>
+                                        <code
+                                        >contract:</code> contains current contract object data (hr.contract)
+                                    </li>
+                                    <li>
+                                        <code
+                                        >rules:</code> contains the rules code (previusly computed)
+                                    </li>
+                                    <li>
+                                        <code
+                                        >categories:</code> contains the sum of amount of all rules belonging to that category
+                                    </li>
+                                    <li>
+                                        <code
+                                        >worked_days:</code> contains the computed worked days data
+                                    </li>
+                                    <li>
+                                        <code
+                                        >inputs:</code> contains the computed input data
+                                    </li>
+                                    <li>
+                                        <code
+                                        >payroll:</code> contains miscellaneous values related to payroll
+                                    </li>
+                                    <li>
+                                        <code
+                                        >current_contract:</code> contains values related/calculated for current contract
+                                    </li>
+                                    <li>
+                                        <code
+                                        >result_rules:</code> contains the values of previusly computed lines (qty, rate, amount, total)
+                                    </li>
+                                    <li>
+                                        <code
+                                        >tools:</code> contains tools and libraries which help with mathematical operations
+                                    </li>
+                                </ul>
+                                <p>
+                                    The calculations should be performed using the objects and variables below.
+                                    Then, you have to use specific compute variables which will store the data
+                                    for salary rule computation.
+                                </p>
+                                <ul>
+                                    <li>
+                                        <code
+                                        >result:</code> the returned value should be in this variable. It matches with "amount" column.
+                                    </li>
+                                    <li>
+                                        <code
+                                        >result_rate:</code> the rate that should be applied to "result"
+                                    </li>
+                                    <li>
+                                        <code
+                                        >result_qty:</code> the quantity of units that will be multiplied to "result"
+                                    </li>
+                                    <li>
+                                        <code
+                                        >result_name:</code> overrides the current name of the rule and allows to make dynamic names
+                                    </li>
+                                </ul>
+                                <h3>Examples</h3>
+                                <ul>
+                                    <li>
+                                        <code>result = contract.wage * 0.10</code>
+                                    </li>
+                                    <li>
+                                        <code>
+                                            result = contract.wage
+                                            result_qty = worked_days.WORK100.number_of_days
+                                        </code>
+                                    </li>
+                                    <li>
+                                        <code>
+                                            result = contract.wage
+                                            result_rate = 10.0
+                                        </code>
+                                    </li>
+                                </ul>
+                            </div>
                         </page>
                     </notebook>
                 </sheet>

@nimarosa
Copy link
Contributor

Tested it on runboat. Changes looks good.

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-85-by-nimarosa-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Contributor

@nimarosa The merge process could not be finalized, because command git push origin 16.0-ocabot-merge-pr-85-by-nimarosa-bump-nobump:16.0 failed with output:

To https://github.com/OCA/payroll
 ! [rejected]        16.0-ocabot-merge-pr-85-by-nimarosa-bump-nobump -> 16.0 (fetch first)
error: failed to push some refs to 'https://***@github.com/OCA/payroll'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

@OCA-git-bot OCA-git-bot merged commit d62b6a5 into OCA:16.0 Nov 11, 2022
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 3e8cf00. Thanks a lot for contributing to OCA. ❤️

@mtelahun mtelahun deleted the 16.0-mig-payroll branch November 12, 2022 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants