-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by nimarosa
- Loading branch information
Showing
7 changed files
with
233 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from . import hr_payroll_account | ||
from . import hr_contract | ||
from . import hr_payslip_line | ||
from . import hr_payslip_run | ||
from . import hr_payslip | ||
from . import hr_salary_rule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class HrContract(models.Model): | ||
_inherit = "hr.contract" | ||
_description = "Employee Contract" | ||
|
||
analytic_account_id = fields.Many2one( | ||
"account.analytic.account", "Analytic Account" | ||
) | ||
journal_id = fields.Many2one("account.journal", "Salary Journal") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
|
||
from odoo import models | ||
|
||
|
||
class HrPayslipLine(models.Model): | ||
_inherit = "hr.payslip.line" | ||
|
||
def _get_partner_id(self, credit_account): | ||
""" | ||
Get partner_id of slip line to use in account_move_line | ||
""" | ||
# use partner of salary rule or fallback on employee's address | ||
register_partner_id = self.salary_rule_id.register_id.partner_id | ||
partner_id = ( | ||
register_partner_id.id or self.slip_id.employee_id.address_home_id.id | ||
) | ||
acc_type = self.salary_rule_id.account_debit.account_type | ||
if credit_account: | ||
acc_type = self.salary_rule_id.account_credit.account_type | ||
if register_partner_id or acc_type in ("asset_receivable", "liability_payable"): | ||
return partner_id | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class HrPayslipRun(models.Model): | ||
_inherit = "hr.payslip.run" | ||
|
||
journal_id = fields.Many2one( | ||
"account.journal", | ||
"Salary Journal", | ||
states={"draft": [("readonly", False)]}, | ||
readonly=True, | ||
required=True, | ||
default=lambda self: self.env["account.journal"].search( | ||
[("type", "=", "general")], limit=1 | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class HrSalaryRule(models.Model): | ||
_inherit = "hr.salary.rule" | ||
|
||
company_id = fields.Many2one( | ||
"res.company", | ||
string="Company", | ||
required=True, | ||
default=lambda self: self.env.company, | ||
) | ||
analytic_account_id = fields.Many2one( | ||
"account.analytic.account", "Analytic Account" | ||
) | ||
account_tax_id = fields.Many2one("account.tax", "Tax") | ||
account_debit = fields.Many2one( | ||
"account.account", | ||
"Debit Account", | ||
domain=[("deprecated", "=", False)], | ||
company_dependent=True, | ||
) | ||
account_credit = fields.Many2one( | ||
"account.account", | ||
"Credit Account", | ||
domain=[("deprecated", "=", False)], | ||
company_dependent=True, | ||
) | ||
|
||
tax_base_id = fields.Many2one("hr.salary.rule", "Base") | ||
tax_line_ids = fields.One2many("hr.salary.rule", "tax_base_id", string="Tax lines") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters