<commit_before>#-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from datetime import date, datetime, timedelta

from openerp.osv import fields, osv
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
from openerp.exceptions import UserError

class hr_payslip_line(osv.osv):
    '''
    Payslip Line
    '''
    _inherit = 'hr.payslip.line'

    def _get_partner_id(self, cr, uid, payslip_line, credit_account, context=None):
        """
        Get partner_id of slip line to use in account_move_line
        """
        # use partner of salary rule or fallback on employee's address
        partner_id = payslip_line.salary_rule_id.register_id.partner_id.id or \
            payslip_line.slip_id.employee_id.address_home_id.id
        if credit_account:
            if payslip_line.salary_rule_id.register_id.partner_id or \
                    payslip_line.salary_rule_id.account_credit.type in ('receivable', 'payable'):
                return partner_id
        else:
            if payslip_line.salary_rule_id.register_id.partner_id or \
                    payslip_line.salary_rule_id.account_debit.type in ('receivable', 'payable'):
                return partner_id
        return False


class hr_payslip(osv.osv):
    '''
    Pay Slip
    '''
    _inherit = 'hr.payslip'
    _description = 'Pay Slip'<commit_msg>[FIX] hr_payroll: wrong field in sheet computation<commit_after>#-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from datetime import date, datetime, timedelta

from openerp.osv import fields, osv
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
from openerp.exceptions import UserError

class hr_payslip_line(osv.osv):
    '''
    Payslip Line
    '''
    _inherit = 'hr.payslip.line'

    def _get_partner_id(self, cr, uid, payslip_line, credit_account, context=None):
        """
        Get partner_id of slip line to use in account_move_line
        """
        # use partner of salary rule or fallback on employee's address
        partner_id = payslip_line.salary_rule_id.register_id.partner_id.id or \
            payslip_line.slip_id.employee_id.address_home_id.id
        if credit_account:
            if payslip_line.salary_rule_id.register_id.partner_id or \
                    payslip_line.salary_rule_id.account_credit.internal_type in ('receivable', 'payable'):
                return partner_id
        else:
            if payslip_line.salary_rule_id.register_id.partner_id or \
                    payslip_line.salary_rule_id.account_debit.internal_type in ('receivable', 'payable'):
                return partner_id
        return False


class hr_payslip(osv.osv):
    '''
    Pay Slip
    '''
    _inherit = 'hr.payslip'
    _description = 'Pay Slip'
{'fraction_non_alphanumeric': 0.0803171320234402, 'fraction_numerical': 0.0006894174422612892, 'mean_word_length': 2.7835723598435465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6880506', 'n_tokens_mistral': 963, 'n_tokens_neox': 913, 'n_words': 219}