'Accounting Valuation Entries'

def _account_entry_move(self, move):

    if ((move.product_id.type != 'product') or (move.product_id.valuation != 'real_time')):
        return False
    if any(((quant.owner_id or (quant.qty <= 0)) for quant in self)):
        return False
    location_from = move.location_id
    location_to = self[0].location_id
    company_from = (((location_from.usage == 'internal') and location_from.company_id) or False)
    company_to = ((location_to and (location_to.usage == 'internal') and location_to.company_id) or False)
    if (company_to and (((move.location_id.usage not in ('internal', 'transit')) and (move.location_dest_id.usage == 'internal')) or (company_from != company_to))):
        (journal_id, acc_src, acc_dest, acc_valuation) = move._get_accounting_data_for_valuation()
        if (location_from and (location_from.usage == 'customer')):
            self.with_context(force_company=company_to.id)._create_account_move_line(move, acc_dest, acc_valuation, journal_id)
        else:
            self.with_context(force_company=company_to.id)._create_account_move_line(move, acc_src, acc_valuation, journal_id)
    if (company_from and (((move.location_id.usage == 'internal') and (move.location_dest_id.usage not in ('internal', 'transit'))) or (company_from != company_to))):
        (journal_id, acc_src, acc_dest, acc_valuation) = move._get_accounting_data_for_valuation()
        if (location_to and (location_to.usage == 'supplier')):
            self.with_context(force_company=company_from.id)._create_account_move_line(move, acc_valuation, acc_src, journal_id)
        else:
            self.with_context(force_company=company_from.id)._create_account_move_line(move, acc_valuation, acc_dest, journal_id)
    if (move.company_id.anglo_saxon_accounting and (move.location_id.usage == 'supplier') and (move.location_dest_id.usage == 'customer')):
        (journal_id, acc_src, acc_dest, acc_valuation) = move._get_accounting_data_for_valuation()
        self.with_context(force_company=move.company_id.id)._create_account_move_line(move, acc_src, acc_dest, journal_id)
